Skip to content

fix(web-extension): prevent cross-origin recording leaks - #1936

Draft
Juice10 wants to merge 1 commit into
mainfrom
codex/fix-cross-origin-iframe-recording-vulnerability
Draft

Juice10 wants to merge 1 commit into
mainfrom
codex/fix-cross-origin-iframe-recording-vulnerability

Conversation

@Juice10

@Juice10 Juice10 commented Sep 8, 2026

Copy link
Copy Markdown
Member

Motivation

  • The web-extension injected recorders into every frame and enabled recordCrossOriginIframes, causing cross-origin iframe snapshots and events to be posted to window.parent where any script in the embedding page could observe them.
  • The change aims to stop cross-origin frames from independently starting recorders and to avoid rrweb's page-visible cross-origin forwarding so sensitive cross-origin DOM and input data are not exposed to untrusted parent pages.

Description

  • In packages/web-extension/src/content/index.ts the StartRecord message now sets recordCrossOriginIframes: false so the injected page-context recorder will not enable rrweb's cross-origin parent forwarding.
  • Recorder initialization was restricted to the top-level document by removing the cross-origin iframe initialization path and only calling initMainPage() when window === window.top, preventing cross-origin frames from reacting directly to the extension-wide recorder state.
  • The top-level start/stop flows and the extension channel event collection were preserved so normal top-level and same-origin iframe recording behavior remains unchanged.
  • Removed the cross-origin initialization code path and the now-unused helper import, keeping the fix localized to packages/web-extension/src/content/index.ts.

Testing

  • yarn prettier --check packages/web-extension/src/content/index.ts passed.
  • ESLINT_USE_FLAT_CONFIG=false yarn eslint packages/web-extension/src/content/index.ts passed.
  • A static Node assertion verified the file contains recordCrossOriginIframes: false and that initialization is limited to the top-level document (assertion succeeded).
  • yarn workspace @rrweb/web-extension check-types and yarn workspace @rrweb/web-extension build:chrome were attempted but blocked by a pre-existing unresolved rrweb-player workspace package, which is unrelated to this security fix.

Codex Task

@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 893e3b2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-08T14:58:43.780421Z 893e3b2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Changes

Size change: -3.28 kB (-0.03%) | Total size: 10425.75 kB

all - 1975.72 kB -> 1975.29 kB (-448 B (-0.02%))
File Base PR Diff
all.cjs 567.91 kB 567.77 kB -137 B (-0.02%)
all.js 567.58 kB 567.44 kB -137 B (-0.02%)
all.umd.cjs 571.12 kB 570.98 kB -137 B (-0.02%)
all.umd.min.cjs 269.12 kB 269.08 kB -37 B (-0.01%)
browser-client - 670.07 kB -> 669.93 kB (-140 B (-0.02%))
File Base PR Diff
browser-client.cjs 192.15 kB 192.10 kB -52 B (-0.03%)
browser-client.js 191.92 kB 191.87 kB -52 B (-0.03%)
browser-client.umd.cjs 194.97 kB 194.92 kB -52 B (-0.03%)
browser-client.umd.min.cjs 91.03 kB 91.05 kB +16 B (+0.02%)
plugins - 187.41 kB -> 186.32 kB (-1.09 kB (-0.58%))
File Base PR Diff
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.cjs 36.99 kB 36.71 kB -287 B (-0.76%)
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.js 36.85 kB 36.57 kB -287 B (-0.76%)
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.cjs 38.04 kB 37.76 kB -287 B (-0.74%)
packages/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.min.cjs 22.51 kB 22.33 kB -187 B (-0.81%)
packages/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.cjs 14.74 kB 14.72 kB -20 B (-0.13%)
packages/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.js 14.62 kB 14.60 kB -20 B (-0.13%)
packages/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.cjs 15.79 kB 15.77 kB -20 B (-0.12%)
packages/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.min.cjs 7.87 kB 7.87 kB -7 B (-0.09%)
record - 552.68 kB -> 552.55 kB (-140 B (-0.02%))
File Base PR Diff
record.cjs 158.46 kB 158.41 kB -52 B (-0.03%)
record.js 158.38 kB 158.32 kB -52 B (-0.03%)
record.umd.cjs 159.79 kB 159.74 kB -52 B (-0.03%)
record.umd.min.cjs 76.05 kB 76.07 kB +16 B (+0.02%)
replay - 1407.39 kB -> 1407.09 kB (-308 B (-0.02%))
File Base PR Diff
replay.cjs 403.92 kB 403.83 kB -85 B (-0.02%)
replay.js 403.83 kB 403.74 kB -85 B (-0.02%)
replay.umd.cjs 406.90 kB 406.82 kB -85 B (-0.02%)
replay.umd.min.cjs 192.75 kB 192.70 kB -53 B (-0.03%)
rrweb - 1913.90 kB -> 1913.47 kB (-448 B (-0.02%))
File Base PR Diff
rrweb.cjs 551.07 kB 550.94 kB -137 B (-0.02%)
rrweb.js 550.77 kB 550.64 kB -137 B (-0.02%)
rrweb.umd.cjs 552.29 kB 552.15 kB -137 B (-0.02%)
rrweb.umd.min.cjs 259.77 kB 259.74 kB -37 B (-0.01%)
rrweb-player - 1644.16 kB -> 1643.86 kB (-301 B (-0.02%))
File Base PR Diff
rrweb-player.cjs 473.44 kB 473.36 kB -83 B (-0.02%)
rrweb-player.js 473.32 kB 473.24 kB -83 B (-0.02%)
rrweb-player.umd.cjs 476.24 kB 476.16 kB -83 B (-0.02%)
rrweb-player.umd.min.cjs 221.15 kB 221.10 kB -52 B (-0.02%)
rrweb-snapshot - 610.02 kB -> 609.57 kB (-463 B (-0.07%))
File Base PR Diff
rrweb-snapshot.cjs 175.14 kB 175.01 kB -131 B (-0.07%)
rrweb-snapshot.js 174.20 kB 174.07 kB -131 B (-0.07%)
rrweb-snapshot.umd.cjs 177.61 kB 177.48 kB -131 B (-0.07%)
rrweb-snapshot.umd.min.cjs 83.07 kB 83.00 kB -70 B (-0.08%)

@eoghanmurray

Copy link
Copy Markdown
Collaborator

So I imagine original idea with extension was to take advantage of visibility/access into all frames, and stitch everything together into a cohesive single recording. Does this change make it so that each frame will now emit an independent recording?

@Juice10
Juice10 marked this pull request as draft September 10, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants