fix(legacy): lower maximum auto-lock delay to 149 hours
What changed, and why it matters
This update reduces the longest allowed screen-lock timeout on older Trezor devices from about 6 days down to 149 hours (just over 6 days). It makes the legacy firmware behave the same as newer Trezor firmware and prevents users from setting an extremely long auto-lock delay. Devices that already had a longer delay stored will silently use the new lower limit after updating, without changing the saved value.
No immediate user action required. Ensure the firmware update is applied so the auto-lock delay is capped at 149 hours. Users who previously set a delay longer than 149 hours should verify their device locks within the new limit.
Security signals we found
Bounds enforcement added for a configurable security-relevant timeout
Alignment of security policy between legacy and core firmware variants
Test coverage added for boundary values above and below new maximum
Evidence from the diff
The commit lowers MAX_AUTOLOCK_DELAY_MS in legacy/firmware/config.h from 0x20000000 ms (~6 days) to 1496060*1000 ms (149 hours). config_getAutoLockDelayMs() and config_setAutoLockDelayMs() now clamp the auto-lock delay to both the minimum and maximum. config_getAutoLockDelayMs() already clamped to the minimum; the patch adds an upper-bound clamp. config_setAutoLockDelayMs() now rejects/clamps values above the new maximum before storing. The test file updates parametrized inputs to use milliseconds and adds a boundary case one millisecond over the new maximum, plus the old maximum, to verify out-of-range handling.
Changed components
legacy/firmware/config.hlegacy/firmware/config.ctests/device_tests/test_autolock.pyInspect captured patch +16 / −6
### legacy/firmware/.changelog.d/8304.changed
@@ -0,0 +1 @@
+Lowered the maximum auto-lock delay to 149 hours to match the core firmware.
### legacy/firmware/config.c
@@ -981,12 +981,14 @@ uint32_t config_getAutoLockDelayMs(void) {
autoLockDelayMs = autoLockDelayMsDefault;
}
autoLockDelayMs = MAX(autoLockDelayMs, MIN_AUTOLOCK_DELAY_MS);
+ autoLockDelayMs = MIN(autoLockDelayMs, MAX_AUTOLOCK_DELAY_MS);
autoLockDelayMsCached = sectrue;
return autoLockDelayMs;
}
void config_setAutoLockDelayMs(uint32_t auto_lock_delay_ms) {
auto_lock_delay_ms = MAX(auto_lock_delay_ms, MIN_AUTOLOCK_DELAY_MS);
+ auto_lock_delay_ms = MIN(auto_lock_delay_ms, MAX_AUTOLOCK_DELAY_MS);
if (sectrue == storage_set(KEY_AUTO_LOCK_DELAY_MS, &auto_lock_delay_ms,
sizeof(auto_lock_delay_ms))) {
autoLockDelayMs = auto_lock_delay_ms;
### legacy/firmware/config.h
@@ -93,7 +93,8 @@ extern Storage configUpdate;
#else
#define MIN_AUTOLOCK_DELAY_MS (60 * 1000U) // 1 minute
#endif
-#define MAX_AUTOLOCK_DELAY_MS 0x20000000U // ~6 days
+// The value matches the core firmware
+#define MAX_AUTOLOCK_DELAY_MS (149 * 60 * 60 * 1000U) // 149 hours
void config_init(void);
void session_clear(bool lock);
### tests/device_tests/test_autolock.py
@@ -93,10 +93,17 @@ def test_autolock_default_value(session: Session):
@pytest.mark.parametrize(
- "seconds",
- [0, 1, 9, 536871, 2**22],
+ "milliseconds",
+ [
+ 0,
+ 1 * 1000,
+ 9 * 1000,
+ 149 * 60 * 60 * 1000 + 1, # one millisecond over the maximum
+ 0x2000_0000, # the maximum before it was lowered
+ 2**22 * 1000,
+ ],
)
-def test_apply_auto_lock_delay_out_of_range(session: Session, seconds):
+def test_apply_auto_lock_delay_out_of_range(session: Session, milliseconds):
with session.test_ctx as client:
client.use_pin_sequence([PIN4])
@@ -107,9 +114,8 @@ def test_apply_auto_lock_delay_out_of_range(session: Session, seconds):
]
)
- delay = seconds * 1000
with pytest.raises(TrezorFailure):
- device.apply_settings(session, auto_lock_delay_ms=delay)
+ device.apply_settings(session, auto_lock_delay_ms=milliseconds)
@pytest.mark.models("core")Why this scored 24/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.