Course contents

12. Security and Identity Lesson 7 of 8

Zero Trust

Why network location is not identity: workload certificates, mutual TLS, default-deny policies, identity-aware access for people, and containing a breach.

15 minIntermediate9 steps
Loading the interactive simulation…
Loading the knowledge check…

Summary

  • The perimeter model trusts anything on the internal network, so one compromised host can reach everything.
  • Zero trust authenticates and authorizes every request by identity, wherever it comes from (NIST SP 800-207).
  • Workloads get short-lived, attested certificates (SPIFFE-style) and authenticate each other with mTLS.
  • Default-deny policies per identity and action keep a compromise the size of one service’s permissions.
  • People get per-application access through an identity-aware proxy that checks user and device on every request.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

Zero trust is a security model in which no request is trusted because of where it comes from. Every request, from a person or a workload, inside or outside the corporate network, is authenticated and authorized against the identity of the caller, the state of its device or workload, and an explicit policy. NIST SP 800-207 (2020) is the common reference; Google's BeyondCorp papers describe one of the first large deployments for employee access.

Why it exists

The older perimeter model puts a firewall and a VPN around a trusted internal network. Inside, services accept connections from internal addresses, often without credentials, and admins reach whatever they can route to. That design assumes the inside stays clean. In practice attackers get in through phishing, a vulnerable dependency, a stolen VPN credential or a contractor laptop, and then move laterally: once inside, the network itself is the credential. Cloud, SaaS and remote work also dissolved the perimeter: there is no longer one inside.

How it works

Workload identity. Every workload gets a cryptographic identity issued after attestation (which Kubernetes service account, which node, which cloud instance role). SPIFFE defines the format (spiffe://trust-domain/path) and SPIRE, service meshes (Istio, Linkerd) and cloud platforms implement issuers. Credentials are short-lived (minutes to hours) and rotated automatically, so a stolen one expires quickly.

Mutual TLS. Service-to-service calls use mTLS: both sides present certificates, so the server knows which workload is calling and the client knows it reached the right server, and traffic is encrypted. A mesh's sidecar or node proxy does this transparently; connections are reused, so full handshakes are rare.

Per-request authorization. Each service (or its proxy) enforces policy on every request: orders may POST /charges on payments. Policies are default-deny and written in terms of identities and actions, not IP ranges. Engines such as OPA or Cedar, or mesh authorization policies, evaluate them locally from centrally managed rules. End-user identity is propagated too (a token from the edge), so services can check both the calling workload and the user it acts for.

Access for people. Instead of a VPN onto the network, an identity-aware access proxy sits in front of each internal application. On every request it checks the user (SSO with phishing-resistant MFA), the device (managed, patched, disk encrypted) and the policy for that application. Users reach applications, never networks.

Continuous verification and logging. Sessions are short, decisions are re-evaluated as signals change (device falls out of compliance, user is disabled), and every allow and deny is logged.

When to use it

  • Any system with more than a handful of services, especially multi-tenant platforms and anything handling payments, health or personal data.
  • Workforces that are remote or use SaaS heavily, where the VPN is a bottleneck and a broad attack surface.
  • Hybrid and multi-cloud environments where no single network boundary exists.
  • Regulated environments: many frameworks and government mandates now reference zero trust.

When not to

Zero trust is a direction, not a product to deploy all at once. For a small monolith with one database, mTLS meshes and policy engines may be more machinery than value: start with strong identity for people, least-privilege database credentials and TLS. Avoid big-bang rollouts that deny everything on day one; run policies in audit mode first.

Trade-offs

Choice You gain You pay
mTLS everywhere Authenticated, encrypted service calls A CA to run, certificate rotation, harder debugging
Service mesh sidecars Transparent mTLS and policy, uniform telemetry Extra proxy per pod, CPU and memory, operational complexity
Fine-grained default-deny policies Small blast radius, explicit dependencies Policies to write, review and keep in sync with code
Access proxy instead of VPN Per-app access, device checks, no network exposure Every internal app must sit behind the proxy
Short-lived credentials Leaks expire fast Issuance infrastructure becomes critical

Alternatives

  • Network segmentation and firewalls (VLANs, security groups, Kubernetes NetworkPolicies): coarse but cheap, and a good complement; on their own they still trust by address.
  • VPN with stricter rules: improves on a flat VPN but still grants network-level access.
  • Application-level tokens only (each service validates a JWT from the caller): authenticates users and services without a mesh; lacks transport-level workload identity unless the tokens are workload-bound.

Failure modes

  • Allow-all policies: mTLS deployed, but every identity may call everything. Authenticated, not authorized.
  • Long-lived certificates or static tokens: a stolen credential works for months.
  • The CA or policy distribution fails: no new certificates, no new workloads. Run issuers redundantly and keep a grace period before expiry.
  • Bypass paths: a legacy service or debugging port outside the mesh accepts plaintext.
  • Policy drift: rules stop matching the real call graph and teams add broad exceptions to unblock releases.
  • Device checks only at login: a device that falls out of compliance keeps its session.

In production

Start with people: SSO and phishing-resistant MFA everywhere, then an access proxy for internal tools. For services, introduce workload identity and mTLS in permissive mode, observe the real call graph, then generate and enforce default-deny policies service by service. Give databases per-service, short-lived credentials (see Secrets Management). Alert on denied calls; a spike from one identity is a strong breach signal. Measure the latency cost on your stack rather than assuming it.

Common misconceptions

  • "Zero trust means trusting nothing and nobody." It means trust is never implicit: it is granted per request, based on verified identity and policy.
  • "Zero trust is a product." Vendors sell parts (proxies, meshes, identity providers). The model is an architecture.
  • "mTLS equals zero trust." mTLS gives authentication and encryption; without per-request authorization, any authenticated service can still call anything.
  • "Zero trust prevents breaches." It assumes breach and limits what a compromised component can reach.
  • "It is too slow." Per-request checks on reused connections cost on the order of a millisecond per hop; operations cost more than latency.

Interview angle

Contrast perimeter and zero trust in one sentence, then make it concrete: workload identity (SPIFFE IDs issued by a mesh CA), mTLS on every hop, default-deny policies per identity and action, user identity propagated from the edge, short-lived database credentials, and an access proxy for staff. Walk through a compromised service and show what it can and cannot reach. Mention rollout in audit mode and the operational cost.

Model assumptions

Steps 1–7 are a scripted illustration, not a simulation: identities, certificates, policies and the attacker's moves are drawn as hand-placed packets with illustrative durations (12 ms at the edge, 5 ms between internal components). The engine has no notion of identity, certificates or network trust; a compromised service is shown as a degraded node. Step 8 and the recap use the simulation: Poisson arrivals at 300 requests per second, a gateway with 1 ms of work, orders and payments services with 16 workers and 6 ms mean service time each (lognormal, cv 0.3), and a database with 16 connections and 3 ms reads. Turning on mTLS and local policy is modelled as an illustrative +1 ms per hop (gateway, orders, payments), which moves p50 from about 42 ms to about 45 ms. Real overhead depends on the proxy, connection reuse and payload size; measure it. Numbers are illustrative, not benchmarks of any product.

The lesson as textEvery step of the simulation, written out.
  1. 1. The perimeter model: inside means trusted

    A classic network: a firewall and a VPN at the edge, and inside, a flat internal network. An employee connects to the VPN and lands *inside*. Services accept any connection from 10.0.0.0/8: orders calls payments with no credentials, because only trusted machines can reach it.

    The security decision is made once, at the edge, based on network location. Everything after that is implicitly trusted. This step is a scripted illustration: the packets are placed by hand.

    Scene: An employee’s request passes the perimeter firewall once, then flows to the admin console, orders and payments. Inside the network no service asks the caller for credentials.

    Key idea: In the perimeter model, being on the network is the credential.

  2. 2. One compromised service reaches everything

    The reporting service is compromised through a vulnerable library. It is inside the perimeter, so the network lets it talk to anything: it calls payments’ internal API, and then connects straight to the payments database with the shared service password from its config.

    Both succeed. This is lateral movement: the attacker never crossed the firewall again. The blast radius of one weak service is the whole internal network, which is how most large breaches unfold.

    Scene: The compromised reporting service calls the payments API and then the payments database directly. Both accept it because it is inside the network, and return data.

    Key idea: Implicit trust inside the perimeter turns one compromise into a breach of everything.

  3. 3. Give every workload a verifiable identity

    Zero trust (NIST SP 800-207) drops network location as a trust signal: every request is authenticated and authorized, wherever it comes from. That needs identities for software, not only people.

    A workload identity issuer (SPIFFE/SPIRE, or a service mesh’s CA) attests each workload (which Kubernetes service account, which node) and issues it a short-lived X.509 certificate naming it, such as spiffe://shop/ns/prod/sa/orders. Certificates live hours, not years, and rotate automatically. Reporting gets one too, naming *reporting*.

    Scene: A workload certificate authority issues short-lived identity certificates to orders, payments and reporting, each naming the service.

    Key idea: Identity comes from attested workload credentials, not from IP addresses.

  4. 4. Mutual TLS: both sides prove who they are

    Orders calls payments over mutual TLS. In the handshake payments presents its certificate (so orders knows it reached the real payments) and orders presents its certificate (so payments knows the caller is orders). Then the request travels encrypted.

    Payments now knows its caller by a cryptographic identity, not by an IP address that any compromised host on the subnet could have. In a service mesh, sidecar proxies or a node-level proxy do this transparently, and connections are reused, so the handshake cost is paid rarely.

    Scene: Orders opens a mutual TLS connection to payments: both present certificates, payments acknowledges, then the request goes through encrypted and is answered.

    Key idea: mTLS authenticates both ends of every service call and encrypts it.

  5. 5. Default deny, allow by identity and action

    Knowing the caller is half; payments also decides what this caller may do. A policy engine distributes rules to every service, evaluated locally on each request: *orders may POST /charges; nothing else may call payments; only payments may connect to the payments database.* Everything not allowed is denied.

    This is least privilege per request, not per network segment. The orders call is checked and allowed: the policy bundle arrives, then the request flows through to the database and back.

    Scene: The policy engine pushes rules to payments. Orders then calls payments, which checks the caller’s identity and action against the policy, allows it, reads the database and answers.

    Key idea: Authorize every request against an explicit allow list of identities and actions; deny the rest.

  6. 6. The compromised service is stopped at every hop

    The attacker in reporting tries the same moves as before. Payments sees the mTLS identity reporting, finds no rule allowing it, and answers 403. The direct database connection fails too: the database only accepts the payments identity (and its own short-lived credentials, see *Secrets Management*).

    The attacker still controls reporting and whatever reporting is allowed to reach. That is the point: the blast radius shrinks to one service’s permissions. Each denial is also logged, which turns silent lateral movement into an alert.

    Scene: The compromised reporting service calls payments and is denied with 403 based on its identity, then tries the payments database directly and is refused.

    Key idea: Zero trust does not prevent compromise; it limits what a compromised workload can reach.

  7. 7. People too: an access proxy instead of a flat VPN

    The VPN that dropped employees onto the whole network is replaced by an identity-aware access proxy (the BeyondCorp model). Each request to the admin console is checked: who is the user (single sign-on, phishing-resistant MFA), is the device managed and healthy, may this user reach *this app*? The user gets access to one application, never to the network.

    The employee’s managed laptop passes. A second device signs in with a stolen password: the device check fails and the proxy denies the request.

    Scene: The managed laptop’s request is checked by the access proxy with the identity provider and forwarded to the admin console. A request from an unmanaged device with a stolen password is checked and denied.

    Key idea: Grant people access to applications per request, based on user and device, never to a network.

  8. 8. What checking every request costs

    Now the simulation runs: customers send 300 requests per second through the API gateway to orders, payments and the payments database. For the first 2.5 s the internal calls are plain, as in step 1. Then the sidecars switch on: mTLS on every hop and a local policy decision in every service, about 1 ms per hop in this illustration.

    Watch p50: it rises from about 42 ms to about 45 ms, and nothing fails. Encryption on reused connections and in-process policy decisions are cheap; the real costs are operational: running the CA and certificate rotation, writing and reviewing policies, and debugging denied calls.

    Scene: Customers send 300 requests per second through the gateway to orders, payments and the payments database. After 2.5 seconds per-hop mTLS and policy checks switch on and median latency rises by about 3 ms, with no errors.

    Key idea: Per-request verification costs milliseconds; the bigger cost is operating identities and policies.

  9. 9. Never trust, always verify

    Network location is not identity. Give every workload a short-lived, attested identity; authenticate every call with mTLS; authorize every request against default-deny policies with least privilege; give people per-application access based on user and device; log every decision.

    A compromise still happens, but it stays the size of one service’s permissions. The per-request cost is milliseconds; plan for the operational cost of certificates and policies.

    Scene: Customers send 300 requests per second through the gateway, orders and payments with mTLS and policy checks on every hop. Nothing fails.

    Key idea: Authenticate and authorize every request by identity; assume breach and keep blast radius small.