chore(core): remove `thp.pairing._skip_pairing_dialog()`
What changed, and why it matters
This commit removes a debug-only shortcut that could skip the user-visible pairing dialog on a Trezor device. The shortcut was already unused because the flag that enabled it was always set to True, meaning the dialog was always shown. The change is a cleanup with no functional effect on normal or debug builds.
No action required. This is a benign cleanup commit. Reviewers may verify that no other debug flags or unused pairing shortcuts remain.
Security signals we found
Removal of debug-only pairing dialog bypass
No functional change because bypass was already unreachable
No changelog entry indicates routine cleanup
Evidence from the diff
The commit deletes _skip_pairing_dialog() from core/src/apps/thp/pairing.py and removes the should_show_pairing_dialog debug flag from core/src/trezor/wire/thp/channel.py. The pairing handler now unconditionally calls ctx.show_pairing_dialog() and writes ThpPairingRequestApproved. The removed code was guarded by if __debug__, so it only affected debug builds, and the flag was hardcoded to True, making the skip path unreachable.
Changed components
core/src/apps/thp/pairing.pycore/src/trezor/wire/thp/channel.pyInspect captured patch +2 / −25
diff --git a/core/src/apps/thp/pairing.py b/core/src/apps/thp/pairing.py
index 53970a55e..8c5dfbd7d 100644
--- a/core/src/apps/thp/pairing.py
+++ b/core/src/apps/thp/pairing.py
@@ -118,11 +118,8 @@ async def handle_pairing_request(
ctx.host_name = message.host_name
ctx.app_name = message.app_name
- if __debug__ and not ctx.channel_ctx.should_show_pairing_dialog:
- await _skip_pairing_dialog(ctx)
- else:
- await ctx.show_pairing_dialog()
- await ctx.write(ThpPairingRequestApproved())
+ await ctx.show_pairing_dialog()
+ await ctx.write(ThpPairingRequestApproved())
assert ThpSelectMethod.MESSAGE_WIRE_TYPE is not None
select_method_msg = await ctx.read(
[
@@ -484,20 +481,3 @@ def _check_method_is_allowed(ctx: PairingContext, method: ThpPairingMethod) -> N
def _check_method_is_selected(ctx: PairingContext, method: ThpPairingMethod) -> None:
if method is not ctx.selected_method:
raise ThpError("Not selected pairing method")
-
-
-if __debug__:
-
- async def _skip_pairing_dialog(ctx: PairingContext) -> None:
- from trezor.enums import ButtonRequestType
- from trezor.messages import ButtonAck, ButtonRequest, ThpPairingRequestApproved
- from trezor.wire.errors import ActionCancelled
-
- resp = await ctx.call(
- ButtonRequest(code=ButtonRequestType.Other, name="thp_pairing_request"),
- expected_type=ButtonAck,
- )
- if isinstance(resp, ButtonAck):
- await ctx.write(ThpPairingRequestApproved())
- else:
- raise ActionCancelled
diff --git a/core/src/trezor/wire/thp/channel.py b/core/src/trezor/wire/thp/channel.py
index d6ce8a288..4ac08a87a 100644
--- a/core/src/trezor/wire/thp/channel.py
+++ b/core/src/trezor/wire/thp/channel.py
@@ -158,9 +158,6 @@ class Channel:
self.credential: ThpPairingCredential | None = None
self.connection_context: PairingContext | None = None
- if __debug__:
- self.should_show_pairing_dialog: bool = True
-
@property
def iface(self) -> WireInterface:
return self.ctx._iface
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.