Cybersecurity / Intermediate: operational defensive reasoning / Lesson 14
Verify authorization across background job lifecycles
Test request, execution and result access when a synthetic user’s permissions change during delayed work.
On this page
Lesson goals
- Identify authorization decisions across a job lifecycle.
- Test access changes with synthetic users.
- Verify denied requests and protected result cleanup.
- Model authorization at submission, execution, storage and download under an explicit lifecycle policy.
- Verify revocation, worker scope and protected side effects with synthetic allowed and denied cases.
Define authority across a delayed action
A background export may begin while a user is authorized and finish after that user loses access. The security decision therefore has a time dimension: define who can request the work, what authority the worker receives and who may retrieve the result. In this fictional lab, a user requests a synthetic report and later loses access. Agree the intended behavior with the system owner before writing an expected result. Work only with synthetic accounts and an authorized isolated service.
Separate request and result access
Check authorization at the request boundary and specify how the job carries the minimum information needed to perform its task. A worker’s broad technical permission must not automatically become the requesting user’s permission to retrieve every result. Treat the generated file and its storage location as protected resources with a defined lifetime. The first table illustrates one agreed policy: the request may be accepted while active, but a later download is denied after access is revoked.
Time | Account state | Expected
request | active | job accepted
download | access revoked | denied
The example separates decisions at different times and does not claim execution.
Test a permission change
Create two synthetic users and a report owned by one of them. Allow the owner to submit the export, then change the owner’s access before the result is retrieved. Observe the job status and attempt retrieval as the former owner, the other user and an authorized administrator under the agreed policy. Keep the timing and identity of each action in the record. A simple success case with unchanged permissions cannot establish correct behavior after a role change.
Inspect outcomes and side effects
For each denied request inspect the response and any relevant stored state, including whether an unauthorized download was logged or a new copy was created. A denial message alone does not prove the absence of side effects. The second table separates the initial acceptance decision from the later retrieval decision. Avoid collecting real report contents or credentials in test evidence, and protect audit records from unauthorized access. If the worker has already created a file, define its retention and cleanup.
Observation | Question
job accepted | was access checked then?
download allowed | is current access checked?
The example separates decisions at different times and does not claim execution.
Review the lifecycle and limits
After implementing a correction, repeat both the allowed path and the denied paths using fresh synthetic data. Verify the result’s ownership, expiration and access checks across the agreed lifecycle, including a role change while the job is queued. Record any timing window or external storage behavior not tested. These checks support the stated policy for selected scenarios; they do not establish that all background jobs or every authorization boundary in the service are safe.
Model authority across a delayed task
A background export crosses several moments and identities: a requester submits a job, a worker reads data, a result is stored, and someone later requests a download. Define the authorization policy at each boundary rather than assuming that approval at submission grants permanent access to the result. Record the requester, resource scope, job identity, policy version, expiry and current result-access rule using safe identifiers.
For this lesson’s fictional policy, a user whose access is revoked before download is denied at download time. Other products may choose different semantics, so the policy must be stated and tested rather than assumed. The scenarios use synthetic users and files and do not enqueue jobs or access real reports.
Separate worker and requester permissions
A worker may need broad technical access to process many authorized jobs, but that authority does not become the requester’s permission to download every result. The service must bind each job and output to its authorized subject and resource scope. A different user who guesses a result identifier should be denied according to policy even if the worker can read the underlying records.
Apply least privilege to the worker too: limit resources, actions and credential lifetime to the processing task where possible, and assign an owner. Do not trust a requester-supplied owner or role field without verification. Test the allowed requester, unrelated user and missing subject at the actual result endpoint using synthetic data.
Define what happens when access changes
A queued job can outlive a role, assignment or account. Decide whether authorization is checked at submission, execution, download or multiple stages, and what happens to already generated data after revocation. A policy may cancel a pending job, allow processing but deny download, or require another reviewed behavior; each choice has different confidentiality and operational effects.
For a current-access policy, test a user who was authorized at submission but loses access before the worker runs and another who loses it before download. Verify the decision and inspect whether a protected file remains, where it is stored and how retention or cleanup is handled. A denied response alone does not establish that a file is inaccessible through every route.
Inspect state and side effects
A job that is denied or cancelled should not silently publish a result to an unrelated user or leave an unprotected artifact. Check job state, output metadata, storage access, download response and any notification independently. If a request times out, the job or file state may be unknown until an authorized safe read confirms it; do not infer absence from the timeout.
Retries and duplicate messages can create extra outputs unless the design defines idempotency and cleanup. A result may also be cached or linked after permission changes. Test these boundaries with inert synthetic files and identifiers in an isolated environment, and avoid exposing private reports or live credentials in evidence.
Build a lifecycle decision matrix
A useful matrix varies requester, resource, assignment at submission, assignment at execution and assignment at download. Include a permitted owner, unrelated user, missing subject, revoked requester and worker failure. State the expected outcome for each stage and the expected protected-file state. An overbroad implementation that denies everyone can pass negative tests, so preserve a legitimate positive path.
Exercise the real route and worker integration with trusted identity context, not only a local policy helper. Verify that the result endpoint rechecks access when the declared policy requires it and that a guessed job identifier does not substitute for permission. Record any route or asynchronous path that was not tested.
Review and close the lifecycle
An evidence record links the synthetic job and candidate to the policy version, requester and worker categories, stage times, decisions, output location, retention and cleanup outcome. Preserve the first failure and any retry separately. A completed job is not proof that a requester was authorized at download, and a denied download is not proof that all stored copies were removed.
After a policy or implementation change, rerun the relevant lifecycle cases and verify both allowed work and denied access. Escalate real changes to authorized maintainers. The resulting evidence applies to the tested stages and policy; it does not establish that every product uses the same revocation semantics or that all asynchronous paths are safe.
20 worked examples
1. Revoked before download
Problem: Analyze the synthetic revoked before download record and determine the justified lifecycle decision.
- A was authorized when submitting but no longer has access at download
- The fictional policy requires current access at that later boundary.
requester=A; submit_access=allowed; download_access=revoked; policy=current access at download
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Deny the download and inspect protected-file retention under the stated policy.
Why this result follows: Submission authorization does not automatically grant permanent result access.
2. Worker reads all reports
Problem: Analyze the synthetic worker reads all reports record and determine the justified lifecycle decision.
- The worker’s processing identity can read the data
- B is a different requester and lacks owner permission for A’s result.
worker_scope=all_reports; requester=B; requested_result=owned_by_A; policy=owner only
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Deny B’s download despite the worker’s broader technical read access.
Why this result follows: Worker authority and requester authorization are separate boundaries.
3. Authorized owner download
Problem: Analyze the synthetic authorized owner download record and determine the justified lifecycle decision.
- The current requester matches the result owner and has access
- The policy permits that combination.
requester=A; result.owner=A; current_access=allowed; policy=current owner access
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Allow the download under the stated policy and verify it contains only A’s authorized scope.
Why this result follows: A positive control ensures legitimate access is not blocked indiscriminately.
4. Guessed result identifier
Problem: Analyze the synthetic guessed result identifier record and determine the justified lifecycle decision.
- The job identifier refers to A’s result but does not make B its owner
- The policy requires owner access.
requester=B; guessed_job_id=J_A; result.owner=A; policy=owner only
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Deny B’s request and do not reveal A’s private result.
Why this result follows: Knowledge of an identifier is not permission.
5. Missing subject
Problem: Analyze the synthetic missing subject record and determine the justified lifecycle decision.
- No trusted requester identity is present
- The request cannot satisfy the authenticated-owner condition.
download.subject=missing; result=protected; policy=authenticated owner required
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Require authentication or deny according to policy; do not return the file.
Why this result follows: A missing subject cannot be replaced by possession of a link alone.
6. Revoked before execution
Problem: Analyze the synthetic revoked before execution record and determine the justified lifecycle decision.
- The requester’s access was removed before execution
- The policy requires a current check before the worker reads.
submit_access=allowed; execution_access=revoked; policy=recheck before worker read
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Do not read the protected data for this job under the stated policy.
Why this result follows: Delayed work needs an explicit rule for changes between stages.
7. Process then deny download
Problem: Analyze the synthetic process then deny download record and determine the justified lifecycle decision.
- The fictional policy permits processing after submission but requires current access at download
- The requester is revoked at that later stage.
submit_access=allowed; execution=complete; download_access=revoked; policy=process then recheck download
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Deny download and handle the protected output under the documented retention policy.
Why this result follows: Execution and result access can have different declared decisions.
8. Denied but public file
Problem: Analyze the synthetic denied but public file record and determine the justified lifecycle decision.
- The application endpoint denied the request
- A separate public storage route still exposes the file.
download_response=denied; output_storage=public; guessed_URL=accessible
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The result boundary fails because the protected file remains publicly accessible.
Why this result follows: A denial response does not protect an independently reachable copy.
9. Denied and retained privately
Problem: Analyze the synthetic denied and retained privately record and determine the justified lifecycle decision.
- The output remains stored but is not public in the fixture
- The policy retains it for seven days under an owner.
download_response=denied; output_storage=private; retention=7days; owner=team
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The denial and private retention are separate documented states; verify cleanup at expiry.
Why this result follows: Denying access does not imply that every protected copy was deleted.
10. Requester-supplied owner
Problem: Analyze the synthetic requester-supplied owner record and determine the justified lifecycle decision.
- The request body claims A while the trusted session identifies B
- The policy evaluates the trusted subject.
request.owner=A; trusted_session=B; result.owner=A; policy=trusted subject only
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Do not treat the supplied owner field as authority for B’s download.
Why this result follows: A client-controlled attribute cannot grant its own permission.
11. Timeout during submission
Problem: Analyze the synthetic timeout during submission record and determine the justified lifecycle decision.
- The client received no definite response
- No later observation establishes whether the job was created.
submit_request=timeout; job_state=unknown; safe_read=not_done
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Treat job creation as unknown until an authorized safe state check.
Why this result follows: A timeout does not prove the job was absent or completed.
12. Duplicate queue message
Problem: Analyze the synthetic duplicate queue message record and determine the justified lifecycle decision.
- The same job produced two outputs while the policy permits one
- A retry or duplicate message may have created an extra artifact.
job=J1; messages=2; outputs=2; policy=one output per job
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Flag the duplicate-output invariant and investigate idempotency and cleanup.
Why this result follows: Authorization and side-effect count both matter for a background lifecycle.
13. Expired result link
Problem: Analyze the synthetic expired result link record and determine the justified lifecycle decision.
- The request occurs one minute after the expiry
- The declared policy rejects links after that boundary.
result.owner=A; link.expiry=10:00; request=10:01; policy=reject expired
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Reject the expired link under the stated policy and require the approved access flow.
Why this result follows: A result link can have a lifetime independent of job completion.
14. Worker credential too broad
Problem: Analyze the synthetic worker credential too broad record and determine the justified lifecycle decision.
- The worker task needs a specific read scope
- Administrator access to all resources exceeds that stated need.
worker_task=read dataset_A; worker_permission=admin_all; owner=team
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Review and narrow the worker permission through the approved process.
Why this result follows: A trusted worker still benefits from least privilege.
15. Notification leaks result
Problem: Analyze the synthetic notification leaks result record and determine the justified lifecycle decision.
- The response endpoint denied B, but the notification contains A’s private data
- A different output channel disclosed the result.
requester=B unrelated; download=denied; notification=contains A private data
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The privacy boundary fails despite the denied download.
Why this result follows: Every result channel needs an appropriate authorization and data boundary.
16. Revocation propagation delay
Problem: Analyze the synthetic revocation propagation delay record and determine the justified lifecycle decision.
- The request occurs after revocation but before cache expiry
- The policy requires current access rather than that stale decision.
access_revoked=10:00; cached_allow_until=10:10; policy=immediate recheck; request=10:05
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: Deny under the stated policy; the stale cached allowance conflicts with immediate recheck.
Why this result follows: Policy timing and cache behavior must be tested together.
17. Worker failure no output
Problem: Analyze the synthetic worker failure no output record and determine the justified lifecycle decision.
- The worker failed before writing an output
- The observed state records both failure and absence of the file.
worker=failed before write; output=absent; job_state=failed; policy=report failure
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The fixture supports a failed job with no output for this path.
Why this result follows: Failure handling needs an explicit output-state observation.
18. Policy version mismatch
Problem: Analyze the synthetic policy version mismatch record and determine the justified lifecycle decision.
- The test uses a submission-only policy
- The release requirement calls for current access at a later stage.
required_policy=v2 current-access; job_test_policy=v1 submission-only; test=pass
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The passing test does not establish the required v2 lifecycle behavior.
Why this result follows: A lifecycle test must match the policy version it claims to verify.
19. Cache after revocation
Problem: Analyze the synthetic cache after revocation record and determine the justified lifecycle decision.
- The application policy denies the requester after revocation
- The separate cache still serves the protected copy without that decision.
download_access=revoked; CDN_copy=accessible_without_check; policy=current access
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The result boundary fails because a cached copy bypasses the current-access check.
Why this result follows: Every delivery path must enforce the declared access policy.
20. Synthetic lifecycle matrix
Problem: Analyze the synthetic synthetic lifecycle matrix record and determine the justified lifecycle decision.
- The three decisions match the policy for the listed subjects
- Private storage is separately observed in the record.
owner=allowed; unrelated=denied; revoked=denied; private_storage=verified; policy=current access
The hypothetical users and files do not enqueue jobs or access real reports.
Expected result: The fixture supports these stated synthetic lifecycle paths and storage check.
Why this result follows: Evidence remains limited to the stages and paths actually checked.
Common errors and fixes
Checking access only when the job is requested
- Why it happens
- The user’s permissions can change before result retrieval.
- How to fix it
- Apply the agreed authorization policy at retrieval.
- Prevent it next time
- Test a role change while work is queued.
Assuming worker permission grants user access
- Why it happens
- Technical execution authority is confused with user authorization.
- How to fix it
- Scope result retrieval to the current authorized principal.
- Prevent it next time
- Document worker and user authority separately.
Checking only a denial message
- Why it happens
- A side effect or stored copy may still exist.
- How to fix it
- Inspect the relevant state and cleanup behavior.
- Prevent it next time
- Include side-effect checks in negative cases.
20 practice exercises
1. A user submits an export while authorized, then loses access before download. What should the test check?
Show hint
The stated lab policy checks current access at download.
Show worked solution
Under the stated lab policy the download is denied; verify the current access decision and whether a protected file remains, without assuming all products share that policy.
Under this fictional policy, deny the download when the requester loses access after submission. Verify the current decision and inspect whether a protected file remains, its storage and retention. Do not assume that every product implements the same revocation semantics.
Check your solution
- The current download decision is denied.
- Protected-file storage and retention are inspected.
2. The worker can read all reports. Does that allow the requester to download another user’s report?
Show hint
Worker processing authority does not become requester permission.
Show worked solution
No. Worker authority is distinct from requester authorization. Test a different synthetic user and the protected result boundary.
A worker’s broad ability to read reports does not authorize a different requester to download another user’s result. Test an unrelated synthetic user at the protected result endpoint, verify denial and no private-data leakage, and retain the legitimate owner path as a positive control.
Check your solution
- The unrelated requester is denied.
- Worker access and requester authorization remain separate.
3. A user submits an export while authorized, then loses access before download. The lab policy requires current access. What should be checked?
Show hint
Submission and download are different moments.
Show worked solution
Deny the download under the stated policy, verify the current access decision and inspect whether a protected output remains under the retention rule. Do not assume every product uses the same revocation semantics.
Check your solution
- Access is revoked before download
- The protected file state is inspected
4. A worker can read all reports, but requester B asks for requester A’s result. Does worker authority allow the download?
Show hint
Separate the two identities.
Show worked solution
No. The service must authorize B for A’s protected result independently of the worker’s technical scope. Test denial and no private-data leakage with synthetic users, and retain A’s legitimate download as a positive control.
Check your solution
- Worker read access is broader
- B lacks authorization for A’s result
5. A requester was authorized at submission but revoked before execution; policy requires recheck before the worker reads. What follows?
Show hint
Apply the declared stage rule.
Show worked solution
Do not read the protected data for that job under the stated policy. Record the revocation, job decision and output state, then test any required cleanup without changing real accounts.
Check your solution
- Access is revoked before execution
- Worker read does not proceed under policy
6. A download endpoint returns denied, but a public storage URL still serves the result. Has the boundary held?
Show hint
Inspect every delivery path.
Show worked solution
No. The endpoint denial does not protect the public copy. Restrict storage through the authorized process and verify both the endpoint and direct delivery path with synthetic files and unrelated users.
Check your solution
- The endpoint denies
- The public copy remains accessible
7. An unrelated user guesses a job identifier and requests its result. What should be checked?
Show hint
A reference is not permission.
Show worked solution
The server should evaluate the trusted requester and result owner under policy, deny unrelated access and avoid disclosing private data. A guessed identifier must not itself grant the download.
Check your solution
- The identifier belongs to another user
- The result is not disclosed
8. A submission request times out and no later job-state read exists. Can the client claim no job was created?
Show hint
A timeout leaves an unknown outcome.
Show worked solution
No. Preserve the request identity and use an approved safe read to determine whether the job exists before retrying. Avoid creating duplicate work based solely on the missing response.
Check your solution
- The request timed out
- Job creation remains unknown
9. A job receives two duplicate queue messages and creates two outputs, while policy permits one per job. What failed?
Show hint
Count side effects independently.
Show worked solution
The one-output invariant failed even if each message was processed successfully. Investigate idempotency and cleanup, preserve both output identities, and verify that unrelated users cannot access either protected copy.
Check your solution
- Two outputs exist
- Policy permits one output
10. A user is revoked at 10:00 but a cached allow remains until 10:10; policy requires immediate recheck. A request arrives at 10:05. What follows?
Show hint
Compare policy timing with cache state.
Show worked solution
Deny under the stated current-access policy because the request occurs after revocation. Repair or refresh the stale cache through the authorized process and verify the protected result is not available through alternate paths.
Check your solution
- Revocation precedes the request
- The cached allow conflicts with policy
11. A protected download request has no authenticated subject, while policy requires an authenticated owner. What should the service do?
Show hint
Possession of a link is not identity.
Show worked solution
Require authentication or deny according to the stated policy and do not return the file. After authentication, evaluate the trusted subject’s current permission for the specific result rather than accepting a client-supplied owner field.
Check your solution
- The subject is missing
- The protected file is not returned
12. An output link expires at 10:00 and is requested at 10:01; policy rejects expired links. What follows?
Show hint
Compare the request with the time boundary.
Show worked solution
Reject the expired link under the stated policy and require the approved access flow. Record the result identity and request time without logging a live token, and verify that an alternate delivery path does not bypass the rule.
Check your solution
- The request occurs after expiry
- The expired link is rejected
13. A worker needs read access to dataset A but has administrator access to all resources. What should be reviewed?
Show hint
Worker authority still needs a purpose.
Show worked solution
Review and narrow the worker’s effective permissions through the authorized process to the actions and resources required. Assign an owner and test the permitted read and denied unrelated action with synthetic data.
Check your solution
- The task needs only dataset A
- Administrator scope exceeds the need
14. A download is denied to an unrelated user, but a notification contains private report data. Has the result boundary held?
Show hint
Check every output channel.
Show worked solution
No. The notification discloses protected content despite the denied endpoint. Preserve a sanitized record, repair the notification boundary and verify both channels with synthetic users and files.
Check your solution
- The endpoint denies
- The notification leaks private content
15. A worker fails before writing output and the job is marked failed. What else should the test observe?
Show hint
Failure and output state are separate.
Show worked solution
Verify that no accessible protected output was left and that the failure is reported without private data or credentials. Record any temporary files and cleanup result under the stated retention policy.
Check your solution
- The job is marked failed
- Output and cleanup state are checked
16. A current-access policy denies a revoked requester, but a cached copy is served without a new check. What failed?
Show hint
Delivery paths need the same declared policy.
Show worked solution
The cached path bypasses the required current-access decision. Restrict or invalidate the copy through the authorized design and verify both the normal endpoint and cache after revocation using synthetic files.
Check your solution
- The requester is revoked
- The cache still serves the file
17. A passing lifecycle test uses policy V1 that checks only submission, but release requires V2 current access at download. Is the result sufficient?
Show hint
Match the policy obligation.
Show worked solution
No. V1 does not exercise V2’s later decision boundary. Update and review the test for V2, then verify revoked and allowed download cases against the exact candidate with protected-file checks.
Check your solution
- The test uses V1
- V2 requires a download-time check
18. An output remains private for seven days after a denied download under the stated retention policy. Does denial prove deletion?
Show hint
Access and retention are separate.
Show worked solution
No. The file is retained privately in this scenario, so denial does not mean it was deleted. Record the owner and expiry, verify that unrelated users cannot access it and check cleanup at the policy boundary.
Check your solution
- The download is denied
- The private file remains until retention expires
19. A requester was authorized at submission; policy allows processing but rechecks current access at download. Access is revoked after processing. What follows?
Show hint
Apply the declared stage policy.
Show worked solution
The job may complete under this fictional policy, but the later download must be denied. Inspect the protected output’s storage and retention separately, and do not assume another product uses identical semantics.
Check your solution
- Processing completed under policy
- Current access is absent at download
20. A synthetic matrix checks owner allowed, unrelated denied and revoked denied, including private storage. What does a pass establish?
Show hint
Name the tested lifecycle scope.
Show worked solution
It supports the observed decisions and storage check for those synthetic subjects, stages and policy. It does not prove every worker, cache, notification or future configuration is safe; document untested delivery paths.
Check your solution
- Three stated subject paths are covered
- Untested channels remain outside scope
Key takeaways
- Authority can change between job submission and result retrieval.
- Test denied paths and stored side effects through the full lifecycle.
- A submission decision does not automatically grant permanent result access.
- Worker authority is distinct from requester authorization.
- A denied download does not prove every stored or cached copy is protected or deleted.