Page 7 of 8~112 min topic

Feature flags lab

Constrain access and rehearse rollback

Least privilege, negative probes, and a timed rollback beat a security essay about FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5%.

~14 min this pageSecurity and rollback

1Try it yourself

Decision drill

Feature flag lab

Flags control who sees what — without redeploying code.

Release control72%

1/3New RAG index for 5% of traffic.

2Learn the idea

Read

Least privilege for this lab

Separate runtime and operator roles for FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5%. Runtime may only perform the narrow actions that release captain flipping rag_index_v2 for cohort canary needs; operators get audited break-glass with TTL. Encode a negative probe that denies the privilege trick related to browser-exposed flag lets attackers force v2 (unreviewed) index.

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 FLAG-CLIENT-TRUST-4 should be impossible if these controls hold. Output allowlists and schema checks stay in force on error paths.

Read

Implementation artifact

roles:
  flag_writer: { allow: ["flag.write"], require_reason: true }
  runtime: { allow: ["flag.read"] }

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: flag writes require RBAC; client-supplied flag values never authorize access.

Read

Stage depth

Abuse cases unique to this lab include the privilege path implied by browser-exposed flag lets attackers force v2 (unreviewed) index. 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 FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5% 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 `feature-flags-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 FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5%, the human stakeholder is release captain flipping rag_index_v2 for cohort canary, and the incident id you design against is FLAG-CLIENT-TRUST-4. Re-state the oracle in your notes — 5% cohort sees index_v2 citations; kill switch returns everyone to v1 in < 60s — and keep the invariant visible: flag writes require RBAC; client-supplied flag values never authorize access. Track flag_exposure_pct and citation_delta_v2_vs_v1 as the scoreboard. Surface under change control: POST /v1/rag/answer. If you only have forty minutes, finish the fixture for browser-exposed flag lets attackers force v2 (unreviewed) index 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 FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5% 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 FLAG-CLIENT-TRUST-4 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.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Does deny imply zero side effects?
2. Are secrets absent from logs?
3. Is rollback evidenced with timestamps?

All responses are required.