feat(core): poke IdleTimer on THP BLE msgs
What changed, and why it matters
This commit changes the Trezor hardware wallet firmware so that when it receives messages over Bluetooth, it resets the auto-lock timer. This prevents the device from locking itself during long user interactions that happen wirelessly. It is a usability fix, not a vulnerability fix, and does not appear to introduce a security weakness.
No security action required. Review as normal feature/usability code. If desired, verify that `idle_timer.touch()` cannot be abused to keep the device unlocked indefinitely without user interaction, but the change appears limited to active message handling.
Security signals we found
No memory-unsafe operations added
No new trust boundary crossed
No authentication or authorization logic changed
No cryptographic code modified
Change is defensive/usability-oriented (preventing unwanted auto-lock)
Evidence from the diff
In core/src/trezor/wire/thp/interface_context.py, the code now imports trezorble and idle_timer when utils.USE_BLE is set, and calls idle_timer.touch() inside _read_packet() whenever the active interface is the BLE interface. This keeps the device’s idle/screen-lock timer from expiring during Bluetooth workflows. The change is narrowly scoped to BLE and THP (Trezor Host Protocol) message handling.
Changed components
core/src/trezor/wire/thp/interface_context.pyTrezor Core BLE/THP message handlingDevice idle timer behavior during Bluetooth workflowsInspect captured patch +8 / −2
diff --git a/core/src/trezor/wire/thp/interface_context.py b/core/src/trezor/wire/thp/interface_context.py
index 24014d8c4..7d66c42f0 100644
--- a/core/src/trezor/wire/thp/interface_context.py
+++ b/core/src/trezor/wire/thp/interface_context.py
@@ -27,6 +27,11 @@ from .checksum import CHECKSUM_LENGTH
if __debug__:
from trezor import log
+
+if utils.USE_BLE:
+ import trezorble as ble
+ from trezor.workflow import idle_timer
+
if TYPE_CHECKING:
from buffer_types import AnyBuffer, AnyBytes
from trezorio import WireInterface
@@ -94,6 +99,9 @@ class InterfaceContext:
"""
# Uses `yield` instead of `await` to avoid allocations.
packet_len = yield self._read
+ if utils.USE_BLE and self._iface is ble.interface:
+ # prevent auto-lock while handling longer workflows on Bluetooth
+ idle_timer.touch()
return self, packet_len
async def handle_packet(self, packet: AnyBuffer) -> Channel | None:
@@ -227,8 +235,6 @@ class InterfaceContext:
Currently supported by BLE (used for caching THP host names).
"""
if utils.USE_BLE:
- import trezorble as ble
-
if self._iface is ble.interface:
return ble.connected_addr()
Why this scored 32/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.