You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
replay guard: a contextual unblockSelector is dropped (the guard tests a detached copy of the iframe) #123
Found in round 2 of the review of #122. Not a privacy leak (the guard errs towards removing); it drops content the recorder deliberately records and reports a violation.
Problem
blockedByRules in packages/replay/src/iframe-guard.ts tests the caller's unblockSelector against a detached copy of the iframe built from its serialized attributes. A contextual selector can never match a detached element: #trusted iframe, .x > iframe, :first-child, :nth-child(...), body iframe. The recorder evaluates the same selector on the live element, so it records such an iframe and its attached document; the guard classifies the iframe as blocked (the default iframe block selector matches), removes the attached document and reports a violation.
Value selectors (iframe[data-embed="x"], .bugsee-show) are unaffected.
Repro
replay: { unblockSelector: '#trusted iframe' } (or via resolveReplayMaskingOptions), page with <div id="trusted"><iframe src="/same-origin.html"></iframe></div>.
Record. The recorder emits the iframe's attached document. The guard drops the isAttachIframe mutation and calls onError ("a document was attached to a blocked iframe ...").
Replay shows an empty iframe although the app opted it in.
Candidate e2e: add a scenario to packages/instrumentation-tests/test/replay-masking.browser.e2e.ts (raw and provider mode): contextual unblockSelector, assert the iframe content is present in both modes.
Suggested fix (test-first)
Unit tests in iframe-guard.test.ts: a contextual unblockSelector (with a combinator or structural pseudo-class) must not make the guard drop an iframe the recorder records.
Options: (a) detect selectors with combinators/structural pseudo-classes in blockedByRules and trust the recorder for them (treat the iframe as unblocked when it carries no rr_width/rr_height marker), or (b) warn through onError at resolve time that such a selector is not supported by the guard and fall back to a documented behaviour. (a) keeps the guard's fail-closed stance for every selector it can evaluate.
Activity
docs(replay): state the guard's contextual-selector and once-per-sess…
fix(replay,rrweb): blocked same-origin iframes are placeholders only (#…
fix(replay): ignore CSS escapes in contextual-selector detection, tig…
test(replay): cover no-space combinators, align guard header docs (#123)
fix(replay): CSS-only whitespace in contextual detection, e2e negativ…
test(replay): write the U+00A0 cases without invisible literals (#123)
test(replay): write the U+00A0 cases without invisible literals (#123)
fix(replay): trust the recorder for a contextual unblockSelector in t…
fix(replay): close an open iframe re-added blocked; pin the moved-int…
test(replay): pin that the unmarked re-add is silent; trim header (#123…