What changed, and why it matters
This commit only adds a new test case. It does not change any production code. The test checks that the PSBT parser rejects files that have extra bytes after a valid PSBT packet. Because no code behavior is changed, this commit by itself does not fix or introduce a security issue.
No action required for this commit alone. If reviewing a related series, verify whether a prior commit changed the parser to reject trailing data and assess that change separately.
Security signals we found
Test-only commit
No production code changes
Tests input-validation behavior (trailing data rejection)
Evidence from the diff
The diff adds TestRejectsTrailingDataAfterPacket in psbt/strict_tx_values_test.go. It appends a trailing 0x00 byte to a valid raw PSBT and asserts that NewFromRawBytes returns ErrInvalidPsbtFormat. This is a regression/strictness test; no parser logic is modified. The test implies the production code already rejects trailing data, but the commit does not demonstrate whether that behavior is new or pre-existing.
Changed components
psbt/strict_tx_values_test.goInspect captured patch +16 / −0
diff --git a/psbt/strict_tx_values_test.go b/psbt/strict_tx_values_test.go
index 5552eac..33837f0 100644
--- a/psbt/strict_tx_values_test.go
+++ b/psbt/strict_tx_values_test.go
@@ -115,3 +115,19 @@ func TestRejectsTrailingDataInTransactionValues(t *testing.T) {
})
}
}
+
+// TestRejectsTrailingDataAfterPacket verifies that extra bytes after a valid
+// PSBT packet are rejected.
+func TestRejectsTrailingDataAfterPacket(t *testing.T) {
+ unsignedTx, prevTx := strictnessTxPair(t)
+ rawPacket := strictnessPSBT(
+ t,
+ serializeTxForStrictness(t, unsignedTx, true),
+ serializeTxForStrictness(t, prevTx, false),
+ )
+
+ _, err := NewFromRawBytes(
+ bytes.NewReader(append(rawPacket, 0x00)), false,
+ )
+ require.ErrorIs(t, err, ErrInvalidPsbtFormat)
+}
Why this scored 12/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.