improve verification of psbt sighash types
What changed, and why it matters
This commit adds a safety check in Sparrow Wallet when opening a PSBT (a file format used to pass partially-signed Bitcoin transactions between wallets). Before this change, the wallet did not verify the signature-hash types declared inside the PSBT. A malicious or malformed PSBT could ask the wallet to sign in a way that unexpectedly alters what the signature covers, potentially leading to loss of funds. After the change, Sparrow warns the user and asks whether to continue.
Review the corresponding drongo submodule commit to confirm verifySigHashes() validates all relevant sighash types and edge cases. Consider whether the warning dialog should default to 'No' or require explicit opt-in, and ensure the warning text explains the risk clearly to non-technical users.
Security signals we found
New user-facing warning for 'Unsafe PSBT'
Adds signature-hash verification on PSBT load
Catches PSBTSignatureException specifically
Defensive check before signing workflow
Submodule change in drongo suggests underlying verification implementation was added or modified
Evidence from the diff
The patch inserts a call to psbt.verifySigHashes() after PSBT parsing in AppController. If the method throws PSBTSignatureException, Sparrow displays a warning dialog (‘Unsafe PSBT’) and aborts loading unless the user explicitly chooses to proceed. The change is defensive: it does not reject the operation automatically, but it surfaces sighash-type mismatches to the user. The actual verification logic lives in the drongo submodule (changed file listed but diff not supplied), so the completeness of the fix cannot be fully evaluated from this commit alone.
Changed components
Sparrow Wallet desktop applicationPSBT loading/opening flow in AppController.javadrongo library (submodule) PSBT sighash verificationInspect captured patch +11 / −1
diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java
index 1f9af26..12e138d 100644
--- a/src/main/java/com/sparrowwallet/sparrow/AppController.java
+++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java
@@ -2058,6 +2058,16 @@ public class AppController implements Initializable {
AppServices.showErrorDialog("Invalid PSBT", e.getMessage());
return;
}
+
+ try {
+ psbt.verifySigHashes();
+ } catch(PSBTSignatureException e) {
+ Optional<ButtonType> result = AppServices.showWarningDialog("Unsafe PSBT",
+ e.getMessage() + "\n\nThis PSBT may be unsafe to sign.\n\nOpen the transaction?", ButtonType.YES, ButtonType.NO);
+ if(result.isEmpty() || result.get() != ButtonType.YES) {
+ return;
+ }
+ }
}
//Skip the warning for already-confirmed transactions loaded for inspection
Why this scored 60/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.