Skip to content

fix: show filled PSBT in signPsbt confirmation#606

Open
jeremytsng wants to merge 3 commits into
mainfrom
fix/psbt-spoof-info
Open

fix: show filled PSBT in signPsbt confirmation#606
jeremytsng wants to merge 3 commits into
mainfrom
fix/psbt-spoof-info

Conversation

@jeremytsng
Copy link
Copy Markdown
Contributor

@jeremytsng jeremytsng commented May 6, 2026

Explanation

The signPsbt confirmation showed the unfilled template PSBT supplied by the dApp, while a freshly filled PSBT (with the dApp's feeRate) was the one actually signed. The user could not see the inputs, real fee, or feeRate before approving, allowing a malicious dApp to spoof the displayed transaction.

Fill the PSBT before showing the confirmation when options.fill is true, and pass fill=false to the inner signPsbt so the use case does not double-fill (which would re-introduce divergence between displayed and signed transaction).

Screenshots

Screenshot 2026-05-11 at 19 42 11

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches PSBT signing flow and confirmation data, so a mistake could cause users to approve/sign a different transaction than displayed. Changes are localized and covered by new unit tests for fill ordering and failure behavior.

Overview
Fixes KeyringRequestHandler#signPsbt so when options.fill is true it fills the PSBT before displaying the confirmation, ensuring the user reviews the same transaction that will be signed.

The handler now signs the filled PSBT while forcing { fill: false } for the inner signPsbt call to avoid double-filling and reintroducing divergence; tests were updated/added to assert call order, parsing behavior, and that failures in fillPsbt abort confirmation and signing. Changelog updated to note the fix.

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

The signPsbt confirmation showed the unfilled template PSBT supplied by
the dApp, while a freshly filled PSBT (with the dApp's feeRate) was the
one actually signed. The user could not see the inputs, real fee, or
feeRate before approving, allowing a malicious dApp to spoof the
displayed transaction.

Fill the PSBT before showing the confirmation when options.fill is true,
and pass fill=false to the inner signPsbt so the use case does not
double-fill (which would re-introduce divergence between displayed and
signed transaction).
@jeremytsng jeremytsng requested a review from a team as a code owner May 6, 2026 09:01
@jeremytsng
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/bitcoin-wallet-snap": "1.10.1-preview-bd78f2a"
}

@Battambang
Copy link
Copy Markdown
Contributor

Please, consider:

  • Create the preview-build in the PR and testing it with a bump in the MM client.
  • Add in the PR the screenshot of the dialog box.
  • Update the changelod.MD about this user facing change.
  • Have QA acceptance feedback for merge to main.

@jeremytsng jeremytsng requested a review from Battambang May 7, 2026 16:52
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