Repository navigation
fix(chrome-extension): reliable audio, mic and webcam start in the extension recorder - #3549
Merged
Merged
Conversation
… that it is silent
…and Brave, and add a seeded fuzz test
…stead of greying out Start
…e recorder document is listening
…vices when starting a recording
…en background tabs load the overlay
…ices and cover background tabs during a recording
…me does on Windows
…r, as a real abandoned start does
…sers that ignore seeded media grants
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Member
Author
|
hey @greptileai, please re-review the PR |
Member
Author
|
hey @greptileai, please re-review the PR |
| style={{ width: `${PANEL_WIDTH}px`, height: `${height}px` }} | ||
| > | ||
| <iframe | ||
| src={PANEL_SRC} |
There was a problem hiding this comment.
P2: Embedded recorder panel leaks its registered token to the recorded page, defeating panel clickjacking protection
New panel iframe posts its registered access token to the host window, letting the recorded page reuse it to authorize its own popup.html iframe.
Stop sending the panel token to window.parent; use chrome.runtime for size/dismiss and bind panel auth to the sender tab/frame.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name="apps/chrome-extension/src/content/overlay.tsx">
<violation number="1" location="apps/chrome-extension/src/content/overlay.tsx:447">
<priority>P2</priority>
<title>Embedded recorder panel leaks its registered token to the recorded page, defeating panel clickjacking protection</title>
<evidence>This PR adds RecorderPanelOverlay, which registers a new PANEL_TOKEN with the service worker (overlay.tsx added lines 76-78 and 99-107) and embeds chrome-extension://<id>/popup.html#PANEL_TOKEN in a page iframe (added lines 446-451). The panel page posts its token to window.parent with targetOrigin "*" on mount/resize (popup/main.tsx lines 63-74, pre-existing but now reachable). The parent window is the recorded host page, so the host page's own scripts can listen for that message and read the bearer token. They can then create their own popup.html#<stolen-token> iframe: popup/main.tsx lines 228-243 validate only that the URL-hash token is registered, so the service worker returns valid and the page renders the fully authorized recorder UI. This bypasses the anti-clickjacking check documented at popup/main.tsx lines 96-99 ("only the extension overlay can do that"). The host page cannot script the cross-origin panel, but it can position and cover its own authorized copy, using UI redress to trick the user into starting/stopping recordings or changing camera/microphone settings, including granting screen or media capture. The base checkout registered only PREVIEW_TOKEN and had no RecorderPanelOverlay or popup.html iframe, and camera-preview messages use chrome.runtime rather than window.postMessage, so no equivalent panel-token exposure existed before this PR.</evidence>
<recommendation>Do not send PANEL_TOKEN to window.parent. Either remove the token from postPanelMessage and authenticate the message by event.source === the overlay's panel iframe.contentWindow (plus the extension-origin check), or route panel size/dismiss messages through chrome.runtime like the camera preview does. Additionally bind panel authorization to the embedding tab/frame registered by the content script rather than to a bearer token that a host page can copy, and add a test showing a host-page message listener can no longer obtain a reusable panel token.</recommendation>
</violation>
</file>
This branch was successfully deployed
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.
Reliability pass on the Chrome extension recorder: audio, mic, webcam start, recorder panel and start races. Only
apps/chrome-extensionchanges.Audio
flowchart LR mic[Mic track] --> mix["AudioContext({ sinkId: { type: 'none' } })"] tab[Tab audio] --> mix mix --> rec[MediaRecorder] tab --> play["Separate playback AudioContext<br/>(tab mode only)"] --> speakers[Speakers]src/offscreen/recorder.ts,createRecordingAudioContext).echoCancellation,autoGainControl,noiseSuppressionoff) over a 1 s window, so a quiet room no longer triggers the "no sound" warning while a dead mic still does.Mic and camera acquisition
openUserMediaretries a device once after 300 ms onNotReadableError/AbortError(a camera or mic still being released by the previous tab, the mic probe or another app).NotAllowedErroris not retried.Webcam preview ownership
src/content/overlay.tsx).handlePreviewReadyignores a ready signal from a tab that is neither the owner nor the pending hand-off target, and hides its preview (src/background/service-worker.ts). Real hand-offs still go throughshowOverlayInTab.Start races and state
The message port closed before a response was received) are retried instead of failing the start.E2E
e2e/browser.tsruns every suite in Playwright Chromium or an installed Chrome, Edge or Brave (CAP_E2E_BROWSER, loaded over CDPExtensions.loadUnpacked).camera and microphone startstarts and stops webcam + mic recordings back to back (CAP_E2E_DEVICE_LOOPS) and checks a live preview, a live mic and moving, non-black camera frames in every upload.CAP_E2E_SYSTEM_DEVICESuses the OS camera and mic instead of Chromium's fake devices (a v4l2loopback camera and PulseAudio virtual mic on Linux).CAP_E2E_FUZZ,CAP_E2E_FUZZ_SEED) interleaves start, stop, pause, resume, tab switches, reloads, service worker kills and offscreen document closes, and checks the worker always answers and a final recording uploads.

Confidence Score: 5/5
The changes since the previous review appear safe to merge.Summary
This PR improves extension recording reliability and adds browser coverage for audio, microphones, cameras, and recorder controls.
Since the previous review:
The three earlier threads were manually resolved without explanatory replies. Their current changes were checked; no duplicate comments were added. None had a supplied Comment number.
No new actionable issues were found.
Reviews (3) · Last reviewed commit: "test(chrome-extension): reopen the panel..." · Reviewed by Greptile