Skip to content

fix: report the requesting frame for hid and usb permission checks - #53656

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/hid-usb-check-requesting-frame
Sep 7, 2026
Merged

MarshallOfSound merged 1 commit into
mainfrom
fix/hid-usb-check-requesting-frame

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Description of Change

Supersedes #53629 (split: this is the narrow fix; the wider per-frame device permission work is in the follow-up PR stacked on this branch).

  • ElectronHidDelegate / ElectronUsbDelegate ran the hid / usb permission check with a null frame and the origin content handed them, so session.setPermissionCheckHandler saw the top-level document's origin, no requestingUrl, isMainFrame: false and a null webContents for a check made from a subframe — while the chooser controllers already store the grant under the requesting frame's origin. Serial and media were fixed for the same thing in fix: propagate requesting frame through sync permission checks #50679.
  • Carries https://crrev.com/c/8364427 so CanRequestDevicePermission() receives the frame, keys HidService / WebUsbServiceImpl on the requesting frame's origin so grant, check and forget() agree, and passes the frame into CheckPermissionWithDetails.
  • Specs: hid / usb check from a cross-origin iframe reports the iframe's origin, URL, isMainFrame: false and the owning webContents.

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • tests are changed or added
  • relevant documentation is changed or added

Release Notes

Notes: Fixed session.setPermissionCheckHandler receiving the top-level origin and a null webContents for hid and usb checks made from a subframe.

ElectronHidDelegate and ElectronUsbDelegate ran the hid/usb permission
check with a null frame and the origin content handed them, so
session.setPermissionCheckHandler saw the top-level document's origin,
no requestingUrl, isMainFrame false and a null webContents for a check
made from a subframe, while the chooser controllers already store the
grant under the requesting frame's origin.

Carry https://crrev.com/c/8364427 so CanRequestDevicePermission()
receives the frame, key HidService/WebUsbServiceImpl on the requesting
frame's origin so grant, check and forget() agree, and pass the frame
into CheckPermissionWithDetails, matching serial and media.
@MarshallOfSound
MarshallOfSound requested a review from a team as a code owner September 7, 2026 07:22
@MarshallOfSound MarshallOfSound added semver/patch backwards-compatible bug fixes target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 7, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Sep 7, 2026
@MarshallOfSound
MarshallOfSound merged commit 922073f into main Sep 7, 2026
109 of 111 checks passed
@release-clerk

release-clerk Bot commented Sep 7, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed session.setPermissionCheckHandler receiving the top-level origin and a null webContents for hid and usb checks made from a subframe.

@MarshallOfSound
MarshallOfSound deleted the fix/hid-usb-check-requesting-frame branch September 7, 2026 15:45
@github-actions github-actions Bot added the 46-x-y label Sep 7, 2026
@trop

trop Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #53679

@trop trop Bot added the in-flight/45-x-y label Sep 7, 2026
@trop

trop Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #53680

@trop trop Bot added in-flight/44-x-y and removed target/45-x-y PR should also be added to the "45-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Sep 7, 2026
@trop

trop Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "44-x-y", please check out #53688

@trop

trop Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "43-x-y", please check out #53689

MarshallOfSound added a commit that referenced this pull request Sep 7, 2026
…53656)

ElectronHidDelegate and ElectronUsbDelegate ran the hid/usb permission
check with a null frame and the origin content handed them, so
session.setPermissionCheckHandler saw the top-level document's origin,
no requestingUrl, isMainFrame false and a null webContents for a check
made from a subframe, while the chooser controllers already store the
grant under the requesting frame's origin.

Carry https://crrev.com/c/8364427 so CanRequestDevicePermission()
receives the frame, key HidService/WebUsbServiceImpl on the requesting
frame's origin so grant, check and forget() agree, and pass the frame
into CheckPermissionWithDetails, matching serial and media.

(cherry picked from commit 922073f)
@trop trop Bot added merged/45-x-y PR was merged to the "45-x-y" branch. and removed in-flight/45-x-y labels Sep 7, 2026
MarshallOfSound added a commit that referenced this pull request Sep 7, 2026
…4-x-y) (#53688)

fix: report the requesting frame for hid and usb permission checks (#53656)

ElectronHidDelegate and ElectronUsbDelegate ran the hid/usb permission
check with a null frame and the origin content handed them, so
session.setPermissionCheckHandler saw the top-level document's origin,
no requestingUrl, isMainFrame false and a null webContents for a check
made from a subframe, while the chooser controllers already store the
grant under the requesting frame's origin.

Carry https://crrev.com/c/8364427 so CanRequestDevicePermission()
receives the frame, key HidService/WebUsbServiceImpl on the requesting
frame's origin so grant, check and forget() agree, and pass the frame
into CheckPermissionWithDetails, matching serial and media.

(cherry picked from commit 922073f)
@trop trop Bot added the merged/44-x-y PR was merged to the "44-x-y" branch. label Sep 7, 2026
MarshallOfSound added a commit that referenced this pull request Sep 7, 2026
…3-x-y) (#53689)

fix: report the requesting frame for hid and usb permission checks (#53656)

ElectronHidDelegate and ElectronUsbDelegate ran the hid/usb permission
check with a null frame and the origin content handed them, so
session.setPermissionCheckHandler saw the top-level document's origin,
no requestingUrl, isMainFrame false and a null webContents for a check
made from a subframe, while the chooser controllers already store the
grant under the requesting frame's origin.

Carry https://crrev.com/c/8364427 so CanRequestDevicePermission()
receives the frame, key HidService/WebUsbServiceImpl on the requesting
frame's origin so grant, check and forget() agree, and pass the frame
into CheckPermissionWithDetails, matching serial and media.

(cherry picked from commit 922073f)
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. and removed in-flight/43-x-y labels Sep 7, 2026
@claude claude Bot added the target/42-x-y PR should also be added to the "42-x-y" branch. label Sep 8, 2026
@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

/trop run backport-to 42-x-y


Generated by Claude Code

@trop

trop Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@claude[bot] is not authorized to run PR backports.

@trop

trop Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

claude[bot] has manually backported this PR to "42-x-y", please check out #53736

@trop trop Bot added in-flight/42-x-y and removed target/42-x-y PR should also be added to the "42-x-y" branch. labels Sep 8, 2026
VerteDinde pushed a commit that referenced this pull request Sep 8, 2026
…2-x-y) (#53736)

fix: report the requesting frame for hid and usb permission checks (#53656)

ElectronHidDelegate and ElectronUsbDelegate ran the hid/usb permission
check with a null frame and the origin content handed them, so
session.setPermissionCheckHandler saw the top-level document's origin,
no requestingUrl, isMainFrame false and a null webContents for a check
made from a subframe, while the chooser controllers already store the
grant under the requesting frame's origin.

Carry https://crrev.com/c/8364427 so CanRequestDevicePermission()
receives the frame, key HidService/WebUsbServiceImpl on the requesting
frame's origin so grant, check and forget() agree, and pass the frame
into CheckPermissionWithDetails, matching serial and media.

(cherry picked from commit 922073f)


Claude-Session: https://claude.ai/code/session_019JGAgvVW15dvnn2Z4H6zDg

Co-authored-by: Samuel Attard <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants