# Background Job Context Continuity

> Verify asynchronous jobs carry the authorization context of the identity that created them, so a queued task never gains or loses permission en route. Use when operations enqueue work asynchronously, from emails and reports to exports, webhooks and internal worker queues

- Skill: `wsh7ash/background-job-context-continuity` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/background-job-context-continuity`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/background-job-context-continuity/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: Wsh7Ash (https://skillmd.com/u/wsh7ash)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/wsh7ash/background-job-context-continuity

---


# Background Job Context Continuity

> Verify asynchronous jobs carry the authorization context of the identity that created them, so a queued task never gains or loses permission en route

**Use when:** operations enqueue work asynchronously, from emails and reports to exports, webhooks and internal worker queues

**Avoid when:** everything executes synchronously inside the request and background paths demonstrably do not exist

## Procedure

1. Enumerate asynchronous paths that any operation enqueues: queued tasks, scheduled jobs, webhooks, notification pipes and workers.
2. Trigger a job as each of your identities and record the context serialized into the queue: identity, tenant, scopes and roles.
3. Observe the executed job's authorization state: what it reads and writes, and whether it is checked against the creating identity.
4. Test state changes between enqueue and run, so a demoted or suspended identity's already-queued work is measured.
5. Record what the job writes, who it notifies and whether it honors creation-time identity for every downstream step.
6. Repeat for scheduled jobs that invoke on behalf of users, since residual identity drifts earliest in these paths.

## Signals

- A queued job executes with service-level privileges far wider than the identity that triggered it.
- A job for a suspended or demoted identity still grants resources that the requester would no longer be entitled to.
- Scheduled jobs that run on behalf of identities no longer capture the identity's present state at execution time.
- Webhooks triggered by jobs carry credentials from the trigger time rather than validated at delivery time.

## Patterns

**1. Queue sample**

```text
enqueue job(runner=alice tenant=A) -> run at executor=service-scope: tier=global-admin -> context dropped
```

**2. State-drift**

```text
alice demoted after enqueue -> job still exports tenant-A private rows -> run executes with enqueue-time privileges
```

**3. Result row**

```text
producer=POST /api/exports ran=in-worker context=alice-snapshot rights-at-runtime=stale major=role-grant-kept
```

## Pitfalls

- Assuming the queue serializes identity by default, when context is frequently dropped in serialized forms and rehydrated raw.
- Measuring one job type, such as exports, while scheduled and advertising jobs behave differently.
- Ignoring deduplication caches and run-history records that may preserve or leak prior authorization-time state.

## Done when

- Every asynchronous path with authorization context is enumerated, its serialized state recorded and its run-time rights observed.
- State drift between enqueue and run is tested explicitly and each outcome classified as faithful, stale or elevated.

## References

- [OWASP API Security Top 10](https://owasp.org/www-project-api-security/)
- [OWASP Web Security Testing Guide](https://owasp.org/www-project-web-security-testing-guide/)

