fix(core): don't access TR in global context
What changed, and why it matters
This is a tiny user-interface bug fix. It moves a translation lookup so that the 'Enter PIN' message is shown in the correct language on the boot screen instead of always appearing in English. There is no security vulnerability here.
No security action needed. Treat as a normal localization bug fix.
Security signals we found
No security-relevant code change
No input validation, memory safety, cryptography, or access control changes
Change is purely about translation string evaluation timing
Evidence from the diff
The commit changes a default argument in verify_user_pin() in core/src/apps/common/request_pin.py. Previously the default value was evaluated at module import time (_DEF_ARG_PIN_ENTER: str = TR.pin__enter), which happened before the user’s selected language/locale was loaded, causing the bootscreen PIN prompt to render in English. The fix changes the default to None and evaluates TR.pin__enter inside the function body, after locale initialization. This is a localization/UX fix, not a security patch.
Changed components
core/src/apps/common/request_pin.pyInspect captured patch +4 / −4
diff --git a/core/src/apps/common/request_pin.py b/core/src/apps/common/request_pin.py
index c19e959f..5ebd05ea 100644
--- a/core/src/apps/common/request_pin.py
+++ b/core/src/apps/common/request_pin.py
@@ -81,15 +81,15 @@ def _set_last_unlock_time() -> None:
context.cache_set_int(APP_COMMON_REQUEST_PIN_LAST_UNLOCK, now)
-_DEF_ARG_PIN_ENTER: str = TR.pin__enter
-
-
async def verify_user_pin(
- prompt: str = _DEF_ARG_PIN_ENTER,
+ prompt: str | None = None,
allow_cancel: bool = True,
retry: bool = True,
cache_time_ms: int = 0,
) -> None:
+ if prompt is None:
+ prompt = TR.pin__enter
+
# _get_last_unlock_time
last_unlock = int.from_bytes(
context.cache_get(APP_COMMON_REQUEST_PIN_LAST_UNLOCK, b""), "big"
Why this scored 18/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.