Unit 3 of 15 · about 4 hours · explain, implement
Encryption in transit and at rest, secret and key rotation and audit integrity
Keys leak and certificates expire. Rotation and audit bounds decide whether that event is a routine overlap or an outage with unbounded telemetry.
You'll be able to
- Wrap data keys with key-encrypting keys and compute the blast radius of any compromised key.
- Rotate credentials through a dual-accept overlap without dropping long-lived connections.
- Bound metric cardinality and keep audit events tamper-evident against an independently retained checkpoint.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Secrets: envelope encryption, dynamic secrets, rotationHLD Handbook - Reliability, Operations and Security at Scale
Where secrets should not live; Envelope encryption and KMS; Dynamic secrets; Leak detection and response
Skip Secrets in Kubernetes unless your dossier runs there.
- Certificate lifecycle: rotation and revocationHLD Handbook - Reliability, Operations and Security at Scale
Certificate lifecycle: issuance, rotation, revocation
Read only this section here. The handshake and SPIFFE sections belong to the first unit.
- Revocation and key rotation at scaleGoogle SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and Recovery
Use an Explicit Revocation Mechanism (Failing open; Revoking credentials at scale); Rotating signing keys
Read for the revoke-versus-expire trade-off. Skip firmware rollback constraints.
- Audit logs that answer questionsGoogle SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and Recovery
Best Practices: Auditing, with Collecting good audit logs and Choosing an auditor
Focus on
- Compromising a wrapping key exposes its descendants when the attacker also holds the wrapped keys and ciphertext. A plaintext data key can also leak on its own, for example from application memory, without exposing its ancestors or siblings.
- Rotation is overlap, not replacement: introduce the new version, accept both, move new connections first, retire the old only after migration.
- Revocation is explicit or it is absent. Expiration bounds lifetime; only a deny list or a rotated key stops a live credential now.
- Cardinality multiplies. With one series per label combination and every combination present, independent labels with cardinalities 5, 3 and 100 create 1,500 series; in a real audit, count the observed combinations and any per-type series expansion.
Common mistakes · 3
- Retiring the old credential at introduction time. Long-lived clients holding it fail until they reconnect; the overlap exists for them.
- Reading fail-open as resilient. The revocation section has nodes enforce their cached revocation list, their last known state, instead of allowing everything when the revocation service is unreachable.
- Counting label values instead of their product. Three small labels easily exceed a series budget together.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Key 1 wraps keys 3 and 4, and records 0 and 1 use those keys. Key 1 is compromised. Which records are exposed?Answer
Records 0 and 1. The compromised key exposes itself and its descendants; ancestors, siblings and separate trees stay safe.
2.Root key 0 of a single key tree is compromised. How many of the tree's five records are exposed?Answer
All five. The root unwraps every descendant key.
3.
beginRotationfails while a rotation is already active. What state changed?AnswerNone. Failed operations change nothing: the pending version stays pending and acceptance is unchanged.
4.Labels with cardinalities 5, 3 and 100 must fit 15 series. Which label goes first?Answer
The 100-cardinality label. Removing it leaves series. Drop larger factors first.
Practice
- AlgoMaster: Analyze Encryption-Key Blast Radius
affectedRecordsreturns exposed record indexes in ascending input order; the page tests self-plus-descendant scopeThe exercise analyzes key scope only. State where your design holds the wrapped keys and ciphertext it assumes.
- AlgoMaster: Rotate Credentials Without Downtime
beginRotation,versionForNewConnections,accepts,completeRotation; the page tests that failed operations change no state - AlgoMaster: Control Metric Label Cardinality
seriesCountis the raw product;labelsToDropremoves the fewest labels, larger factors first, names returned alphabeticallyCounting series does not bound audit volume or prove integrity. The section mini-project covers this: redact audit events, persist them in a tamper-evident chain with an independently retained checkpoint, and test record edits, deletion, truncation and restore against that checkpoint.
You're done when
You derive a subtree exposure by hand, your rotation passes the failed-operation cases, a 5 by 3 by 100 label set fits its budget by dropping the right label, and your audit verifier rejects edited and truncated histories against the retained checkpoint.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 15 more in the section
- HLD Handbook - Reliability, Operations and Security at ScaleHLD Handbook · primary
Read Part 6 observability, SLOs, resilience, overload, deployments, chaos, incidents and health, then Part 7 authentication, mTLS, secrets, tenancy and data governance chapters relevant to the capstone. Skip unrelated case studies.
- Google SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and RecoveryGoogle · required
Read SRE Chapter 4 (service level objectives), 6 (monitoring distributed systems), 21 (handling overload), 22 (addressing cascading failures), 14 (managing incidents) and 15 (postmortem culture); Workbook Chapter 2 (implementing SLOs) and 5 (alerting on SLOs); and Building Secure and Reliable Systems Chapter 5 (least privilege) and 9 (design for recovery). Convert each into one alert, limit, load test or runbook action in the capstone.
Also in this section
- DDIA 2e - Chapters 2, 5 and 14Martin Kleppmann and Chris Riccomini · support
Use Chapter 2 "Describing Performance" for percentile and response-time vocabulary and Chapter 5 for compatibility during rolling upgrades. Chapter 14 is about predictive analytics, privacy and data governance, not operations: read its "Privacy and Tracking" section for the retention and deletion units.
- Metastable Failures in Distributed Systems (Bronson et al., 2021)HotOS · support
Read the trigger and sustaining-effect model of metastable failure and the retry and shedding design prompts. Its model illustrates; it does not predict.
- Metastable Failures in the Wild (Huang et al., 2022)USENIX OSDI · support
Read the incident study for how retries and load sustain outages after the trigger ends; it is a sample of public reports, not a rate.
- Simple Testing Can Prevent Most Critical Failures (Yuan et al., 2014)USENIX OSDI · support
Read the findings on error-handling code and how few nodes and events reproduce most failures, as the case for testing error paths in your campaign. Its bounds come from one sample of 2014 systems.
- Gray Failure: The Achilles' Heel of Cloud-Scale Systems (Huang et al., 2017)Microsoft Research · support
Read the gray-failure model (differential observability between a detector and its clients) as vocabulary for telemetry and failure detection.
- The Internals of PostgreSQL - Base Backup and Point-in-Time RecoveryHironobu Suzuki · support
Read Chapter 10 (base backup, how PITR replays WAL, timelines and incremental backup) as the real-engine model for backup integrity, recovery points and restore verification. Note the date you read it.
- Building Distributed Systems - The Tracer, The Securitor and The MigratorBuild Distributed Systems · optional
Only the first three tasks of each track are free: in The Tracer, trace-context propagation, span lifecycle and a collector; in The Securitor, JWTs, the OAuth 2 code flow with PKCE and sessions; in The Migrator, schema migrations, expand and contract, and zero-downtime change. Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- SPIFFE Workload Identity and Workload APISPIFFE Project · support
Read the SPIFFE ID, X.509-SVID and trust bundle specifications and the Workload API (
FetchX509SVID,FetchX509Bundles) to design service identity, short-lived credentials and bundle rotation. A local mock is sufficient unless a real SPIRE deployment answers a specific gap. - OpenTelemetry Signals and Semantic ConventionsOpenTelemetry · support
Read signals and context propagation (W3C Trace Context
traceparent, inject and extract, baggage rules), then the semantic conventions (1.44.0) for the RPC and messaging areas with their stability status. Define bounded attributes for request, node, partition, term and offset identities, and never infer global order from display timestamps. - Replicated Log and Stream Processor - Production ContractRoadmap-Final · support
Add workload identity, tenant checks, audit, SLOs, capacity limits, backup and verified restore, mixed-version migration, rollback and reduced point-in-time ML data paths. Run one compound incident from detection through recovery.
- OWASP Threat Modeling Cheat SheetOWASP · reference
Use System Modeling (data-flow diagrams, trust boundaries, stores and processes), Threat Identification (the STRIDE table applied to components, data flows and trust boundaries) and Response and Mitigations to build the unit threat model.
- Feast Documentation - Point-in-Time Joins and Feature RetrievalFeast · support
Read Point-in-time joins (entity dataframes,
get_historical_features, TTL backward scan,filter_by_created_timestamp) and Feature retrieval (event_timestampas the inclusive upper bound,get_online_featureswithout timestamps, feature services per model version, materialize refresh). Work the join logic on tiny local tables; do not deploy Feast. Page read 2026-10-15 (v0.66-branch documentation). - MLflow Model Registry DocsMLflow · support
Read the Model Registry page (registered models, versions, lineage to the producing run, aliases such as @champion, and tags) and the registry tutorial promotion flow. Stages are deprecated since MLflow 2.9; use aliases and tags. Page read 2026-10-15; the versioned docs move, so re-pin the version you read.
- DVC Docs - Data VersioningDVC · support
Read
dvc add(Description and Example: Single file) for.dvccontent-hash sidecars, thedvc.yamlpage with itsdvc.lock filesection for pipeline state, andpushandpullfor transfer. A local directory remote is enough; do not set up cloud storage. Page read 2026-10-15. - PostgreSQL 18 Documentation - Recovery Targets, Backup Verification and RewindPostgreSQL Global Development Group · reference
Read Section 19.5.6 Recovery Target, the
pg_verifybackupreference and thepg_rewindreference for recovery stopping points, manifest checks and rejoining a diverged primary.