Skip to content

fix: ledger fall back to blind signing when clear-sign fails#522

Merged
dawnseeker8 merged 7 commits intomainfrom
fix/ledger-mobile-blind-sign-fallback
May 6, 2026
Merged

fix: ledger fall back to blind signing when clear-sign fails#522
dawnseeker8 merged 7 commits intomainfrom
fix/ledger-mobile-blind-sign-fallback

Conversation

@dawnseeker8
Copy link
Copy Markdown
Contributor

@dawnseeker8 dawnseeker8 commented Apr 21, 2026

Mirror metamask-extension PR #41948: try clearSignTransaction first, then signTransaction(..., null) when resolution fails. Re-throw user rejection (0x6985) without fallback. Add @ledgerhq/hw-transport as a runtime dependency.


Note

Medium Risk
Changes Ledger mobile transaction-signing flow to fall back to blind signing on clearSignTransaction errors, which can affect how transactions are presented and approved on-device. Guarding against explicit user rejection (APDU 0x6985) reduces risk but this still touches critical signing behavior.

Overview
Improves Ledger mobile transaction signing by attempting clearSignTransaction first and falling back to blind signing (signTransaction(hdPath, tx, null)) when clear-sign resolution fails, while re-throwing explicit on-device user rejections (TransportStatusError status 0x6985) to avoid re-prompting.

Moves @ledgerhq/hw-transport to a runtime dependency, adds warning logging on fallback, and extends tests to cover both the fallback path and the user-rejection no-fallback path.

Reviewed by Cursor Bugbot for commit b71f9a7. Bugbot is set up for automated code reviews on this repo. Configure here.

Mirror metamask-extension PR #41948: try clearSignTransaction first, then
signTransaction(..., null) when resolution fails. Re-throw user rejection
(0x6985) without fallback. Add @ledgerhq/hw-transport as a runtime dependency.
@dawnseeker8 dawnseeker8 changed the title fix(ledger-bridge): fall back to blind signing when clear-sign fails fix: ledger fall back to blind signing when clear-sign fails Apr 21, 2026
@dawnseeker8
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown

Preview builds have been published. See these instructions (from the core monorepo) for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/account-api": "1.0.3-7275dbc",
  "@metamask-previews/hw-wallet-sdk": "0.8.0-7275dbc",
  "@metamask-previews/keyring-api": "23.0.1-7275dbc",
  "@metamask-previews/eth-hd-keyring": "14.0.1-7275dbc",
  "@metamask-previews/eth-ledger-bridge-keyring": "12.0.1-7275dbc",
  "@metamask-previews/eth-money-keyring": "2.0.2-7275dbc",
  "@metamask-previews/eth-qr-keyring": "2.0.1-7275dbc",
  "@metamask-previews/eth-simple-keyring": "12.0.1-7275dbc",
  "@metamask-previews/eth-trezor-keyring": "10.0.1-7275dbc",
  "@metamask-previews/keyring-internal-api": "10.1.1-7275dbc",
  "@metamask-previews/keyring-internal-snap-client": "10.0.1-7275dbc",
  "@metamask-previews/keyring-sdk": "2.0.1-7275dbc",
  "@metamask-previews/eth-snap-keyring": "21.0.1-7275dbc",
  "@metamask-previews/keyring-snap-client": "9.0.1-7275dbc",
  "@metamask-previews/keyring-snap-sdk": "9.0.1-7275dbc",
  "@metamask-previews/keyring-utils": "3.2.0-7275dbc"
}

@dawnseeker8 dawnseeker8 marked this pull request as ready for review April 30, 2026 11:08
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner April 30, 2026 11:08
montelaidev
montelaidev previously approved these changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@montelaidev montelaidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, didn't test because the logs is the same as the one on extension

dawnseeker8 and others added 3 commits May 6, 2026 15:05
… signing fallback and bump @metamask/keyring-sdk version to 2.1.1.
The Check Changelog CI parses the Unreleased section and requires the
entry to link to the actual PR number. Replace the `#TODO` placeholder
with the real PR link so the check passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
montelaidev
montelaidev previously approved these changes May 6, 2026
@dawnseeker8 dawnseeker8 enabled auto-merge May 6, 2026 08:21
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 37fa711. Configure here.

Comment thread packages/keyring-eth-ledger-bridge/src/ledger-mobile-bridge.ts Outdated
…h-ledger-bridge

- Added `@ledgerhq/hw-transport` dependency to `package.json`.
- Modified import statement in `ledger-mobile-bridge.ts` to use type-only import for `Transport` from `@ledgerhq/hw-transport`.
@dawnseeker8 dawnseeker8 added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit c25fb5d May 6, 2026
40 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/ledger-mobile-blind-sign-fallback branch May 6, 2026 09:26
@dawnseeker8 dawnseeker8 mentioned this pull request May 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants