Course 4: Zero-Trust, Cedar & HTTP/3

Course 4 prepares you to deploy GAP in adversarial production environments: isolating untrusted T2 tools, enforcing two-person Cedar rules on IRREVERSIBLE mutations, stopping MCP rug pulls & SSRF, and serving dual-stack HTTP/3 QUIC with BLAKE3 audit verification.

What you'll learn

  • Enforce T0/T1/T2 OS sandbox boundaries and <gap:untrusted> indirect prompt-injection containment.
  • Write & verify Cedar rules in policies/default.cedar (gap policy check --dir policies).
  • Inspect DriftMonitor, EgressGuard SSRF IP pinning, 0-RTT-disabled HTTP/3 QUIC, and gap audit verify.
On this page

Lesson 1: Trust Tiers (T0/T1/T2) & <gap:untrusted> Escaping

Course 4: Zero-Trust, Cedar & HTTP/3 · 25 min · 4 lessons 0 / 4 completed

Every upstream branch sits in an explicit trust boundary: T0 (Ed25519 organization-signed manifest; invalid signature demotes cleanly to T2), T1 (admin-approved with JCS BLAKE3 hashes pinned), or T2 (untrusted/external). All T2 stdio processes require OS sandboxing (Bubblewrap/nsjail on Linux, Seatbelt on macOS—failing closed if absent) and cannot join across trust domains (INV-07).

Moreover, every payload leaving T1/T2 branches is wrapped in <gap:untrusted>...</gap:untrusted> with fake closing tags escaped (SEC-080) so upstream web/tool text can never hijack AI host instructions.

Key Takeaways

  • Invalid Ed25519 manifest signatures demote a branch safely from T0 to T2.
  • T1/T2 outputs are automatically escaped inside <gap:untrusted> envelopes (SEC-080).

Lesson 2: Two-Person Cedar Authorization Rules (INV-04, INV-11)

In GAP, access control is never left to LLM judgment (INV-04). Cedar evaluates deterministically over (principal, action, resource, context) where forbid unconditionally beats permit. Look at the shipped rule in policies/default.cedar:

cedar policies/default.cedar & Validation CLI
@id("forbid-mutate-irreversible-or-unknown-unapproved")
forbid (
    principal,
    action == Action::"Mutate",
    resource
) when {
    (resource.sideEffect == "IRREVERSIBLE" || resource.sideEffect == "UNKNOWN")
        && !(context.approved && context.approverIsDifferent)
};

# Validate syntax & types offline:
./target/dist/gap policy check --dir policies
Code Challenge

Enforce Two-Person Approval in Cedar

Complete the shipped Cedar guard so a caller cannot self-approve an IRREVERSIBLE mutation:

when {
  (resource.sideEffect == "IRREVERSIBLE" || resource.sideEffect == "UNKNOWN")
    && !(context.approved && context.____)
}
Quick hints:

Key Takeaways

  • Cedar forbid rules always override any permit statement.
  • Run gap policy check --dir policies in CI before reloading policies atomically with gap policy reload.

Lesson 3: Stopping MCP Rug Pulls (DriftMonitor) & SSRF (EgressGuard)

  • Anti-Rug-Pull Pinning (SEC-082, INV-08): Before an upstream serves a modified tool description to sneak hidden prompt injections after admin review, DriftMonitor recomputes the JCS BLAKE3 desc_hash, detects mismatch, freezes the branch into BranchStatus::Drift, and continues serving only the pinned approved description.
  • Zero-Bypass SSRF Defense (SEC-075): When calling OpenAPI or webhook hosts, EgressGuard resolves DNS exactly once, blocks loopback/RFC1918/octal/hex/169.254.169.254 metadata targets, pins the verified IP socket directly against DNS rebinding, and forbids HTTP redirects.

Key Takeaways

  • DriftMonitor prevents post-approval tool description tampering from ever reaching LLM agents.
  • EgressGuard blocks DNS rebinding, private ranges, cloud metadata IPs, and redirect pivots.

Lesson 4: HTTP/3 QUIC, BLAKE3 Audit Ledger & Crash Recovery (28.86 ms)

Ready for production deployment? Enable dual-stack HTTP/2 + HTTP/3 over UDP QUIC (which measured 5,013 req/s at 2.36 ms p95 with zero errors and recovered /readyz in 28.86 ms after SIGKILL), with max_early_data_size = 0 disabling 0-RTT replay risks:

AI Host Integration via MCP 2026-07-28, A2A v1.0, AG-UI v1.0, and NGC AI Hosts & UI Claude · Cursor Antigravity AG-UI Clients HTTP/2 + HTTP/3 QUIC TLS 1.3 (0-RTT off) /graphql · /mcp /ag-ui · A2A v1.0 GAP Gateway (gap-server) Cedar · ArcSwap DataLoader · BLAKE3 5,013 req/s H3 · 28.86ms 6 NGC Connectors OpenAPI · SQL GraphQL · gRPC CLI · Code AST
AI Host Integration via MCP 2026-07-28, A2A v1.0, AG-UI v1.0, and NGC
terminal Terminal — Verify BLAKE3 Chain & Export W3C PROV-O
./target/dist/gap audit verify --nightly
./target/dist/gap audit export --format jsonld > prov-o-audit.json
Knowledge Check

Why does GAP explicitly set max_early_data_size = 0 (disabling QUIC TLS 1.3 0-RTT) across HTTP/3 listeners?

Key Takeaways

  • profile = "prod" fails closed unless explicit tls_cert_secret and tls_key_secret references are configured.
  • gap audit verify --nightly validates the tamper-evident BLAKE3 SQLite hash chain across mutations and approvals.