chore(core): remove `print` statements from `_handle_code_entry_cpace()`
What changed, and why it matters
This commit removes leftover debug print statements from a Trezor hardware wallet pairing function. The prints could have exposed sensitive cryptographic material (a shared secret and authentication tag) during development or testing, but they were clearly marked as temporary test code and are now removed. There is no evidence this code ever shipped to production firmware.
Verify these print statements were never present in any released production firmware or test builds distributed to users. Confirm no other debug prints leak secrets elsewhere in the THP pairing code. No further patch is needed beyond this cleanup.
Security signals we found
Removal of debug output containing cryptographic secrets
Sensitive values: CPace shared secret and derived authentication tag
Unused import `ubinascii.hexlify` also removed
Comments marked code as temporary testing instrumentation
Evidence from the diff
The change deletes three lines of debug output and an unused hexlify import in core/src/apps/thp/pairing.py. The removed prints output expected_tag and ctx.cpace.shared_secret when a CPace code-entry tag mismatch occurs. Both values are sensitive: the shared secret is the result of a key agreement, and the tag is derived from it. Leaking them would break the confidentiality of the pairing handshake. The comments explicitly said ‘TODO remove after testing’, indicating this was temporary instrumentation rather than intended production behavior.
Changed components
core/src/apps/thp/pairing.pyTrezor THP (Trezor Host Protocol) pairing flow_handle_code_entry_cpace()Inspect captured patch +0 / −8
diff --git a/core/src/apps/thp/pairing.py b/core/src/apps/thp/pairing.py
index af1c7d327..77acb123b 100644
--- a/core/src/apps/thp/pairing.py
+++ b/core/src/apps/thp/pairing.py
@@ -1,5 +1,4 @@
from typing import TYPE_CHECKING
-from ubinascii import hexlify
from trezor import protobuf
from trezor.crypto import random
@@ -308,13 +307,6 @@ async def _handle_code_entry_cpace(
ctx.cpace.compute_shared_secret(message.cpace_host_public_key)
expected_tag = sha256(ctx.cpace.shared_secret).digest()
if expected_tag != message.tag:
- print(
- "expected code entry tag:", hexlify(expected_tag).decode()
- ) # TODO remove after testing
- print(
- "expected code entry shared secret:",
- hexlify(ctx.cpace.shared_secret).decode(),
- ) # TODO remove after testing
raise ThpError("Unexpected Code Entry Tag")
if ctx.code_entry_secret is None:
Why this scored 21/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.