Unit 2 of 15 · about 5 hours · explain, implement
Authorization on every data path, tenant isolation and multi-tenant fault and restore tests
A correct happy-path check leaks the moment a retry replays a request, a cache serves a shared entry, or a restore replays another tenant's rows. Isolation is a property of every path, not of one middleware.
You'll be able to
- Enforce scoped authorization on every data path, including retry, cache, restore and migration paths.
- Isolate tenants with key and predicate discipline, and state which cache entries may be shared across tenants.
- Run multi-tenant fault and restore tests that prove one tenant cannot read or mutate another tenant's state.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Least privilege: small APIs, auditing, breakglassGoogle SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and Recovery
Concepts and Terminology (Least Privilege, Zero Trust Networking); Best Practices (Small Functional APIs, Breakglass, Auditing including Collecting good audit logs); Testing and Least Privilege
- Multi-tenancy: isolation levels and noisy neighborsHLD Handbook - Reliability, Operations and Security at Scale
The three isolation levels; Row-level security as defense-in-depth; Noisy-neighbor defenses; Data residency and crypto-shredding
Read for the isolation spectrum and row-level predicates. Skip the bridge-model case study and per-tenant metering as product detail.
- Access models: from ACL to ReBACHLD Handbook - Reliability, Operations and Security at Scale
AuthZ models: from ACL to ReBAC; Zanzibar and its descendants
Read for the model vocabulary only. You implement a local RBAC check in Practice, not Zanzibar.
Focus on
- Derive the tenant predicate from the authenticated identity on each path. A check that runs on ingest but not on restore, retry or cache fill is a second door.
- Small functional APIs make authorization auditable: each endpoint takes the identity it needs and nothing more, with breakglass as the named exception.
- Cache keys carry the tenant, or the entry is provably tenant-free. A shared entry keyed without the tenant is a cross-tenant read.
- Use storage predicates as defense in depth behind endpoint checks. Test both enforcement points, including whether privileged restore roles bypass row-level security; a missing check in either layer must not expose another tenant's rows.
Common mistakes · 3
- Inheritance flows downward only. The RBAC exercise denies a parent a permission granted to its child; a check that walks the wrong direction grants too much.
- Breakglass without audit is a backdoor. The least-privilege chapter pairs every emergency path with logging and review.
- Testing with one tenant. A single-tenant test passes vacuously; isolation needs at least two tenants with overlapping keys.
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.Roles form the chain 2 inherits 1 inherits 0, with direct masks 4, 2 and 1. What is role 2's effective mask, and does it grant permission bit 1?Answer
The effective mask is , which contains bit 1, so yes. Inheritance accumulates down the chain.
2.Role 0 requests a permission granted only to role 2. Granted?Answer
No. Permissions flow from parent to child, never upward to parents or across to siblings.
3.A restore replays rows with the tenant column intact but skips the endpoint check. Is isolation preserved?Answer
Only if the storage layer re-applies the tenant predicate, for example row-level security, and the restore role does not bypass it. Otherwise the restore path skips the only check.
4.Two tenants share a cache entry keyed by query hash without a tenant field. What breaks?Answer
Tenant A can read tenant B's result. Either scope the key by tenant or prove the entry holds no tenant data.
Practice
- AlgoMaster: Check Effective RBAC Permissions
hasPermissionwith direct bitmasks and parent chains; the page tests downward-only inheritance over acyclic chainsThen add the same check to your loglab reads. The section mini-project covers this: multi-tenant fault and restore tests with overlapping keys.
You're done when
Your three loglab reads enforce the same predicate, the RBAC checks pass including the upward-denial case, and a two-tenant test with identical keys shows no cross reads.
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.