Skip to content

Allow nested iframe proxy documents - #541

Merged
nedtwigg merged 3 commits into
mainfrom
fix/iframe-nested-frame-csp
Sep 4, 2026
Merged

Allow nested iframe proxy documents#541
nedtwigg merged 3 commits into
mainfrom
fix/iframe-nested-frame-csp

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary: permit same-grant nested iframe documents by adding the CSP self source alongside the validated app ancestor chain; update the browser/security contracts and nightly audit prompt; pin Tauri and VS Code policies in proxy tests. Testing: dormouse-lib test (145 files, 2166 tests), focused iframe-proxy tests (42 tests), loopback lint, standalone sidecar bundle.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: adb8ae7
Status: ✅  Deploy successful!
Preview URL: https://a738c14f.mouseterm.pages.dev
Branch Preview URL: https://fix-iframe-nested-frame-csp.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'self' relaxation itself holds up: frame-ancestors is checked against every ancestor, so a foreign page anywhere in the chain still fails, and every document 'self' admits is same-origin with the framed one — one grant, one origin, one fixed upstream — so it gains nothing it couldn't already reach by same-origin fetch. The no-chain path is unchanged (normalizeEmbedderOrigins rejects an empty array, so frameAncestorsCsp is never called with one).

One consequence of the nesting this enables, in the inline comment: the shim inside a nested document has no delivery path back to the Wall.

Comment thread lib/src/host/iframe-proxy-rewrite.ts

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relay itself holds up: the e.origin!==location.origin gate plus the reconstruct-from-four-shapes switch means a cross-origin child, a different grant (different port, different origin), and an unregistered kind all stop at the child frame, and send()'s two targets can only ever match one window. Deep nests collapse to one delivered message per event, and a proxy page loaded top-level installs no relay at all (P===window returns first), so the 'self' top-level-framing case the rationale calls out carries no message path.

Two things, both inline. The nested location relay reports the inner document's URL as the pane's, which is the lie the click handler a few lines down goes out of its way to avoid — on the motivating Storybook case the header stops showing the Storybook URL. And security-local.md's second FAIL IF still says the shim may target only the chain's innermost origin, so the audit prompt this PR extends would read the shipped two-target send() as a violation.

Comment thread lib/src/host/iframe-proxy-rewrite.ts Outdated
Comment thread docs/specs/security-local.md Outdated
Comment thread docs/specs/dor-browser.md Outdated
@nedtwigg
nedtwigg merged commit 90d18d4 into main Sep 4, 2026
25 checks passed
@nedtwigg
nedtwigg deleted the fix/iframe-nested-frame-csp branch September 4, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants