AI Focus

agent containment lab

The browser Same-Origin Policy keeps different websites separate, not untrusted text pulled into your own page or agent loop. When injected text runs script or triggers network fetches in a first-party context, standard origin isolation stops nothing. This lab benchmarks which concrete browser boundaries (sandboxed iframes, strict CSP, Web Workers, Chrome Connection-Allowlist headers, Proxy/WeakSet taint tracking, and zero-egress enclaves) actually halt data exfiltration against a real Durable Object canary collector.

Hypothesis

Opaque sandbox iframes paired with HTTP egress locks (Connection-Allowlist / strict CSP) or explicit taint tracking block exfiltration from untrusted text, whereas standard Same-Origin Policy and allow-scripts allow-same-origin iframes fail completely.

What confirms it: All simulated exfiltration channels (fetch, sendBeacon, <img>, CSS url(), WebRTC ICE, 302 redirects) record zero hits on the Durable Object CanarySession under strict tiers.

What falsifies or bounds it: A DNS prefetch, WebRTC candidate, CSS fetch, or misconfigured sandbox combination delivers a canary token to the collector despite an active containment tier.

Seven-tier containment conformance suite including WICG Connection-Allowlist firewall tiers backed by a Cloudflare SQLite Durable Object collector, Canvas-style taint runtime, and sealed enclave. Open agent containment lab full screen ↗

What this lab tests

When untrusted web text enters an agent loop running in the browser, Same-Origin Policy does not block first-party exfiltration channels such as fetch(), navigator.sendBeacon(), <img src>, stylesheets, or WebSockets. Combining allow-scripts and allow-same-origin on a same-origin <iframe sandbox> lets embedded scripts inspect parent.document and parent.localStorage.

Agent Containment Lab (GitHub) executes live probes (including 302 redirects and WebRTC ICE candidates) across 7 containment tiers backed by a Cloudflare SQLite Durable Object collector (CanarySession), adds a dedicated WICG Connection-Allowlist policy builder (() empty list, (response-origin), URLPattern, Connection-Allowlist-Report-Only, redirects=allow, ReportingObserver), and pairs it with a WeakSet + Proxy taint engine and a dual-locked enclave.

Open questions

  • Which indirect exfiltration paths (navigation links, form GET submits, prefetch hints) still bypass Connection-Allowlist in current builds?
  • Can declassification rules in WeakSet/Proxy taint tracking stay ergonomic without blocking legitimate user-triggered exports?

Iteration log

  • — Deployed 7-tier containment suite with Durable Object CanarySession, WICG Connection-Allowlist builder, and top-of-page code blueprint.
  • — Hardened host CSP (frame-ancestors + no-cache static routing), moved interactive containment tabs above the setup blueprint for 700px embeds, and added pure-DOM syntax highlighting with 20 passing checks.

Primitives tested: <iframe sandbox>, CSP Level 3, Connection-Allowlist, Reporting-Endpoints, ReportingObserver, Worker, WeakSet, Proxy, Durable Object SQLite.

This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.

More in browser containment & sandbox boundaries

Connected labs

← browser containment & sandbox boundaries · All labs