Skip to content

rrweb fork: add tests for masking options on re-observed shadow/iframe paths #119

Open

Description

@krassx

Follow-up from the Opus review of PR #117 (rrweb 2.2.0 upgrade). The new packages/rrweb/test/record/masking-observer-lifecycle.test.ts in the fork (bugsee-port-2.2.0, cdb77793) only covers part of the 2.2.0 re-observation paths. Mutation testing in the review found these surviving mutants:

  • Shadow-root observer: maskAttributeFn, blockSelector, unblockSelector dropped from the shadow bypassOptions.
  • Iframe observer: maskAttributeFn, ignoreSelector dropped.
  • Iframe "observe once" dedup removed: the test title promises "observed once" but nothing counts observers.
  • IMPORTANT: maskAllText turned off only for an iframe document that is re-observed after it unloads (navigation, removal, document.open) leaks IF_SECRET_EDIT2 / IF_SECRET_READDED / IF_SECRET_WRITTEN in Chromium and survives all 61 jsdom record tests. The 2.2.0 unload-then-re-observe path (iframe-manager.ts watchIframeWindow pagehide -> unloadListener -> observe(doc) again) is untested.

To do (fork, test-first, mutator loop):

  1. Add tests for each option above on the shadow-root and iframe re-observed paths, and make the dedup test count observers/events.
  2. Cover iframe unload then re-observe (navigate, remove and re-add, document.open). jsdom does not fire the needed lifecycle, so this likely needs a real-browser test (puppeteer in the fork, or the SDK Playwright test in the companion issue).
  3. Keep the secret-in-events assertion non-vacuous (assert the masked form is present).

Related: the same-origin blocked-iframe leak issue (separate, HIGH).

🤖 Generated with Claude Code

Activity

  1. krassx commented on Nov 12, 2026

    @krassx
    ContributorAuthor

    Triage (agent): this issue targets test files inside the rrweb fork (packages/rrweb/test/record/masking-observer-lifecycle.test.ts on bugsee-port-*), which are not in this repo. Current main (c7f7f12, #200) only carries packages/rrweb/src/{index,index.test}.ts (a thin wrapper over a built fork artifact), and no masking-observer-lifecycle test exists here. Main has also moved to rrweb 2.2.2 (bugsee-port-2.2.2), so the work should be done against that fork branch (jsdom tests for the shadow/iframe option cases and the dedup counter; a real-browser puppeteer test for iframe unload then re-observe, including the IMPORTANT maskAllText leak). The only SDK-side option is the Playwright companion test, which needs an owner decision. No PR opened.

    🤖 Generated with Claude Code and https://claude.ai/code/session_01WeiJxSd4XxSkeZk5vaw6dX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions