Lesson map
Lesson 10 published. Map, example, EX037.
flowchart TD
N0["Learning outcomes and connection"]
N1["10.1 Specify a control contract before a command"]
N2["10.2 Offline before/after/rollback simulation"]
N3["10.3 Security effectiveness and business acceptance"]
N4["Subject synthesis"]
N0 --> N1 --> N2 --> N3 --> N4
N4 --> EX["Worked example"]
EX --> Q["Exercise EX037"]
Logical drawing
flowchart LR
N0["Learning outcomes and connection"]
N1["10.1 Specify a control contract before a command"]
N2["10.2 Offline before/after/rollback simulation"]
N3["10.3 Security effectiveness and business acceptance"]
N4["Subject synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> Q["EX037"]
[Learning outcomes and connection]
|
v
[10.1 Specify a control contract before a command]
|
v
[10.2 Offline before/after/rollback simulation]
|
v
[10.3 Security effectiveness and business acceptance]
|
v
[Subject synthesis]
|
v
[Worked example] --> [Exercise EX037]
Learning outcomes and connection
The learner will define a temporary rule's exact subject, action and expiration, simulate its security effect, test a legitimate workflow and rollback, and document evidence needed before any real change. Chapter 9 established an incomplete record: K-G1 traffic and K-A1 queue acceptance do not prove a commit, actor or compromise. Chapter 10 therefore uses a separate K10 sandbox proposal, not a response order for the K9 packet. Chapter 11 will verify clocks and record integrity before stronger temporal claims. NIST SP 800-61 Rev. 3 frames response choices within risk management; the rule, test accounts and expected results here are original teaching artifacts.
10.1 Specify a control contract before a command
The fictional sandbox holds four requests. S10-1 uses session sess-K9 for a write to R42 and is labeled suspect for the exercise, not proven malicious. S10-2 is the authorized worker's sess-W1 write to R40. S10-3 is a patron read of room availability under sess-P1. S10-4 is a read by sess-K9. All four use an invented shared service architecture; their principal labels are not human identities. The response question is whether a rule can stop S10-1 without stopping S10-2 or S10-3. A session-specific write deny is a narrower candidate than revoking the entire svc-book principal. It also has a limitation: it does not stop sess-K9 reading or using a different session.
A control contract states: trigger evidence (source-linked harmful write, scope and continuing risk); decision authority (incident lead, identity/application owner and service owner as applicable); target (one session ID plus write route, after namespace validation); lifetime (short expiry and review time); operator; expected security effect; expected service effect; baseline; positive and negative tests; rollback; and reopen condition. A rule identifier and change-log version make an action inspectable. If the service uses independent worker paths, the negative test must include them. A green read-only page does not prove that writes still work. If session IDs can be refreshed or aliased, an identity custodian must validate the scope before the rule is proposed.
In the AUTH-K10 classroom card, the trainee may run the pure Python simulation below and draft a change ticket. Approval to change a real identity service, gateway, API or host is pending. A proposed denial can preserve evidence less well than a read-only observation if it terminates a session or rotates logs, so the incident lead should consider capture needs and time pressure. Conversely, delaying a verified harmful action has a cost. The contract makes that tradeoff visible rather than hiding it inside a command.
10.2 Offline before/after/rollback simulation
The listing models only route admission. It has no network access, no credentials and no database. The baseline allows all four requests; the scoped rule rejects just one session on the write route; rollback restores the baseline. The word “allowed” below means this function's Boolean, not that an HTTP request completed, a reservation was committed or a real policy engine behaved the same way.
requests = [
("S10-1", "sess-K9", "write"),
("S10-2", "sess-W1", "write"),
("S10-3", "sess-P1", "read"),
("S10-4", "sess-K9", "read"),
]
def admitted(session, route, mode):
return not (mode == "scoped" and session == "sess-K9" and route == "write")
for mode in ("baseline", "scoped", "rolled_back"):
active = "baseline" if mode == "rolled_back" else mode
results = [f"{label}={admitted(session, route, active)}"
for label, session, route in requests]
print(mode + ": " + " ".join(results))
The expected transcript has S10-1 false only under scoped; S10-2, S10-3 and S10-4 remain true. The rollback line matches baseline exactly. That is a unit test of a toy predicate. It does not establish that the gateway enforces the same route, that all client routes are enumerated, or that a token cannot change. A stronger isolated integration test would present known positive and negative transactions at every relevant route, capture the actual policy version and decision logs, and compare authoritative application/database outcomes. Production testing requires separate authority and safety constraints.
10.3 Security effectiveness and business acceptance
A useful test matrix has four columns: target route, expected policy decision, observed application result and owner-approved business result. For S10-1, the desired policy decision is deny; the system should show an unambiguous denial on the intended route and no subsequent R42 write in a bounded authoritative data check. For S10-2, the worker write should still complete and reconcile correctly. For S10-3, the patron should still read valid availability. For S10-4, the read remains allowed under this particular rule; that limitation must be documented, not concealed. If the harmful activity can move to another session, the plan needs broader detection and another decision, not an unsupported declaration of containment.
Compare an alternative: revoking the shared svc-book principal. In the simplified dependency graph from Chapter 1, that may stop both the suspect task and the approved worker. The wider control might still be warranted under stronger evidence and risk, but the service owner must understand the cost. A temporary gateway rule might affect only one path while the worker uses a different route; conversely a route-level rule could miss direct API access. Scope is a property of the actual enforcement points and observed tests, not of a label such as “targeted.”
The ticket should retain a pre-change baseline, who approved the exact version, when it was activated, its expiration, the operator and policy artifact digest, the test receipts and a rollback owner. A rollback is not complete because someone removed a rule: rerun the legitimate R40 write and patron read, check for queued retry effects, and retain the before/after state. If the rule never takes effect, the incident lead should reopen the hypothesis rather than claim success. If it blocks a legitimate workflow, the owner may need to roll back or replace it under the agreed emergency criteria. Chapter 6's route model helps predict which negative tests matter; Chapter 9's provenance rules say which observations can support the decision.
Common errors and limits
- Issuing a real change because the workshop labels one session “suspect.”
- Calling a Boolean unit test proof of production containment or a successful database write.
- Testing only the targeted route and ignoring dependent worker and patron paths.
- Treating rollback as deleting the policy while leaving queued/retry effects unmeasured.
- Failing to set expiry, owner, policy version or a source-linked re-open condition.
Exercises — subject 10
EX037 — Control contract. Objective: make an action reviewable. Draft the eleven contract fields in §10.1 for the K10 rule. Explicitly leave real approval pending and distinguish S10-1 from K9 observations. Evidence: versioned change ticket. Rubric: 2 = scope, authority, expiry, baseline, tests and rollback with a concrete trigger; 1 = target and test but no owner/expiry; 0 = authorizes a real change from AUTH-K10.
EX038 — Simulation and counterfactual. Objective: test the predicate. Run §10.2 and record all three exact output lines. In a copy, change S10-4 from read to write and predict its scoped result without changing the original transcript. Explain what a policy-engine integration test would still need. Evidence: two transcripts and limit statement. Rubric: 2 = exact booleans and variant separation; 1 = correct original only; 0 = describes the toy result as deployment evidence.
EX039 — Positive/negative acceptance matrix. Objective: compare security effect with service risk. Build four rows for S10-1–S10-4 naming expected decision, authoritative outcome to check, custodian and failure interpretation. Add the approved worker's retry/queue state after rollback. Evidence: matrix. Rubric: 2 = R42 stop and R40/patron continuity plus route limitation; 1 = denial only; 0 = equates HTTP status with database correctness.
EX040 — Broad-control review. Objective: critique an alternative. A peer proposes revoking svc-book for all routes and declares the incident over because the portal still loads. Use Chapter 1's graph and K10's tests to explain at least three untested effects, one condition under which broader control might be justified, and a safer next decision. Evidence: decision note. Rubric: 2 = graph, route coverage and owner-led tradeoff; 1 = generic “too broad”; 0 = accepts static portal load as full recovery.
Subject synthesis
An isolated predicate can make a control's intended scope explicit, but only a source-linked trigger, authorized deployment and service-aware tests can support a real response decision. K10 leaves all real approvals and executions pending. Chapter 11 will examine whether cross-source times and retained bytes could reliably order the claims that would feed such a decision.