chore(core): log reassembled THP messages
What changed, and why it matters
This commit adds a debug-only log message that records when a fragmented THP (Trezor Host Protocol) message has been successfully put back together. It does not change how messages are processed, validated, or secured. The logging is wrapped in `__debug__`, meaning it is normally stripped out of production firmware builds. There is no security-relevant change visible in the diff.
No security action required. Treat as a routine diagnostic/logging change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch inserts a conditional log statement inside InterfaceContext._handle_packet() after channel.reassemble(packet) returns True. The statement logs the reassembled message type (ACK vs. message) and byte length, but only when __debug__ is enabled and channel.reassembler.message is not None. No logic, parsing, authentication, or memory handling is altered.
Changed components
core/src/trezor/wire/thp/interface_context.pyInspect captured patch +4 / −0
diff --git a/core/src/trezor/wire/thp/interface_context.py b/core/src/trezor/wire/thp/interface_context.py
index 91e9bc21f..57aec6478 100644
--- a/core/src/trezor/wire/thp/interface_context.py
+++ b/core/src/trezor/wire/thp/interface_context.py
@@ -135,6 +135,10 @@ class InterfaceContext:
channel = self._channels[cid] = Channel(cache, self, buffers)
if channel.reassemble(packet):
+ if __debug__ and channel.reassembler.message is not None:
+ msg_type = "ACK" if control_byte.is_ack(ctrl_byte) else "message"
+ msg = channel.reassembler.message
+ channel._log(f"reassembled valid {msg_type}: {len(msg)} bytes")
update_channel_last_used(channel.channel_id)
return channel
Why this scored 15/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.