Fix cross-origin-frame-redact watcher missing top-level iframes#140
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The watcher's onSubtrees handed each added subtree root to scan(), which
calls querySelectorAll('iframe') on it. querySelectorAll matches
descendants only, so a bare cross-origin <iframe> appended directly to
document.body slipped past the watcher (the iframe itself is the root,
and it has no iframe descendants).
Mirror the workaround already documented in selector-hide-rule.ts: drop
the per-root loop and rescan from document.body on every batch. The
is-connected / is-revealed checks in scan() keep it idempotent, and the
watcher's throttle coalesces bursts.
Add a regression test that appends a bare iframe directly to body.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ec081a3 to
ef33206
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onSubtreeshanded each added subtree root toscan(), which callsroot.querySelectorAll("iframe").querySelectorAllmatches descendants only, so a bare cross-origin<iframe>appended directly todocument.bodyslipped past the watcher (the iframe itself is the root, and it has no iframe descendants).selector-hide-rule.ts:148-163: drop the per-root loop and rescan fromdocument.bodyon every batch. The is-connected / is-revealed checks inscan()keep it idempotent and the watcher's throttle coalesces bursts.body.Test plan
replaces a bare cross-origin iframe appended directly to body)cross-origin-frame-redact.test.tspassbun run preflightpasses🤖 Generated with Claude Code