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 andallow-scripts allow-same-originiframes 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.
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-Allowlistin current builds? - Can declassification rules in
WeakSet/Proxytaint tracking stay ergonomic without blocking legitimate user-triggered exports?
Iteration log
- — Deployed 7-tier containment suite with Durable Object
CanarySession, WICGConnection-Allowlistbuilder, and top-of-page code blueprint. - — Hardened host CSP (
frame-ancestors+no-cachestatic 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.