We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Security Architecture
Free preview: the first 2 parts of this 5-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Security Architecture
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Medieval castle builders understood something that many software architects forget: a single wall is not enough. Castles had moats, outer walls, inner walls, towers, and a keep. An attacker who crossed the moat still faced the outer wall. Breaching the outer wall revealed the inner wall. Each layer slowed the attack and gave defenders time to respond.
Defense in depth applies this principle to software. No single security control is perfect. Firewalls have vulnerabilities. Authentication can be bypassed. Encryption can be misconfigured. But when you layer multiple independent controls, an attacker must defeat all of them to reach your assets.
The 2013 Target breach illustrates what happens without layered defense. Attackers entered through an HVAC vendor's compromised credentials. Once past the perimeter, nothing stopped lateral movement to the payment processing network. A second layer (network segmentation) would have blocked access to cardholder data. A third layer (anomaly detection) would have flagged the unusual data transfers to a staging server. A fourth layer (egress filtering) would have blocked the exfiltration. Any single additional layer would have contained the breach. They had none.
40 million credit card numbers were stolen. The CEO and CIO resigned. The total cost exceeded $200 million.
Defense in depth is not "add more firewalls." Each layer addresses a different class of threat with a different type of control.
| Layer | Purpose | Controls | Example |
|---|---|---|---|
| Perimeter | Stop external threats before they reach your network | WAF, DDoS protection, geo-blocking | Cloudflare blocks 124 billion threats per day |
| Network | Segment internal traffic so a breach cannot spread | VLANs, security groups, network policies | PCI-DSS requires cardholder data on an isolated segment |
| Identity | Verify who is making every request | MFA, mTLS, certificate-based auth | Google requires 2FA for all employees since 2017 |
| Application | Protect against app-level attacks | Input validation, parameterized queries, CSP | Stripe's API validates every field type and range |
| Data | Protect data at rest and in transit | AES-256 encryption, field-level encryption, tokenization | Apple encrypts iCloud data with per-user keys |
Each layer operates independently. The WAF does not rely on the firewall. The application does not rely on the WAF. The database encryption does not rely on the application. If any single layer fails, the remaining layers still provide protection.
| Monitoring | Detect what slipped through all other layers | SIEM, anomaly detection, audit logs | Netflix's Security Monkey flags config drift in real time |
| Recovery | Respond when a breach occurs despite all layers | Incident response, immutable backups, forensics | CrowdStrike's playbook: contain in 1 hour, remediate in 24 |