Repository navigation
fix: propagate requesting frame through sync permission checks - #50679
Merged
Merged
Conversation
WebContentsPermissionHelper::CheckPermission was hardcoding GetPrimaryMainFrame() and deriving the requesting origin from web_contents_->GetLastCommittedURL(), so the setPermissionCheckHandler callback always received the top frame's origin and details.isMainFrame/details.requestingUrl always reflected the main frame, even when a cross-origin subframe with allow="serial" or allow="camera; microphone" triggered the check. Thread the requesting RenderFrameHost through CheckPermission, CheckSerialAccessPermission, and CheckMediaAccessPermission so the permission manager receives the real requesting frame. Update the serial delegate and WebContents::CheckMediaAccessPermission callers to pass the frame they already have. Adds a regression test that loads a cross-origin iframe with allow="camera; microphone", calls enumerateDevices() from within the iframe, and asserts the permission check handler receives the iframe origin for requestingOrigin, isMainFrame, and requestingUrl.
ckerr
approved these changes
Apr 4, 2026
|
No Release Notes |
Contributor
|
I was unable to backport this PR to "39-x-y" cleanly; |
Contributor
|
I was unable to backport this PR to "40-x-y" cleanly; |
Contributor
|
I have automatically backported this PR to "42-x-y", please check out #50686 |
Contributor
|
I have automatically backported this PR to "41-x-y", please check out #50687 |
MarshallOfSound
added a commit
that referenced
this pull request
Apr 6, 2026
WebContentsPermissionHelper::CheckPermission was hardcoding GetPrimaryMainFrame() and deriving the requesting origin from web_contents_->GetLastCommittedURL(), so the setPermissionCheckHandler callback always received the top frame's origin and details.isMainFrame/details.requestingUrl always reflected the main frame, even when a cross-origin subframe with allow="serial" or allow="camera; microphone" triggered the check. Thread the requesting RenderFrameHost through CheckPermission, CheckSerialAccessPermission, and CheckMediaAccessPermission so the permission manager receives the real requesting frame. Update the serial delegate and WebContents::CheckMediaAccessPermission callers to pass the frame they already have. Adds a regression test that loads a cross-origin iframe with allow="camera; microphone", calls enumerateDevices() from within the iframe, and asserts the permission check handler receives the iframe origin for requestingOrigin, isMainFrame, and requestingUrl.
Contributor
|
@MarshallOfSound has manually backported this PR to "39-x-y", please check out #50714 |
MarshallOfSound
added a commit
that referenced
this pull request
Apr 6, 2026
WebContentsPermissionHelper::CheckPermission was hardcoding GetPrimaryMainFrame() and deriving the requesting origin from web_contents_->GetLastCommittedURL(), so the setPermissionCheckHandler callback always received the top frame's origin and details.isMainFrame/details.requestingUrl always reflected the main frame, even when a cross-origin subframe with allow="serial" or allow="camera; microphone" triggered the check. Thread the requesting RenderFrameHost through CheckPermission, CheckSerialAccessPermission, and CheckMediaAccessPermission so the permission manager receives the real requesting frame. Update the serial delegate and WebContents::CheckMediaAccessPermission callers to pass the frame they already have. Adds a regression test that loads a cross-origin iframe with allow="camera; microphone", calls enumerateDevices() from within the iframe, and asserts the permission check handler receives the iframe origin for requestingOrigin, isMainFrame, and requestingUrl.
Contributor
|
@MarshallOfSound has manually backported this PR to "40-x-y", please check out #50719 |
jkleinsc
pushed a commit
that referenced
this pull request
Apr 6, 2026
fix: propagate requesting frame through sync permission checks (#50679) WebContentsPermissionHelper::CheckPermission was hardcoding GetPrimaryMainFrame() and deriving the requesting origin from web_contents_->GetLastCommittedURL(), so the setPermissionCheckHandler callback always received the top frame's origin and details.isMainFrame/details.requestingUrl always reflected the main frame, even when a cross-origin subframe with allow="serial" or allow="camera; microphone" triggered the check. Thread the requesting RenderFrameHost through CheckPermission, CheckSerialAccessPermission, and CheckMediaAccessPermission so the permission manager receives the real requesting frame. Update the serial delegate and WebContents::CheckMediaAccessPermission callers to pass the frame they already have. Adds a regression test that loads a cross-origin iframe with allow="camera; microphone", calls enumerateDevices() from within the iframe, and asserts the permission check handler receives the iframe origin for requestingOrigin, isMainFrame, and requestingUrl.
jkleinsc
pushed a commit
that referenced
this pull request
Apr 6, 2026
fix: propagate requesting frame through sync permission checks (#50679) WebContentsPermissionHelper::CheckPermission was hardcoding GetPrimaryMainFrame() and deriving the requesting origin from web_contents_->GetLastCommittedURL(), so the setPermissionCheckHandler callback always received the top frame's origin and details.isMainFrame/details.requestingUrl always reflected the main frame, even when a cross-origin subframe with allow="serial" or allow="camera; microphone" triggered the check. Thread the requesting RenderFrameHost through CheckPermission, CheckSerialAccessPermission, and CheckMediaAccessPermission so the permission manager receives the real requesting frame. Update the serial delegate and WebContents::CheckMediaAccessPermission callers to pass the frame they already have. Adds a regression test that loads a cross-origin iframe with allow="camera; microphone", calls enumerateDevices() from within the iframe, and asserts the permission check handler receives the iframe origin for requestingOrigin, isMainFrame, and requestingUrl.
4 tasks done
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.
Description of Change
WebContentsPermissionHelper::CheckPermissionhardcodedGetPrimaryMainFrame()and usedweb_contents_->GetLastCommittedURL(), so the two synchronous checks routed through it — Web Serial and camera/microphone — always delivered the main frame's origin tosetPermissionCheckHandler, along with wrongdetails.isMainFrame/details.requestingUrl, even when a cross-origin subframe triggered the check.Thread the requesting
RenderFrameHostthroughCheckPermissionand its two callers so the permission manager receives the real frame. Other paths (HID/USB/FSA,Permissions.query()) already pass the iframe frame directly and are untouched.Checklist
Release Notes
Notes: no-notes