Zero Trust and Defense in Depth Security Review
On this page
Learning Objective
Review the full system against zero trust and defense-in-depth principles, map controls across identity, network, application, data and pipeline layers, prepare an incident response process with runbooks and drills, contain a credential compromise concretely, and meet disclosure and notification obligations.
Concept Explanation
The earlier phases built security in piece by piece. This lesson steps back and asks whether the pieces form a coherent whole, and what happens when something fails anyway. Zero trust is the guiding model. It abandons the idea of a trusted internal network in favor of three principles: verify explicitly, using every available signal such as identity, device, location, and behavior; use least privilege access, granting only what is needed for as long as it is needed; and assume breach, designing so that a compromise of one component is contained and detected. Google's BeyondCorp papers, from 2014 onward, described applying this to its own workforce access, removing reliance on the corporate network as a security boundary, and the approach has become the industry norm.
Defense in depth means that no single control is the only thing between an attacker and the data. Map your controls across layers and check for single points of failure. At the edge: TLS, a web application firewall, rate limiting, and origin lockdown. Identity: an identity provider with multi-factor authentication, ideally phishing-resistant passkeys, short-lived tokens, and the BFF keeping tokens out of the browser. Application: authorization on every object and function, input validation, output encoding, secure headers, and a strict CSP. Data: parameterized queries, least-privilege database logins, row-level security, encryption at rest and in transit, and backups. Infrastructure: private endpoints, managed identities, no public databases, and policy guardrails. Pipeline and supply chain: pinned dependencies and actions, scanning, signed artifacts, and OIDC deployment. Detection: logs, alerts, and audit trails across all of them. For each risk in your threat model, you should be able to name at least two layers that would stop or detect it.
Assuming breach means preparing for the day a control fails. Incident response follows a lifecycle described in NIST's Computer Security Incident Handling Guide: preparation, detection and analysis, containment, eradication and recovery, and post-incident review. Preparation is where most of the value is: named roles, an on-call rotation, a communication plan, runbooks for the likeliest incidents, log retention that covers the investigation window, and immutable, tested backups so that ransomware or destructive actions can be recovered from. Practice matters as much as documents. A tabletop exercise, where the team talks through a realistic scenario step by step, reveals unclear ownership and missing access before a real incident does, and rotating a critical secret as a drill proves that rotation actually works.
Runbooks turn panic into procedure. For a suspected leaked credential, the sequence is to revoke or rotate at the source first, invalidate sessions and tokens issued with it, search the audit logs for use during the exposure window, assess what was accessed, contain any changes, and record a timeline. Humans remain a target: in September 2022, an attacker linked to the Lapsus$ group compromised an Uber contractor's credentials and then bombarded them with multi-factor push requests until one was approved, gaining internal access, whereas Cloudflare reported in August 2022 that a sophisticated phishing attack against its employees failed because they used FIDO2 hardware keys that cannot be phished. Legal and communication duties are part of response: the GDPR requires notifying the supervisory authority of a qualifying personal data breach within 72 hours of becoming aware of it, so know in advance who decides and who communicates. Publish a security.txt file, defined by RFC 9116, so researchers know how to report vulnerabilities, and close every incident with a blameless review that produces concrete follow-up actions.
| Layer | Controls from this course | Question to ask |
|---|---|---|
| Edge | WAF, TLS, rate limits, origin lockdown | Can traffic reach the origin around the WAF? |
| Identity | OIDC, MFA and passkeys, BFF, short tokens | Is a stolen password enough to get in? |
| Application | Authorization, validation, headers, CSP | Does every object and function check permissions? |
| Data | Parameterization, least privilege, RLS, encryption, backups | Could an injection or leaked login read everything? |
| Infrastructure | Private endpoints, managed identity, policy, locks | Is anything public that need not be? |
| Pipeline | Pinned actions, scanning, attestation, OIDC | Could a compromised dependency or action reach production? |
| Detection and response | Logs, alerts, audit trail, runbooks, drills | Would we notice, and know what to do in the first hour? |
Worked Example: A Review Checklist, a Containment Runbook, a Detection Query and a security.txt
The checklist drives the review, the runbook shows concrete containment for a leaked service credential and a compromised user, and the query and file complete the picture.
SECURITY ARCHITECTURE REVIEW (run per release train and after any major design change)
Trust boundaries and data flows
[ ] Current data flow diagram, updated this quarter; each boundary crossing has an authentication and authorization decision
[ ] Threat model (STRIDE) refreshed for new features; findings tracked with owners and dates
Zero trust
[ ] No implicit trust from network location: internal services authenticate every call with audience-specific tokens
[ ] All human access to production is via SSO with MFA, time-limited elevation (just in time), and is logged
[ ] Every workload has its own managed identity with the smallest role assignments; a quarterly access review removes stale ones
Defense in depth, check for single points of failure
[ ] Object-level authorization tested by the access matrix AND enforced by query filters AND row-level security (tenant data)
[ ] Injection: parameterized queries, least-privilege DB login, and the analyzer rule as a build error
[ ] Secrets: none in code or images; Key Vault with purge protection and audit logging; rotation drill done this quarter
Detection and response
[ ] Alerts for failed-login spikes, authorization denials, privilege changes, secret reads by unexpected identities
[ ] Log retention covers the longest plausible investigation window; logs are tamper-evident and access controlled
[ ] Backups are immutable and a restore has been tested within the last 90 days
[ ] Incident roles, on-call rotation, comms templates, and legal contacts are current; a tabletop exercise ran this half-year# RUNBOOK: a service credential or token is suspected leaked. Speed matters: contain first, investigate second.
# 1. Revoke at the source. For an Entra app secret: create a new one, deploy it via Key Vault, then delete the old.
az ad app credential list --id $APP_ID
az ad app credential reset --id $APP_ID --append --display-name "rotated-$(date +%F)" # new secret, then remove the old key id below
az ad app credential delete --id $APP_ID --key-id $OLD_KEY_ID
# 2. Cut off anything already issued: revoke refresh tokens and sessions for the affected principal.
az rest --method POST --url "https://graph.microsoft.com/v1.0/users/$USER_ID/revokeSignInSessions"
# In the BFF: bump the user's session version so server-side validation rejects existing cookies immediately (Day 43).
# 3. Search the audit trail for use during the exposure window (Log Analytics).
# Who used the credential, from where, and what did they touch?// KQL: sign-ins for the affected service principal outside its normal addresses, in the exposure window
AADServicePrincipalSignInLogs
| where TimeGenerated between (datetime(2026-09-20) .. datetime(2026-09-24))
| where ServicePrincipalId == "<sp-object-id>"
| where IPAddress !in ("<our-egress-ip-1>", "<our-egress-ip-2>")
| project TimeGenerated, IPAddress, ResourceDisplayName, ResultType, Location
// KQL: privileged role assignments created outside the deployment pipeline (persistence attempts)
AzureActivity
| where OperationNameValue == "MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE" and ActivityStatusValue == "Success"
| where Caller !in ("<pipeline-identity-object-id>")
| project TimeGenerated, Caller, CallerIpAddress, Properties# 4. Assess and record. Answer these in the incident document, with timestamps:
- What exactly was exposed, and for how long? What could the credential do (roles)?
- Was it used by anyone else? (log evidence, not assumption)
- Was personal data accessed? If yes, start the notification clock: supervisory authority within 72 hours of awareness (GDPR).
- What changed in our systems while it was exposed? Compare with the infrastructure repository and the audit trail.
# 5. Recover, then run a blameless review: contributing factors, detection gap, and 3 to 5 tracked follow-ups.# https://app.example.com/.well-known/security.txt (RFC 9116)
Contact: mailto:security@example.com
Expires: 2027-09-30T00:00:00.000Z
Encryption: https://example.com/pgp-key.txt
Preferred-Languages: en
Policy: https://example.com/security-policy
Acknowledgments: https://example.com/hall-of-fameTabletop scenario for the team (45 minutes, no computers):
"At 02:10 an alert shows an unfamiliar IP reading 40 secrets from the production Key Vault using the API's managed identity.
At 02:25 support reports a customer seeing another tenant's data. Who is paged? Who decides to take the site offline?
What do you do in the first hour? Who talks to customers, and what is the 72-hour deadline based on?"
Record every point of confusion. Fix the process, not the people.Treat the review as recurring, not a one-time event: the system, the dependencies, and the threats all change, and the value comes from the habit of asking the same layered questions again.
Real-World Examples
- Google's BeyondCorp initiative, described in a series of papers beginning in 2014, moved employee access from a trusted corporate network to per-request decisions based on user and device identity, with access proxies in front of internal applications. It is the origin of the modern zero trust movement, and it demonstrated that a large organization could operate without treating the internal network as trusted.
- In August 2022, Cloudflare disclosed that attackers had sent text messages with links to a convincing fake login page to its employees, and that although several employees entered credentials, the attackers could not log in because access required FIDO2 security keys tied to the real site. A month later, the Uber breach began with repeated multi-factor push requests to a contractor until one was approved. The two incidents are often compared to show the value of phishing-resistant authentication.
Review Questions & Answers
It shifts effort from only preventing compromise to limiting and detecting it. You use least privilege and separation so one compromised component reaches little, you log and alert so activity is noticed, you keep tested backups and rotation procedures so recovery is possible, and you rehearse the response, treating an intrusion as something that will eventually happen.
Push approvals and codes can be obtained from a user through fatigue attacks or by relaying them to a fake site in real time, as in the Uber incident. Hardware keys and passkeys bind the authentication to the genuine site's domain, so a fake page cannot obtain a usable response, as Cloudflare's employees experienced.
Every minute the credential remains valid is another minute an attacker can use it, so cutting off access limits damage. Investigation can proceed using logs afterward, whereas delays in containment allow further data access and persistence. Rotating at the source and invalidating existing tokens and sessions removes the attacker's foothold.
It tests the incident process without a real incident by having the team walk through a scenario, exposing unclear roles, missing access, absent contacts, and gaps in runbooks. Fixing these beforehand means that during a real event people know who decides, who communicates, and what to do first.