AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 21 Bitcoin

fix(core): unify autolock duration formatting

Public commit record

What the developer wrote

Authored by Jakub Janků

95/100 · Strong
fix(core): unify autolock duration formatting

format_duration_ms and format_autolock_duration implemented the same
unit-selection logic but disagreed above 24 hours: the ApplySettings
confirmation dialog formatted a 2-day delay as "48 hours" while the
device menu showed "2 days" for the same setting. The day tier was
added only to the device menu code (a57fc3f8ed) and never made it back
to the older helper.

To reproduce (T3W1): set a day-scale delay from the host, e.g.
`trezorctl set auto-lock-delay 48h` - the confirmation dialog reads
"48 hours" - then check Settings -> Security -> Auto-lock in the
device menu, which reads "2 days" for the same stored value.

Add the day tier to format_duration_ms, move the unit names inside it,
and drop format_autolock_duration entirely, so all call sites share
one implementation. Since the unit-name strings are not specific to
the auto-lock feature, rename plurals__lock_after_x_minutes to just
plurals__minutes etc., keeping their string IDs so existing
translation blobs remain compatible.

Also add the day tier to the click-test oracle in tests/click_tests,
which mirrored the day-less variant and would have mispredicted the
device menu contents for day-scale delays.

[no changelog]

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a minor user-interface inconsistency in how the Trezor device displays auto-lock delays longer than a day. Previously, the confirmation dialog showed "48 hours" while the settings menu showed "2 days" for the same delay. The fix merges two similar formatting functions into one shared implementation so all screens use the same wording. It is a cosmetic bug fix, not a security vulnerability.

Recommended action

No security action required. Treat as a normal UI consistency fix and review for localization/translation completeness if desired.

Security signals we found

01

No memory safety, cryptographic, or authorization changes

02

No input validation or parsing logic changes

03

Only string formatting and translation key renaming

04

UI consistency fix with no attack surface introduced

Risk score

Why this scored 21/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 5/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.