Allow nested iframe proxy documents - #541
Conversation
Deploying mouseterm with
|
| 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 |
dormouse-bot
left a comment
There was a problem hiding this comment.
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.
dormouse-bot
left a comment
There was a problem hiding this comment.
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.
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.