chore(core): remove redunant payment request sanitizer [no changelog]
What changed, and why it matters
This commit removes a safety check that ensured each memo inside a Bitcoin payment request contained exactly one memo type. The change is described by the developer as removing a redundant sanitizer, suggesting the validation is believed to happen elsewhere. Without access to the rest of the codebase or vendor confirmation, it is unclear whether this weakens security or is genuinely redundant.
Verify whether PaymentRequestMemo memo-type exclusivity is enforced elsewhere (e.g., in protobuf decoding, message validation, or UI rendering). If not, reintroduce equivalent validation or add a changelog/security note. Treat this as a low-priority review item pending confirmation of redundancy.
Security signals we found
Removal of an input-validation/sanitization routine
Change returns unvalidated PaymentRequest from request_payment_req
Commit message asserts the removed sanitizer is redundant, but no evidence is provided in the diff
Evidence from the diff
The diff deletes _sanitize_payment_req() from core/src/apps/bitcoin/sign_tx/helpers.py and changes request_payment_req() to return the raw ack instead of the sanitized payment request. The removed function validated that each PaymentRequestMemo had exactly one of text_memo, text_details_memo, refund_memo, or coin_purchase_memo set. The commit title claims this sanitizer is redundant and the change is marked [no changelog].
Changed components
Trezor Core firmwareBitcoin transaction signing flowcore/src/apps/bitcoin/sign_tx/helpers.pyInspect captured patch +1 / −16
diff --git a/core/src/apps/bitcoin/sign_tx/helpers.py b/core/src/apps/bitcoin/sign_tx/helpers.py
index fcda2476..b3ad39f7 100644
--- a/core/src/apps/bitcoin/sign_tx/helpers.py
+++ b/core/src/apps/bitcoin/sign_tx/helpers.py
@@ -404,7 +404,7 @@ def request_payment_req(tx_req: TxRequest, i: int) -> Awaitable[PaymentRequest]:
tx_req.details.request_index = i
ack = yield PaymentRequest, tx_req # type: ignore [awaitable-return-type]
_clear_tx_request(tx_req)
- return _sanitize_payment_req(ack)
+ return ack
def request_tx_finish(tx_req: TxRequest) -> Awaitable[None]: # type: ignore [awaitable-return-type]
@@ -580,18 +580,3 @@ def _sanitize_tx_output(txo: TxOutput, coin: CoinInfo) -> TxOutput:
raise DataError("Missing orig_index field.")
return txo
-
-
-def _sanitize_payment_req(payment_req: PaymentRequest) -> PaymentRequest:
- for memo in payment_req.memos:
- if (
- memo.text_memo,
- memo.text_details_memo,
- memo.refund_memo,
- memo.coin_purchase_memo,
- ).count(None) != 3:
- raise DataError(
- "Exactly one memo type must be specified in each PaymentRequestMemo."
- )
-
- return payment_req
Why this scored 26/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.