Skill — Zero Trust Architecture
When this skill activates
Any task involving network security architecture where traditional perimeter-based
security is being replaced or augmented by identity-centric, continuous verification
models. Includes mTLS implementation, micro-segmentation, identity-aware proxies,
and BeyondCorp-style access patterns.
Mandatory actions when this skill is active
Before writing any code
- Inventory all communication flows (service-to-service, user-to-service, external).
- Define identity model (who/what can talk to whom under what conditions).
- Map trust boundaries — there are no trusted zones, only verified identities.
- Determine device posture requirements for user-facing access.
During implementation
- Authenticate every request regardless of network origin.
- Implement mTLS for all service-to-service communication.
- Apply least privilege — grant minimum permissions needed, no more.
- Never trust network location as a security signal.
- Pass identity claims downstream (not just "authenticated: yes").
- Re-verify identity on privilege escalation or sensitive operations.
- Log all access decisions for audit.
After implementation
- Verify default-deny is enforced (no open paths by accident).
- Test that compromising one service doesn't grant lateral movement.
- Confirm certificate rotation works automatically.
- Validate device posture checks block non-compliant devices.
- Audit that all flows are identity-verified.
Core Principles
The Three Pillars
- Never trust, always verify — Every request is treated as if from an open network.
- Least privilege access — Grant minimum permissions, scope tightly, time-bound when possible.
- Assume breach — Design as if attackers are already inside. Limit blast radius.
Trust Signals (Combined, Not Individual)
- Identity (who is this? verified cryptographically).
- Device (is this device healthy? patched? managed?).
- Context (where, when, what resource, what action?).
- Risk score (is this behavior anomalous?).
Identity-Aware Proxy
Pattern
User → Identity-Aware Proxy → Authenticate → Check Policy → Backend Service
↓
[Identity Provider]
[Policy Engine]
[Device Trust Store]
Implementation
- Proxy sits at the edge (or service mesh ingress).
- Authenticates user via OIDC/SAML.
- Checks policy engine for authorization.
- Injects verified identity headers to backend.
- Backend trusts proxy-injected headers (not user-supplied).
Tools
- Google IAP, Cloudflare Access, Ory Oathkeeper, Pomerium.
Mutual TLS (mTLS)
Why
- Encrypts traffic between services (confidentiality).
- Cryptographically verifies both client and server identity (authentication).
- Prevents unauthorized services from communicating.
Implementation
- Use service mesh (Istio, Linkerd) for automatic mTLS.
- Rotate certificates automatically (short-lived: 24h recommended).
- Use SPIFFE/SPIRE for workload identity.
- Never disable mTLS verification in production.
Certificate Management
- Auto-issue via cert-manager or service mesh CA.
- Short-lived certificates (hours, not years).
- Automated rotation with zero downtime.
- Certificate revocation for compromised services.
Micro-Segmentation
Approach
- Start with default-deny between all services.
- Declare allowed communication flows explicitly.
- Enforce at network layer (NetworkPolicy) AND application layer (authz).
- Segment by sensitivity level (PII services isolated from general services).
Example Policy
# Only payment-service can talk to payment-db
source: payment-service
destination: payment-db
port: 5432
action: ALLOW
# Everything else to payment-db
source: *
destination: payment-db
action: DENY
Device Posture
Checks Before Granting Access
- OS version current (within N patches).
- Disk encryption enabled.
- Firewall active.
- No known malware detected.
- MDM-managed (for corporate devices).
- Screen lock enabled.
Degraded Access
- Non-compliant device → read-only access or blocked entirely.
- Unknown device → step-up authentication required.
- Jailbroken/rooted → zero access to sensitive resources.
Continuous Verification
Re-verify When
- Session exceeds time threshold (e.g., every 1 hour).
- User requests privilege escalation.
- Anomalous behavior detected (impossible travel, unusual time).
- Accessing higher-sensitivity resource than current level.
- Device posture changes mid-session.
Risk-Based Response
- Low risk → continue session.
- Medium risk → step-up auth (MFA prompt).
- High risk → terminate session, require full re-authentication.
BeyondCorp Model
Key Differences from VPN
| Traditional VPN |
BeyondCorp (Zero Trust) |
| VPN = trusted zone |
No trusted zone exists |
| Once in, full access |
Every request verified |
| Network location = trust |
Identity + device + context = trust |
| Perimeter defense |
Defense in depth everywhere |
| Hard outside, soft inside |
Uniformly hardened |
Self-check
1---2name: zero-trust-architecture3description: Skill — Zero Trust Architecture4---56# Skill — Zero Trust Architecture78## When this skill activates9Any task involving network security architecture where traditional perimeter-based10security is being replaced or augmented by identity-centric, continuous verification11models. Includes mTLS implementation, micro-segmentation, identity-aware proxies,12and BeyondCorp-style access patterns.1314## Mandatory actions when this skill is active1516### Before writing any code171. Inventory all communication flows (service-to-service, user-to-service, external).182. Define identity model (who/what can talk to whom under what conditions).193. Map trust boundaries — there are no trusted zones, only verified identities.204. Determine device posture requirements for user-facing access.2122### During implementation23- Authenticate every request regardless of network origin.24- Implement mTLS for all service-to-service communication.25- Apply least privilege — grant minimum permissions needed, no more.26- Never trust network location as a security signal.27- Pass identity claims downstream (not just "authenticated: yes").28- Re-verify identity on privilege escalation or sensitive operations.29- Log all access decisions for audit.3031### After implementation32- Verify default-deny is enforced (no open paths by accident).33- Test that compromising one service doesn't grant lateral movement.34- Confirm certificate rotation works automatically.35- Validate device posture checks block non-compliant devices.36- Audit that all flows are identity-verified.3738## Core Principles3940### The Three Pillars411. **Never trust, always verify** — Every request is treated as if from an open network.422. **Least privilege access** — Grant minimum permissions, scope tightly, time-bound when possible.433. **Assume breach** — Design as if attackers are already inside. Limit blast radius.4445### Trust Signals (Combined, Not Individual)46- Identity (who is this? verified cryptographically).47- Device (is this device healthy? patched? managed?).48- Context (where, when, what resource, what action?).49- Risk score (is this behavior anomalous?).5051## Identity-Aware Proxy5253### Pattern54```55User → Identity-Aware Proxy → Authenticate → Check Policy → Backend Service56 ↓57 [Identity Provider]58 [Policy Engine]59 [Device Trust Store]60```6162### Implementation63- Proxy sits at the edge (or service mesh ingress).64- Authenticates user via OIDC/SAML.65- Checks policy engine for authorization.66- Injects verified identity headers to backend.67- Backend trusts proxy-injected headers (not user-supplied).6869### Tools70- Google IAP, Cloudflare Access, Ory Oathkeeper, Pomerium.7172## Mutual TLS (mTLS)7374### Why75- Encrypts traffic between services (confidentiality).76- Cryptographically verifies both client and server identity (authentication).77- Prevents unauthorized services from communicating.7879### Implementation80- Use service mesh (Istio, Linkerd) for automatic mTLS.81- Rotate certificates automatically (short-lived: 24h recommended).82- Use SPIFFE/SPIRE for workload identity.83- Never disable mTLS verification in production.8485### Certificate Management86- Auto-issue via cert-manager or service mesh CA.87- Short-lived certificates (hours, not years).88- Automated rotation with zero downtime.89- Certificate revocation for compromised services.9091## Micro-Segmentation9293### Approach941. Start with default-deny between all services.952. Declare allowed communication flows explicitly.963. Enforce at network layer (NetworkPolicy) AND application layer (authz).974. Segment by sensitivity level (PII services isolated from general services).9899### Example Policy100```yaml101# Only payment-service can talk to payment-db102source: payment-service103destination: payment-db104port: 5432105action: ALLOW106107# Everything else to payment-db108source: *109destination: payment-db110action: DENY111```112113## Device Posture114115### Checks Before Granting Access116- OS version current (within N patches).117- Disk encryption enabled.118- Firewall active.119- No known malware detected.120- MDM-managed (for corporate devices).121- Screen lock enabled.122123### Degraded Access124- Non-compliant device → read-only access or blocked entirely.125- Unknown device → step-up authentication required.126- Jailbroken/rooted → zero access to sensitive resources.127128## Continuous Verification129130### Re-verify When131- Session exceeds time threshold (e.g., every 1 hour).132- User requests privilege escalation.133- Anomalous behavior detected (impossible travel, unusual time).134- Accessing higher-sensitivity resource than current level.135- Device posture changes mid-session.136137### Risk-Based Response138- Low risk → continue session.139- Medium risk → step-up auth (MFA prompt).140- High risk → terminate session, require full re-authentication.141142## BeyondCorp Model143144### Key Differences from VPN145| Traditional VPN | BeyondCorp (Zero Trust) |146|----------------|------------------------|147| VPN = trusted zone | No trusted zone exists |148| Once in, full access | Every request verified |149| Network location = trust | Identity + device + context = trust |150| Perimeter defense | Defense in depth everywhere |151| Hard outside, soft inside | Uniformly hardened |152153## Self-check154- [ ] All service-to-service communication uses mTLS.155- [ ] Default-deny network policy in place.156- [ ] Identity verified on every request (not just at edge).157- [ ] Least privilege enforced (no over-permissioned service accounts).158- [ ] Device posture checked for user access.159- [ ] Continuous verification triggers defined.160- [ ] Certificate rotation is automatic and tested.161- [ ] Lateral movement prevented (compromise one service != access to others).162- [ ] All access decisions logged for audit.