Secure failure and defense in depth
Define safe failure per operation
Secure defaults restrict access until explicit policy permits it. A secure failure mode maintains important safety and security properties when dependencies fail. For a reservation write, if identity or policy cannot be verified, do not create a record. For public catalog browsing, a read-only cached catalog can remain available without member data. These different outcomes preserve confidentiality and integrity while allowing limited availability; a single fail-open or fail-closed slogan is insufficient.
Independent protective layers
Use an API authorization check, separate workload identities, narrow database grants, bounded queue processing and protected audit records. A queue worker must validate its job type and ownership context rather than trust the producer by location. Zero trust means access decisions are based on verified identity, resource and policy rather than implicit network trust. Two checks that share the same overprivileged identity or policy outage may fail together. Document common dependencies and test their loss.
Compare two designs
Design A uses a shared service identity and direct synchronous mail delivery. Design B separates identities and queues notification jobs after durable reservation commit. B limits access and separates mail failures from reservation availability, but adds queue operations, delayed delivery and retry bookkeeping. Use illustrative costs of 20 and 35 units/month, and an agreed 40-unit budget. B fits the budget but must still satisfy privacy, monitoring and usability requirements. Queue limits and idempotent job handling are needed; durable commit and job creation require a consistent mechanism such as a transactional outbox.
Test dependencies rather than count controls
Suppose the audit sink becomes unavailable. For a privileged change that requires durable audit evidence, hold the change until the required evidence can be committed; report the degraded state through an approved channel. Do not silently drop mandatory evidence. For an ordinary public read, policy may permit a minimal cached response. Define an approved recovery condition, bounded retry behavior and incident escalation. A test of a simplified decision table does not prove atomic writes or real resilience.
Practice failure decisions
Use the chapter’s offline policy.py and cases.json to predict public catalog reads, reservation writes and privileged changes. Compare valid, missing and malformed evidence. Explain why a notification outage should not reverse a committed reservation and why the exercise does not test the actual queue or database. Propose a separate integration test for durable audit and transaction boundaries.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Secure failure and defense in depth — knowledge check
Review trust boundaries, STRIDE requirements, failure modes and architecture decisions.
Identity verification fails during a reservation write. What is the classroom policy?
Which operation may degrade to a public cached response?
What weakens independence of layers?
What is a trade-off of asynchronous notifications?
What is needed beyond the offline policy test?