tenant-safe-background-jobs

Reconstruct tenant context from job payloads to prevent cross-tenant data leakage.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/marquesfelip/agents-and-skills --skill tenant-safe-background-jobs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tenant-safe-background-jobs
Source: https://github.com/marquesfelip/agents-and-skills/tree/main/skills/tenant-safe-background-jobs
Command: npx skills add https://github.com/marquesfelip/agents-and-skills --skill tenant-safe-background-jobs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tenant isolation during asynchronous job execution in multi-tenant SaaS systems; prevents tenant data from leaking across concurrent workers and ensures correct tenant context propagation.

Core Features & Use Cases

  • Explicit tenant payloads: every tenant-scoped job carries TenantID to reconstruct tenant context.
  • Safe worker context: re-fetches tenant from DB, checks status, validates entitlements, and builds per-tenant context for downstream calls.
  • Platform vs tenant jobs: global jobs fan out into per-tenant jobs; no cross-tenant contamination.

Quick Start

Enqueue a tenant-scoped background job with TenantID in the payload and ensure workers rebuild tenant context before processing.

Frequently Asked Questions about tenant-safe-background-jobs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent cross-tenant data leakage in background jobs?

Prevent cross-tenant data leakage by enforcing tenant-scoped background jobs that require a tenant_id in every payload and reconstruct per-tenant context before processing. This avoids shared global state across concurrent workers.

What is tenant context propagation in multi-tenant SaaS background workers?

Tenant context propagation in multi-tenant workers is the process of reconstructing tenant-specific context from the job payload. Workers re-fetch the tenant from the database, validate status and entitlements, and build isolated per-tenant contexts for downstream calls.

How do I handle platform-wide global jobs without contaminating tenant data?

Handle global platform jobs by fanning them out into individual per-tenant jobs. This ensures no cross-tenant contamination occurs, as each generated job carries a specific tenant_id and operates within its own safe, isolated context.

Do I need to validate tenant entitlements during async job execution?

Yes, you need to validate tenant entitlements during async job execution to ensure safe worker context. Workers re-fetch the tenant from the database, check tenant status, and validate entitlements before building per-tenant context for downstream calls.

Can I implement per-tenant retries and dead letter queues for background jobs?

Yes, you can implement per-tenant retries and DLQ behavior for tenant-scoped background jobs. This isolates failed jobs to the specific tenant context, preventing retry storms or DLQ contamination from affecting other tenants in the multi-tenant SaaS platform.