Skip to content

fix: use requesting frame origin in permission helper and device choosers#50148

Merged
VerteDinde merged 2 commits into41-x-yfrom
trop/41-x-y-bp-fix-use-requesting-frame-origin-in-permission-helper-and-device-choosers-1773073231713
Mar 9, 2026
Merged

fix: use requesting frame origin in permission helper and device choosers#50148
VerteDinde merged 2 commits into41-x-yfrom
trop/41-x-y-bp-fix-use-requesting-frame-origin-in-permission-helper-and-device-choosers-1773073231713

Conversation

@trop
Copy link
Copy Markdown
Contributor

@trop trop bot commented Mar 9, 2026

Backport of #50052

See that PR for details.

Notes: Fixed an issue where permission and device-chooser handlers received the top-level page origin instead of the requesting subframe's origin.

trop bot and others added 2 commits March 9, 2026 16:20
…ions

`WebContentsPermissionHelper::RequestPermission` passes
`web_contents_->GetLastCommittedURL()` as the origin to the permission
manager instead of the actual requesting frame's origin. This enables
origin confusion when granting permissions to embedded third-party iframes,
since app permission handlers see the top-level origin instead of the
iframe's. The same pattern exists in the HID, USB, and Serial device
choosers, where grants are keyed to the primary main frame's origin rather
than the requesting frame's.

Fix this by using `requesting_frame->GetLastCommittedOrigin()` in all
affected code paths, renaming `details.requestingUrl` to
`details.requestingOrigin`, and populating it with the serialized
origin only.

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
The previous commit changed the details.requestingUrl field to
details.requestingOrigin in permission request/check handlers. That
field was already populated from the requesting frame's RFH, so the
rename was unnecessary and would break apps that read the existing
property. Revert to requestingUrl to preserve the existing API shape.

The functional changes to use the requesting frame in
WebContentsPermissionHelper and the HID/USB/Serial choosers remain.

Co-authored-by: Samuel Attard <sattard@anthropic.com>
@trop trop bot requested review from a team and codebytere March 9, 2026 16:20
@trop trop bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 9, 2026
@VerteDinde VerteDinde merged commit 15dd5dc into 41-x-y Mar 9, 2026
66 of 67 checks passed
@VerteDinde VerteDinde deleted the trop/41-x-y-bp-fix-use-requesting-frame-origin-in-permission-helper-and-device-choosers-1773073231713 branch March 9, 2026 22:59
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 9, 2026

Release Notes Persisted

Fixed an issue where permission and device-chooser handlers received the top-level page origin instead of the requesting subframe's origin.

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

Labels

41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant