-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix: add usb permission to ledger iframe allow attribute #39082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
I have read the CLA Document and I hereby sign the CLA |
Builds ready [01c321c]
UI Startup Metrics (1311 ± 110 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [c3c36b8]
UI Startup Metrics (1291 ± 112 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Gudahtt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
dawnseeker8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Adds usb to the iframe permissions policy for the Ledger bridge iframe.
The Ledger iframe bridge (ledger-iframe-bridge) bundles both @ledgerhq/hw-transport-webhid and @ledgerhq/hw-transport-webusb. When certain code paths touch WebUSB APIs (e.g., during device enumeration, transport reconnection, or EIP-712 signing fallback), it fails with:
"Failed to execute 'getDevices' on 'USB': Access to the feature 'usb' is disallowed by permissions policy"
This commonly manifests during the internal MetaMask swap & bridge transactions.
The fix adds usb to the existing hid permission on the iframe's allow attribute.
Changelog
CHANGELOG entry: Fixed Ledger hardware wallet connection failures during swap transactions
Related issues
Fixes: #36513
Manual testing steps
Screenshots/Recordings
Before
NOTWORKINGSWAP.mov
After
WORKINGSWAP.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Allows the Ledger iframe to access WebUSB by expanding its permissions policy.
app/offscreen/ledger.tsto setiframe.allowtohid; usbforhttps://metamask.github.io/ledger-iframe-bridge/9.0.1/, preventing "usb disallowed by permissions policy" errors during device interactionsWritten by Cursor Bugbot for commit c3c36b8. This will update automatically on new commits. Configure here.