Batch API lab
Cover security and operational gates
Least privilege, negative probes, and a timed rollback beat a security essay about overnight batch job that grades 50k support transcripts via provider Batch API.
1Learn the idea
Read
Least privilege for this lab
Separate runtime and operator roles for overnight batch job that grades 50k support transcripts via provider Batch API. Runtime may only perform the narrow actions that QA lead who needs cost-capped offline eval by 07:00 UTC needs; operators get audited break-glass with TTL. Encode a negative probe that denies the privilege trick related to duplicate custom_id causes silent overwrite of the better grade.
Read
Data and secret hygiene
Redact prompts/PII at collection. Secrets enter via a manager or workload identity — never source, fixtures, or exception strings. Incident BATCH-DUP-8841 should be impossible if these controls hold. Output allowlists and schema checks stay in force on error paths.
Read
Implementation artifact
Read
Never put PII in custom_id; hash ticket ids before upload.
custom_id = "t_" + hashlib.sha256(ticket_id.encode()).hexdigest()[:16] assert "ssn" not in json.dumps(body).lower()
Read
Rollback drill
Rehearse the rollback or kill switch timed against a clock. Record actor, reason, prior revision/secret/flag, and verification query. Invariant reminder: each input line has a stable custom_id; failed lines never poison the whole file.
Read
Stage depth
Abuse cases unique to this lab include the privilege path implied by duplicate custom_id causes silent overwrite of the better grade. Prove a read-only role cannot mutate. Break-glass tokens expire; leftover tokens fail the drill. Dependency pin/digest story matters when images or models move under you. Document how to rotate the credential that overnight batch job that grades 50k support transcripts via provider Batch API uses without a full outage window longer than your dual-run plan. Security evidence is part of ship, not an appendix nobody reads.
Read
Field notes for `batch-api-lab` / `security-ops`
List network egress destinations and justify each. Ensure debug endpoints are off by default in the shipping config. Verify that error responses do not echo secrets or raw stack frames to clients. For multi-tenant paths, add a cross-tenant probe fixture. Time the rollback drill twice — once with the author, once with a peer. Store the drill transcript beside the threat notes for the incident id. In this chapter the product is overnight batch job that grades 50k support transcripts via provider Batch API, the human stakeholder is QA lead who needs cost-capped offline eval by 07:00 UTC, and the incident id you design against is BATCH-DUP-8841. Re-state the oracle in your notes — fixture of 20 lines yields 18 succeeded + 2 failed with error objects; cost ≤ $0.40 — and keep the invariant visible: each input line has a stable custom_id; failed lines never poison the whole file. Track batch_line_success_ratio ≥ 0.90 and dollars_per_1k_lines ≤ 8 as the scoreboard. Surface under change control: POST /v1/batches. If you only have forty minutes, finish the fixture for duplicate custom_id causes silent overwrite of the better grade before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.
Go deeper
Before you start
Why this matters
Threat-model overnight batch job that grades 50k support transcripts via provider Batch API in five minutes: who can change config, who can read secrets, what a malicious payload tries to do. Write one negative probe that must yield deny with zero side effects. Reference BATCH-DUP-8841 as the story you refuse to repeat.
In the wild
See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.