Defense in depth
A strategy that applies multiple complementary protective controls so that the failure or bypass of one does not eliminate protection.
Fundamentals of Cybersecurity
Defense in depth is a security pattern that combines overlapping controls so that multiple defenses remain when one control fails.
- How it is used
- Protects organizational assets by combining controls so protection remains when an individual control fails.
- How deep it goes
- Explains the principle through a fortress analogy and named controls, then applies layered protection to access, physical security, and IoT risks.
- Examples
- Uses a fortress diagram, patient records versus an event calendar, and overlapping controls such as locks, firewalls, and multi-factor authentication.
- What you can do after
- Apply it by selecting overlapping controls appropriate to an asset’s risk and revisiting them as conditions change.
Read how Fundamentals of Cybersecurity explains defense in depth →
Financial AI in Practice
Defense in depth layers distinct protective controls so that one control can compensate for another's failure or limitations.
- How it is used
- Uses complementary controls to manage risk in financial AI workflows.
- How deep it goes
- Defines complementary layers and describes their roles in fraud detection and response review, without specifying implementation steps.
- Examples
- Uses transaction blocking, alert summaries, financial-advice approval, and retained investigation outputs as concrete control examples.
- What you can do after
- Evaluate/understand how layered controls balance transaction speed, investigation depth, and compliance.
Read how Financial AI in Practice explains defense in depth →
Grokking Software Architecture
Layered defense is a security pattern that places multiple independent protective controls between an attacker and protected resources.
- How it is used
- Uses layered controls as an architectural response to breached perimeter defenses.
- How deep it goes
- Defines independent layers and explains their roles across network, application, and data tiers through an architectural diagram and breach analysis.
- Examples
- Illustrates layers with a castle and analyzes the 2013 Target HVAC vendor breach.
- What you can do after
- Evaluate/understand how layered defenses contain intruders and differ from a perimeter-only model.
Read how Grokking Software Architecture explains defense in depth →
Real-World Cryptography
A defense-in-depth technique is a security measure that adds an independent protective layer to reduce the impact of failures or compromises.
- How it is used
- Reduces the impact of failures or compromises by making attackers defeat multiple imperfect protections.
- How deep it goes
- Defines layering through password, web, and hardware examples, but stops short of prescribing one universal defense stack.
- Examples
- Uses hashed passwords, certificate revocation, OCSP stapling, Certificate Transparency, skimmers, evil maid attacks, and hardware key isolation.
- What you can do after
- Evaluate security designs by identifying independent layers and estimating how each raises an attacker’s cost.
Read how Real-World Cryptography explains defense in depth →
AI Governance
Defense in depth is a security and safety strategy that layers independent controls so that failure or bypass of one control does not defeat the others.
- How it is used
- Protects GenAI deployments by layering containment and safety controls around potentially unreliable model behavior.
- How deep it goes
- Explains sandbox boundaries and trade-offs alongside logging and independent output moderation, with examples of implementation options.
- Examples
- Uses a claims agent with restricted containers and a separate moderation layer to illustrate layered protection.
- What you can do after
- Evaluate containment boundaries and select independent moderation options for a GenAI deployment.
MongoDB 8.0 in Action, Third Edition
Defense in depth is a security strategy that layers multiple independent defensive mechanisms so that one breached control does not expose an entire system.
- How it is used
- Protects Atlas data and infrastructure when one security control is bypassed.
- How deep it goes
- Defines the strategy and gives configuration choices across network access, identity, permissions, and encryption, without a step-by-step setup.
- Examples
- Uses IP access lists, private endpoints, federated SSO, SCRAM or X.509, and encryption options as Atlas controls.
- What you can do after
- Operate/configure Atlas with complementary network, access, and encryption controls so one failed control is not the only barrier.
Read how MongoDB 8.0 in Action, Third Edition explains defense in depth →
Microsoft Azure in Action
Defense in depth is a security pattern that applies multiple independent protective layers so that failure of one control does not expose the entire system.
- How it is used
- Frames Azure security as multiple protections for data rather than one feature to enable.
- How deep it goes
- Defines the layered approach and names seven Azure layers, but stops short of product-by-product security configuration.
- Examples
- Uses a seven-barrier castle analogy and restricted data-center entry to make layered protection concrete.
- What you can do after
- Evaluate/understand Azure security as seven layers protecting data, while recognizing that some security choices still require configuration.
Read how Microsoft Azure in Action explains defense in depth →
Kubernetes for Developers
Defense in depth is a security strategy that layers multiple independent protections so that failure of one protection does not compromise the entire system.
- How it is used
- Protects Kubernetes workloads by adding non-root execution to container isolation.
- How deep it goes
- Explains three defense layers and works through identity, permissions, ports, and service configuration.
- Examples
- Uses Kubernetes manifests, Dockerfile USER settings, port 8080 migration, and permission-related pod failures.
- What you can do after
- Operate containers with non-root identities and diagnose resulting startup, port, and filesystem permission errors.
Read how Kubernetes for Developers explains defense in depth →
Azure Security
A security strategy that combines multiple independent layers of protection so that each layer increases attack difficulty and compensates when another layer fails.
- How it is used
- Reduces breach likelihood by layering Azure controls across workload security, threat detection, investigation, and response.
- How deep it goes
- Explains layered protection, failure compensation, and threat progression without detailing individual service configuration.
- Examples
- Uses a soccer defense analogy and diagrams Azure resource types and security services protecting applications and data.
- What you can do after
- Apply layered Azure security controls across resources, attack stages, monitoring, detection, investigation, and response.
Designing AI Systems
Defense in depth is a security pattern that applies multiple independent protective controls so that failure of one control does not eliminate protection.
- How it is used
- Protects production AI assistants from unsafe requests, invalid tool actions, and unsafe responses.
- How deep it goes
- Traces gateway checks, model-to-tool validation, output filtering, classifiers, schemas, constraints, and enforcement branches.
- Examples
- Uses medical-topic blocking, past-date rejection, patient-identity checks, output filtering, and session-scoped ticket limits.
- What you can do after
- Configure guardrails that block, redirect, warn, or constrain requests and tool calls before unsafe actions complete.
Build Financial Software with Generative AI (From Scratch)
Defense in depth is a security strategy that uses multiple independent layers of protection across physical, network, application, data, and access controls.
- How it is used
- Applies layered protections across containers, applications, data, users, networks, and physical infrastructure.
- How deep it goes
- Explains the principle and demonstrates container controls, while stopping short of a full security architecture.
- Examples
- Uses read-only containers, resource limits, no-new-privileges, encryption, data masking, authentication, and authorization.
- What you can do after
- Apply layered container controls and identify complementary application, data, and access protections.
Read how Build Financial Software with Generative AI (From Scratch) explains defense in depth →
Also covered in
- Building Reliable AI Systems
- Context EngineeringIn early access (MEAP)
- Grokking Web Application Security
- Generative AI in Action
- Data-Driven Cybersecurity
- LLM Evaluation and Alignment, The Foundational IdeasIn early access (MEAP)
- AI Agents in Action, Second Edition
- Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more
- Spring Security in Action, Second Edition
What to know first
- authorizationAuthorization is the determination of which actions or resources an identity or other entity is permitted to access under defined permissions or policies.
- authenticationAuthentication is the process of verifying the claimed identity of a user, service, device, or other entity.
- encryptionEncryption is the cryptographic transformation of readable data into ciphertext that requires appropriate decryption information to recover the original data.
- human-in-the-loopHuman-in-the-loop is a system or workflow design in which people participate in reviewing, guiding, correcting, or authorizing an automated process.
Related concepts
- guardrailuses · A guardrail is a constraint, control, or monitoring mechanism that limits system behavior to reduce risks and keep actions or outputs within acceptable bounds.
- data leakageaddresses · Data leakage is the unintended transfer or use of information outside its intended boundary, compromising confidentiality or the validity of model development or evaluation.
- key rotationhas part · Key rotation is the controlled replacement of cryptographic keys with new keys according to a defined security policy, schedule, or usage limit.
- LLM-as-a-judgeuses · LLM-as-a-judge is an evaluation technique in which a language model assesses or compares outputs according to specified criteria.
Questions about defense in depth
What is defense in depth?
A strategy that applies multiple complementary protective controls so that the failure or bypass of one does not eliminate protection.
Which Manning books explain defense in depth?
Fundamentals of Cybersecurity, Financial AI in Practice, Grokking Software Architecture, Real-World Cryptography, AI Governance, MongoDB 8.0 in Action, Third Edition, Microsoft Azure in Action, Kubernetes for Developers and 3 more.
What should I know before learning defense in depth?
Manning books that teach defense in depth usually introduce authorization, authentication, encryption and human-in-the-loop first.
What is the difference between defense in depth and profile?
A strategy that applies multiple complementary protective controls so that the failure or bypass of one does not eliminate protection. A set of guaranteed properties that C++ code opts into, enforced through safe language facilities and restrictions on application code.
What are the parts of defense in depth?
Defense in depth includes key rotation.
What is defense in depth also called?
Defense in depth is also called layered defense.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.










