Course contents 16 / 16

16 / 16 · Reliability

Incidents and operational security

What to do when production breaks and how to keep the operation itself safe: incident roles, severity and a timeline, blameless postmortems, eliminating toil, secrets kept out of Git, least privilege, SBOMs, signing and SLSA, patching, and chaos engineering.

On this page 13

A learner presses Save and sees a failure. The answer is still in the browser, but the service cannot persist it. A permission change reached the writer processes a few minutes ago. Restarting every process might restore access, or turn a partial failure into a complete one. We need a controlled way to recover, count the impact, and decide which safeguards to change.

We will use a fictional answer-saving service. Its incident log, request counters, follow-up costs and release-policy inputs were independently specified for this example. The standard-library verification script generates the figure data and saved results. It also runs a local Git demonstration in a disposable directory. No real credentials, deployment, customer records or external incident dataset are involved.

Baseline: everyone jumps in#

Suppose one responder changes the writer identity while another restarts the workers. Both operations can affect the same symptom. If failures stop, their overlapping changes leave us unable to tell which intervention mattered. If failures increase, neither knows which state to restore. The first useful improvement is to serialize changes and record the evidence behind them.

For our service, we freeze the rollout, assign one owner for production changes, and keep a short event log. An observation such as “writes fail, reads succeed” differs from a hypothesis such as “the new identity lacks insert permission.” The distinction matters because a plausible hypothesis can still be wrong. Each intervention needs an expected observation and a way to reverse it.

A response procedure must remain usable when the primary system is unavailable. Store the contact route and recovery instructions somewhere that does not require the broken service to log in. Rehearse access before an incident; an unreadable runbook offers no operational help.

Incident response: roles and severity#

An incident needs coordination when its impact or uncertainty exceeds what one routine task can handle. The separation of incident coordination, operational changes and communication is described in Google’s Managing Incidents. Here we apply that general idea to a small service, with responsibilities sized to the available team.

The coordinator maintains the current objective, approves the next intervention and checks whether the response needs more help. A responder changes the system and records the result. Someone keeps support informed, including when the next update will arrive. One person may initially hold several responsibilities; a handover must say which responsibility transfers and what remains unresolved.

Our fictional service distinguishes an interrupted save from a confirmed loss of stored answers. Both deserve attention, but data loss or suspected unauthorized access requires a different investigation. We record the affected operation, scope, available workaround and uncertainty before choosing the response level. A severity name alone does not communicate those facts.

The team chooses its own escalation criteria in advance. For this example, repeated failure of the end-to-end save probe calls the on-call responder; confirmed failures across writer groups require coordinated recovery. Evidence of credential misuse brings in the security owner immediately. These are illustrative service decisions, not a universal severity table or a recommendation derived from one budget percentage.

A timeline#

At 09:30, a configuration rollout removes a required write permission. Some processes keep an earlier authorization state. We define the cause as part of the fixture; a real investigation would have to establish it from configuration history, access decisions and reproduction.

Figure

Restoring answer saves

  1. Permission change reaches the writer service.
  2. The synthetic save probe alerts.
  3. On-call acknowledges and coordinates the response.
  4. Rollout stops; partial rollback reduces failures.
  5. Support receives the first impact update.
  6. Remaining workers begin refreshing their authorization state.
  7. All writers recover; verification begins.
  8. Incident closes after seven healthy minute buckets.
Fictional log. Rows show event order, not equal time intervals. Recovery takes 11 minutes, followed by 7 minutes of verification. Request failures are counted separately from this timeline.

The alert at 09:32 is an observed input to this fictional log. We do not infer it from a burn-rate threshold. At 09:34, stopping the rollout and restoring part of the configuration reduces errors. Updating the remaining workers takes longer because their authorization state refreshes separately. At 09:41, all groups are healthy. The coordinator closes the incident at 09:48 after checking seven complete one-minute buckets.

Detection took 2 minutes from onset; acknowledgement took another minute. Mitigation took 11 minutes from onset, and verification took 7 minutes after mitigation. Naming both endpoints avoids calling several different intervals “recovery time.” Closure also does not mean every follow-up has been implemented.

For request impact, the generator specifies three intervals:

  • Minutes 0–3: 200 eligible save attempts and 50 failures per minute.
  • Minutes 4–10: 400 attempts and 20 failures per minute.
  • Minutes 11–17: 300 attempts and no failures per minute.

The boundaries refer to complete minute buckets. Thus the 18-minute observation contains

N=4⋅200+7⋅400+7⋅300=5700,B=4⋅50+7⋅20=340.N=4\cdot200+7\cdot400+7\cdot300=5700,\qquad B=4\cdot50+7\cdot20=340.

The affected 11-minute interval contains 3600 attempts. There are 340 failed attempts, not necessarily 340 different learners or 340 lost answers: retries can refer to the same answer, and persistence needs its own audit. We must not infer unique-user impact from a request counter.

For a separate, fully specified 14-day accounting period, assume 500000 eligible attempts and these 340 failures as its only bad events. At a 99.5% objective, the budget is 500000(1−0.995)=2500500000(1-0.995)=2500 bad attempts. The incident consumes 340/2500=13.6%340/2500=13.6\% of that budget; the period’s success indicator is 1−340/500000=99.932%1-340/500000=99.932\%. Dividing 11 minutes by 14 days would answer a time-based question and would ignore the varying traffic. The SLO discussion explains how to specify the indicator and response policy together.

Blameless postmortems#

An investigation should explain how the failure became possible and what would reduce its impact next time. Google’s Postmortem Culture motivates examining the system without turning the report into personal blame. Our incident needs its own evidence and follow-up design; copying a report template cannot supply either.

We begin with the saved counters and the permission diff. The fixture has two separate weaknesses: the deployment check tested reads but not writes, and rollback did not immediately update every worker’s authorization state. The partial recovery at 09:34 is consistent with the second weakness. In a real system it would be supporting evidence, not proof on its own.

A useful next change has an owner and an observable acceptance condition. For example, the delivery owner adds a canary that writes a disposable answer and reads it back under the actual service identity. The runtime owner documents and tests how authorization refresh behaves during rollback. The support owner checks that an update can be posted when the learning service is down. “Be more careful with permissions” has no comparable completion test.

Keep unsupported explanations visible as open questions. If we have no evidence about whether failed requests were retried successfully, say that and assign the measurement. An empty field is preferable to a plausible number that later gets treated as measured impact.

Toil and eliminating it#

Repeated manual recovery creates a second reliability problem: responders spend their time repeating a workaround. For this example, suppose seven weekly checks each take ten minutes. A proposed automated check requires nine hours to build and ten minutes of weekly maintenance. Its net weekly time saving is

Δt=(7⋅10−10)/60=1 hour,wbreak-even=9/1=9 weeks.\Delta t=(7\cdot10-10)/60=1\text{ hour},\qquad w_{\mathrm{break\text{-}even}}=9/1=9\text{ weeks}.

After 26 weeks the modeled net saving is 26−9=1726-9=17 hours. These are fictional planning inputs, not a productivity benchmark. A change in task frequency, maintenance effort or failure risk changes the decision. Automation also needs a safe failure mode: a check that silently grants broad permissions would reduce clicks while increasing exposure.

Start by measuring the repetitive task and its causes. Some work disappears when the underlying deployment becomes safer. Some should remain a human decision with better evidence. Count the time spent maintaining automation, including false alerts and failed runs, before describing it as a saving.

Operational security#

Our incident came from an accidental permission removal. The recovery restores an intended, limited privilege. A leaked credential is a different case: restoring or re-enabling that credential would leave the exposure in place. Response steps must distinguish lost authorization from unauthorized access.

Map identities to actions: who can read answers, write answers, modify the application, change its permissions, and publish a release? For each action, identify the credential or trust relationship that authorizes it. A service can have excellent uptime metrics while its deployment identity can modify every environment. Reliability monitoring does not establish that those permissions are appropriate.

Secrets never in Git#

A secret should arrive through a controlled delivery mechanism rather than being embedded in source code, images or example configuration. The OWASP guidance treats management as a lifecycle: access, use, rotation and revocation all matter. Keep actual values out of diagnostic logs and test fixtures as well as out of the repository.

Deleting a tracked file changes the current tree; it does not remove the file from earlier commits. The verifier creates a temporary repository containing only DEMO_TOKEN=fictional-not-a-credential, commits the file, deletes it and commits again. It then reads the parent revision with git show HEAD~1:demo.env. The saved result is:

current_file_exists: false
historical_content: DEMO_TOKEN=fictional-not-a-credential

The fake string grants access to nothing. For an actual exposure, revoke or rotate the credential through the owning system and inspect its use. Repository cleanup is a separate containment task; clones, logs and caches may already contain the old value. Adding a filename to .gitignore does not retroactively erase its history.

Kubernetes Secret objects separate values from application manifests, but their name does not imply encryption everywhere. The Kubernetes documentation describes default unencrypted storage in etcd, encryption-at-rest configuration and access controls. Base64 encoding is reversible representation. Also review indirect access: permission to create a Pod can allow mounting Secrets in its namespace. Scope the statement to the actual permissions; being able to read one named Secret does not automatically grant permission to read every other one.

Least privilege#

For the answer-saving service, a writer needs the permitted write operation on its designated records. It does not need to create database users, publish releases or inspect unrelated credentials. A deployment identity may replace the writer version without being able to change billing data. Separate identities make these boundaries reviewable.

Test both allowed and forbidden actions. A canary that succeeds at saving an answer checks necessary access; a test that cannot administer the database checks one important boundary. Neither test proves the entire policy correct. Include resource scope and environment in the test, and examine wildcard rules and inherited roles.

Short-lived credentials reduce the duration of some exposures, but a party that can continually mint new credentials can remain authorized. Review the issuer and its trust policy as well as token expiry. Emergency access should have a defined owner, expiration and audit trail; it must not become the permanent route for ordinary work.

The supply chain: SBOMs, signatures and SLSA#

A release consumes more than application code. Its build tools, dependencies and configuration affect the bytes that reach production. A software bill of materials, or SBOM, records components for a stated artifact and format. Its value depends on completeness and correct association with those bytes; a list alone does not prove the components safe.

A signature binds a statement or artifact to a key or verified identity under a trust system. Verification must check the intended identity and issuer as well as the artifact binding. The Cosign documentation exposes those checks explicitly. A valid signature from an unrelated identity does not authorize our deployment. A signature on an image also does not automatically authenticate every adjacent SBOM file.

Provenance describes the build’s origin and process. SLSA v1.2’s Build track distinguishes available provenance, signed provenance from a hosted platform, and a hardened build platform. Those levels address specified build threats; they do not certify application correctness or eliminate the need to trust the builder. We do not assign a SLSA level to this course exercise.

For our service, define an acceptance policy before seeing a release: the verified subject must identify the exact artifact digest, the source must be the expected repository and release ref, and the builder must be an allowed identity. Store the accepted digest in the deployment record. A mutable tag by itself leaves ambiguity about which bytes were inspected.

Patching and dependency updates#

An update should answer a concrete exposure question. Record which deployed digest contains the affected component, whether the vulnerable behavior is reachable, and what containment is available while a fix is tested. A severity score can help prioritize; it does not replace that mapping.

After rebuilding, regenerate the component inventory for the new artifact and rerun the relevant regression and permission checks. Roll out with observations that can detect both the original vulnerability’s mitigation and application regressions. If rollback restores a vulnerable version, treat that as an explicit tradeoff with compensating controls, an owner and a deadline. “Patched” should refer to deployed bytes, not merely a merged dependency-file change.

Chaos engineering in brief#

For the fictional writer, a useful rehearsal is to remove its write permission in an isolated test environment. The expected result is a failed save probe, a clear access-denied observation and recovery after the correct permission state returns. The exercise tests the whole response path, including how workers refresh their state.

Write the abort condition and restoration procedure before injecting the failure. Do not start by modifying real learner data. A successful rehearsal demonstrates the tested scenario under its assumptions; it cannot establish resilience against every failure combination or a malicious actor. Use the observation to repair the runbook and tests, then repeat the bounded scenario.

What changed#

The initial response mixed interventions and inferred impact from elapsed time. The revised response assigns control of changes, distinguishes observations from hypotheses and counts failed eligible attempts. It also tests a permission rollback rather than assuming a code rollback restores every operational state. The same attention to boundaries connects the incident to credentials, build identities and release artifacts.

Limitations#

The fixture has deterministic counters and a stipulated cause. It does not model delayed telemetry, missing logs, retries, clock disagreement or adversarial behavior. The 500000-attempt period is specified separately; it is not extrapolated from eighteen minutes of traffic. No real cluster, signing service or deployment pipeline ran as part of this exercise.

An incident review can improve the next response while still leaving uncertainty. Preserve that uncertainty in the record. Avoid treating one successful rollback, one clean vulnerability scan or one valid signature as proof that the whole operation is safe.

What you should remember#

An incident needs a shared objective, controlled changes and evidence. Count impact in the indicator’s units; name the endpoints of response durations. Recovery, investigation and completing follow-ups are separate milestones. Permissions and artifact identities must be checked at the boundary where they authorize an action.

Example#

The companion script runs six policy-only cases after a hypothetical trusted cryptographic verifier. Its input represents a verified receipt; an untrusted JSON file is not such a receipt. The script does not implement signatures, certificates, transparency-log verification or a production admission controller.

The accepted fixture has matching artifact bytes, repository, release ref and builder. Mutating each field isolates its decision boundary:

expected: accept
changed_bytes: reject digest
wrong_repository: reject repository
wrong_ref: reject ref
wrong_builder: reject builder
missing_receipt: missing verified receipt

This demonstrates why “some signature verified” is an incomplete release policy. A real integration must obtain these facts from a trusted verifier, enforce the policy before deployment and fail closed when evidence is missing. Run the original local exercises from a repository checkout with python3 scripts/notes/incident-renewal.py; Python’s standard library and Git are sufficient. The saved JSON contains the incident buckets, event log, arithmetic, fake-secret demonstration and these six results.

The course in one paragraph#

A change becomes operable when we can build known bytes, deploy them with bounded impact, observe the relevant user operation and recover without losing control of the system. The previous resilience discussion addresses failure containment. The incident and security practices here complete that route by making recovery evidence, access boundaries and follow-up work explicit. For model-specific releases and monitoring, continue with MLOps.

References#