Skip to content

Zero Trust Architecture

What is Zero Trust?

Zero Trust is a security model based on the principle “never trust, always verify.” Unlike traditional perimeter-based security (castle-and-moat), Zero Trust assumes no user, device, or network is inherently trustworthy.

Core Principles

PrincipleDescription
Verify ExplicitlyAlways authenticate and authorize based on all available data points
Least Privilege AccessLimit user access with just-in-time and just-enough-access (JIT/JEA)
Assume BreachMinimize blast radius and segment access; verify end-to-end encryption

Our Implementation

This documentation site uses Cloudflare Access to enforce Zero Trust at the edge.

Architecture Diagram

┌─────────────────────────────────────────────────────────────────────────┐
│ CLOUDFLARE EDGE (280+ cities) │
│ │
│ ┌──────────────────────────┐ ┌────────────────────────────────┐ │
│ │ Cloudflare Access │ │ Cloudflare Pages │ │
│ │ (Authentication) │ │ (Static Hosting) │ │
│ │ │ │ │ │
│ │ ┌────────────────────┐ │ │ ┌──────────────────────────┐ │ │
│ │ │ Identity Provider │ │ │ │ Static HTML/CSS/JS │ │ │
│ │ │ (One-Time PIN) │ │ │ │ (Astro Starlight) │ │ │
│ │ └────────────────────┘ │ │ └──────────────────────────┘ │ │
│ │ │ │ │ │
│ │ ┌────────────────────┐ │ │ ┌──────────────────────────┐ │ │
│ │ │ Access Policy │ │───▶│ │ CDN Cache │ │ │
│ │ │ (Email Allowlist) │ │ │ │ (Global Distribution) │ │ │
│ │ └────────────────────┘ │ │ └──────────────────────────┘ │ │
│ └──────────────────────────┘ └────────────────────────────────┘ │
│ ▲ │
└──────────────┼──────────────────────────────────────────────────────────┘
│ HTTPS + TLS 1.3
┌───────┴───────┐
│ User │
│ │
│ 1. Request │
│ 2. Challenge │
│ 3. OTP Email │
│ 4. Verified │
│ 5. Access │
└───────────────┘

Authentication Flow

  1. User requests docs.sarafoleanu.com
  2. Cloudflare Access intercepts the request at the edge
  3. User is challenged to authenticate (One-Time PIN sent to email)
  4. User enters OTP received via email
  5. Access validates the email against the policy allowlist
  6. JWT issued and stored in browser cookie (CF_Authorization)
  7. Content served from Cloudflare Pages

Security Controls

LayerControlImplementation
EdgeAuthenticationCloudflare Access
EdgeAuthorizationEmail allowlist policy
EdgeRate LimitingCloudflare built-in
EdgeDDoS ProtectionCloudflare automatic
TransportEncryptionTLS 1.3 (Cloudflare-managed)
ApplicationAttack SurfaceZero (static files only)
HeadersXSS PreventionX-Content-Type-Options: nosniff
HeadersClickjackingX-Frame-Options: DENY

Cloudflare Access Components

Access Application

The Access Application defines what is being protected:

  • Type: Self-hosted
  • Domain: docs.sarafoleanu.com
  • Session Duration: 24 hours (configurable)
  • Cookie Settings: HttpOnly, SameSite=Lax

Access Policy

The Access Policy defines who can access:

  • Decision: Allow
  • Include: Specific email addresses
  • Identity Provider: One-Time PIN (email-based)

How Policies Work

Request → Access Application → Policy Evaluation → Allow/Deny
┌───────────────┐
│ Include Rules │ ← Must match at least one
│ (email list) │
└───────────────┘
┌───────────────┐
│ Require Rules │ ← Must match ALL (if set)
│ (optional) │
└───────────────┘
┌───────────────┐
│ Exclude Rules │ ← Deny if matches (if set)
│ (optional) │
└───────────────┘

Why Static + Zero Trust?

Attack Surface Comparison

ArchitectureAttack Vectors
Traditional CMSSQL injection, XSS, CSRF, RCE, auth bypass, session hijacking, plugin vulnerabilities
Server-renderedSSRF, template injection, dependency vulnerabilities, server misconfig
Static + Zero TrustNone at application layer; auth handled at edge before content delivery

Benefits

  1. No server to compromise - Static files only
  2. No database - No SQL injection possible
  3. No runtime - No code execution vulnerabilities
  4. Edge authentication - Attackers never reach content
  5. Global performance - CDN-cached worldwide
  6. Automatic HTTPS - TLS managed by Cloudflare

Session Management

JWT Token

After authentication, Cloudflare issues a JWT stored as CF_Authorization cookie:

  • HttpOnly: JavaScript cannot access (XSS protection)
  • Secure: Only sent over HTTPS
  • SameSite=Lax: CSRF protection
  • Expiry: Matches session duration (24h default)

Token Validation

Every request is validated at the edge:

  1. Cookie present and valid signature?
  2. Token not expired?
  3. User still in policy allowlist?

If any check fails → re-authentication required.

Audit & Logging

Cloudflare Access provides:

  • Access Audit Logs: Who accessed what, when
  • Login Events: Successful and failed attempts
  • Policy Changes: Who modified access rules

Access logs in: Zero Trust Dashboard → Logs → Access

Comparison: VPN vs Zero Trust

AspectVPNZero Trust (Cloudflare Access)
Network accessFull network after connectPer-application only
AuthenticationOnce at connectionEvery request validated
Lateral movementPossibleImpossible
User experienceVPN client requiredBrowser-native
PerformanceBackhauled trafficEdge-served globally
ManagementComplex infrastructureSaaS, no servers

Best Practices

  1. Principle of Least Privilege: Only add necessary emails to allowlist
  2. Regular Access Reviews: Periodically audit who has access
  3. Session Duration: Balance security (shorter) vs convenience (longer)
  4. Audit Logs: Monitor for unusual access patterns
  5. Multiple Identity Providers: Consider adding SSO for team access