Blue-green deploy lab
Constrain access and rehearse rollback
Least privilege, negative probes, and a timed rollback beat a security essay about RAG API with complete green/v1 and blue/v2 stacks behind one router.
1Try it yourself
Decision drill
Blue-green deploy desk
Two full environments — swap traffic atomically, revert fast if metrics break.
1/3v2 passes smoke on the idle (blue) environment. Green still serves 100%.
2Learn the idea
Read
Least privilege for this lab
Separate runtime and operator roles for RAG API with complete green/v1 and blue/v2 stacks behind one router. Runtime may only perform the narrow actions that release engineer flipping 100% router cut after green smoke needs; operators get audited break-glass with TTL. Encode a negative probe that denies the privilege trick related to schema migration applied only on blue — green rollback serves 500s.
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 BG-SCHEMA-ONESIDE-11 should be impossible if these controls hold. Output allowlists and schema checks stay in force on error paths.
Read
Implementation artifact
Read
router admin API mutual-TLS; cut requires dual approval in change ticket CHG-4412
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: blue must pass smoke + /readyz before cut; old green kept warm for 30m rollback.
Read
Stage depth
Abuse cases unique to this lab include the privilege path implied by schema migration applied only on blue — green rollback serves 500s. 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 RAG API with complete green/v1 and blue/v2 stacks behind one router 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 `blue-green-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 RAG API with complete green/v1 and blue/v2 stacks behind one router, the human stakeholder is release engineer flipping 100% router cut after green smoke, and the incident id you design against is BG-SCHEMA-ONESIDE-11. Re-state the oracle in your notes — cutover < 30s; rollback restores green with zero dual-write divergence — and keep the invariant visible: blue must pass smoke + /readyz before cut; old green kept warm for 30m rollback. Track cutover_seconds and postcut_error_rate as the scoreboard. Surface under change control: router → green|blue /v1/rag/answer. If you only have forty minutes, finish the fixture for schema migration applied only on blue — green rollback serves 500s 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 RAG API with complete green/v1 and blue/v2 stacks behind one router 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 BG-SCHEMA-ONESIDE-11 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.