What changed, and why it matters
This commit tightens validation in a Bitcoin PSBT (Partially Signed Bitcoin Transaction) parser. It now rejects PSBTs that contain an input with no UTXO data at all, because without that data the wallet cannot verify how much bitcoin that input is worth. Previously the code silently skipped such inputs, which could let a crafted PSBT understate the amount being spent or hide fee details from the user. The change is a defensive hardening fix, not a full security redesign.
Treat this as a low-to-moderate hardening improvement. Review whether other PSBT parsing paths (change verification, fee calculation, output validation) also assume UTXO presence and could fail open in similar ways. Add regression tests for PSBTs with missing non_witness_utxo and missing witness_utxo.
Security signals we found
Missing-input-data now raises an explicit exception instead of being silently skipped
PSBT input amount verification hardened against inputs lacking UTXO information
Comment explicitly frames the missing-UTXO case as invalid/unverifiable
Evidence from the diff
In seedsigner/models/psbt_parser.py, _verify_input_amounts() previously checked if inp.non_witness_utxo is None: and, if true, immediately fell through to a witness_utxo check. The new code first checks if inp.witness_utxo is None: and raises PSBTMissingInputUtxoError when both UTXO forms are absent. This converts a silent skip into an explicit validation failure. The change improves PSBT input-amount verification but is a small, localized patch.
Changed components
src/seedsigner/models/psbt_parser.pyInspect captured patch +2 / −1
### src/seedsigner/models/psbt_parser.py
@@ -379,8 +379,9 @@ def _verify_input_amounts(self):
verified_input_amount = 0
for i, inp in enumerate(self.psbt.inputs):
if inp.non_witness_utxo is None:
- # Without any utxo data there is no amount to verify or total
if inp.witness_utxo is None:
+ # We have no utxo data at all. This PSBT is invalid: it tries to spend an
+ # input whose source coin/value is completely unknown and unverifiable.
raise PSBTMissingInputUtxoError(f"Input {i} has no utxo data")
# Only a witness_utxo, so there is no previous transaction to hash. Raise if theWhy this scored 41/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.