Hawser Narrowed MessagePort
Open · allow: read
Prototype-locked step(), strict path allowlist, AbortSignal forwarding, and instant port.close() revocation.
Waiting for 3P frame action…
Dual-Origin Sandbox Lab · CSP, Sandbox Flags, CSPEE, Connection-Allowlist & MessagePort Bridges
Running untrusted HTML, generated code, or third-party widgets inside a browser tab requires separating them from your site's storage and stopping silent network leaks. This studio runs across two real web origins so you can test <iframe sandbox> flags, Content Security Policy (CSP), single vs. double-nested iframes, CSP Embedded Enforcement (CSPEE), Connection-Allowlist, narrowed MessagePort bridges, and four Web Worker setups against a live Cloudflare Durable Object server collector.
Debates over browser sandboxing often rely on guesses about double iframes, <meta> CSP tags, <iframe csp>, and blob: Workers. Even client APIs like sendBeacon() can return true when CSP actually blocked the request—so real containment needs a second origin and a server-side check.
Safe plugin hosts, untrusted HTML previews, and AI-generated UI panels running directly in the browser: choose a faster single cross-origin frame when you control the headers, a double-iframe buffer for uncontrolled third-party content, and a revocable MessagePort that exposes only allowlisted methods.
Pick one of the six presets in Tab 1 (or customize flags and headers), then click Run Active Preset in 14-Vector Harness. The test mounts live frames on a separate companion origin and verifies zero hits on the Durable Object canary, then compares three cross-origin messaging bridges and four Worker setups.
src/worker.tscsp-iframe-sandbox-studio.kinlan-test.workers.dev
/probe/frame, and locked HTTP WorkersMessagePort handles (hawser-bridge.js)src/buffer-worker.tscsp-sandbox-buffer-origin.kinlan-test.workers.dev
/buffer: Serves HTTP CSP + Connection-Allowlist: () in single, double, bridge, or worker mode/uncontrolled-3p: Omits CSP headers to test Chrome <iframe csp> enforcement/buffer-worker.js: Runs an isolated cross-origin Web Worker with no access to Host storageReporting-Endpoints -> /reports/:runId
Blocked requests send CSP reports to ContainmentTelemetry while zero traffic reaches /api/canary/*.
SQLite DO -> /api/canary/:runId/:vector
Logs the exact leak channel (fetch, image, WebSocket, subframe), HTTP method, origin, and timestamp.
Cache-Control: no-cache, X-Content-Type-Options: nosniff, explicit frame-ancestors, and zero X-Frame-Options.
Click any preset to compare single-frame HTTP CSP, double-iframe nesting, <meta> CSP tampering, and <iframe csp>—then run all 14 live leak probes in Tab 2.
blob: Worker inherits page storage while an opaque or cross-origin Worker blocks it.sandbox FlagsConfigure framing depth, delivery mechanism, and all 9 HTML sandbox tokens.
Compiles directly into live Cloudflare Worker response headers for /probe/frame and /buffer.
Exact headers emitted by the target Cloudflare Worker and exact embedder attributes.
Mounts your selected preset on a live frame and fires 14 network, subframe, storage, and DOM breakout probes against the server canary collector.
| # | Vector | Client Result | DO Canary | Verdict |
|---|
Click Run All 14 Vectors to mount and execute the active topology.
{}
hawser.js)
A live cross-origin iframe receives three messaging channels to a host DemoVault: a narrowed Hawser MessagePort (allowing only read/slowRead, blocking prototype walks, and revocable on click), an Unfiltered Proxy, and raw window.postMessage.
MessagePortPrototype-locked step(), strict path allowlist, AbortSignal forwarding, and instant port.close() revocation.
Waiting for 3P frame action…
MessagePort ProxyNaive proxy traversing the full prototype chain with no FORBIDDEN key check and no method narrowing.
Waiting for 3P frame action…
window.postMessageAd-hoc window message handler with no per-capability handle, no automatic revocation, and no cancellation signal.
Waiting for 3P frame action…
csp-sandbox-buffer-origin/buffer?mode=bridge)DemoVault Live State{}
When a single distinct-origin iframe with HTTP CSP + Hawser suffices, and when the double-iframe cost is still justified.
| Requirement | Single Cross-Origin Frame + HTTP CSP + Hawser | Double-Iframe Cross-Origin Buffer |
|---|---|---|
| You control the sandbox origin HTTP headers | Recommended (1 DOM) — enforce frame-src 'none', connect-src 'none', Connection-Allowlist: () |
Adds extra DOM + mount latency without adding network guarantees beyond HTTP headers |
| Embedding uncontrolled third-party URLs across Chrome, Firefox, Safari | Partial (CSPEE Blink-only) — Gecko and WebKit ignore <iframe csp> |
Required — outer buffer origin isolates shim, enforces framing boundary, and mediates messages |
Untrusted HTML rendered via srcdoc + custom bootstrap JS |
Risk of untrusted markup colliding with bootstrap script or <meta> CSP ordering |
Safer separation — outer buffer runs trusted shim; inner opaque frame renders untrusted markup |
| Narrowed, revocable API calls back to 1P host | Hawser MessagePort — single hop, prototype-locked, instant port.close() |
Hawser port can be transferred straight through the buffer into the inner frame (1-hop post-handshake) |
| DOM / memory overhead & mount latency | Lower (1 browsing context, single layout & JS realm) | Higher (2 browsing contexts; measured live in Tab 2 latency benchmark) |
Tests whether fetch(), WebSocket, indexedDB, OPFS, BroadcastChannel, and importScripts() work or get blocked across four different Worker launch patterns.
| Topology | self.origin |
fetch() |
WebSocket |
indexedDB |
OPFS |
BroadcastChannel |
importScripts() |
|---|
{}
allow-scripts with allow-same-origin on your own origin).frame-src), images, and network requests a document or Web Worker may perform.<iframe csp="..."> attribute that asks an embedded third-party page to agree to a minimum CSP before the browser renders it.port.close().