fix(core): make the autolock_delay_battery field public
What changed, and why it matters
This commit changes how one device setting—the battery-powered auto-lock delay—is stored on a Trezor hardware wallet. Previously it was kept in a private/protected storage area; now it is marked as public so the PIN lock screen can read it before the user has unlocked the device. The change itself is a straightforward bug fix: the lock screen needs this value to decide when to auto-lock, but could not access it while still locked. There is no direct evidence in the commit that this introduces a security vulnerability; it mainly reduces the confidentiality of that single setting.
Treat as a low-risk functional fix. Review whether any other pre-unlock code paths now rely on this public field, confirm the value remains read-only or properly bounded before unlock, and ensure the public storage area cannot be tampered with to set out-of-range values that affect device behavior. No urgent security patch appears needed from this commit alone.
Security signals we found
Storage confidentiality downgrade: a previously protected field is now public
Functional necessity cited: PIN lock screen needs the value before unlock
Value is range-bounded and non-secret by design (auto-lock timeout)
No input validation changes; existing bounds checks remain
No privilege escalation, code execution, or cryptographic misuse visible in diff
Evidence from the diff
In core/src/storage/device.py, get_autolock_delay_battery_ms() and set_autolock_delay_battery_ms() now pass public=True to common.get() and common.set() for the _AUTOLOCK_DELAY_BATT_MS namespace key. The stated reason is that the PIN lock screen uses this value before unlocking. The value is a 4-byte big-endian integer within a bounded range (AUTOLOCK_DELAY_BATT_MIN_MS to AUTOLOCK_DELAY_BATT_MAX_MS). Marking it public moves it from protected storage to unencrypted/accessible storage, which is intentional and required for pre-unlock functionality.
Changed components
core/src/storage/device.pyTrezor Core firmware storage layerBattery auto-lock delay settingPIN lock screen / power managerInspect captured patch +7 / −2
diff --git a/core/src/storage/device.py b/core/src/storage/device.py
index 0352ed697..81d7b18ad 100644
--- a/core/src/storage/device.py
+++ b/core/src/storage/device.py
@@ -279,7 +279,7 @@ def set_autolock_delay_ms(delay_ms: int) -> None:
if utils.USE_POWER_MANAGER:
def get_autolock_delay_battery_ms() -> int:
- b = common.get(_NAMESPACE, _AUTOLOCK_DELAY_BATT_MS)
+ b = common.get(_NAMESPACE, _AUTOLOCK_DELAY_BATT_MS, public=True)
if b is None:
return AUTOLOCK_DELAY_BATT_DEFAULT_MS
else:
@@ -295,7 +295,12 @@ if utils.USE_POWER_MANAGER:
min_ms=AUTOLOCK_DELAY_BATT_MIN_MS,
max_ms=AUTOLOCK_DELAY_BATT_MAX_MS,
)
- common.set(_NAMESPACE, _AUTOLOCK_DELAY_BATT_MS, delay_ms.to_bytes(4, "big"))
+ common.set(
+ _NAMESPACE,
+ _AUTOLOCK_DELAY_BATT_MS,
+ delay_ms.to_bytes(4, "big"),
+ public=True,
+ )
def next_u2f_counter() -> int:
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.