re-fix: bugfix: exiting custom backup password text form causes yikes
What changed, and why it matters
This is a one-line bug fix in the COLDCARD firmware's backup restore code. The developer accidentally checked the wrong variable (`pwd` instead of `ipw`) when deciding whether the user cancelled the custom backup password entry screen. Because `pwd` is a list that is always truthy, the code never returned early when the user exited the password form, which the commit message describes as causing a 'yikes' error. The fix makes the code check the actual user input variable instead.
Treat as a routine bug fix. Verify that the corrected guard correctly handles cancellation, empty input, and escape-key behavior in the backup restore UI. No immediate security response is indicated, but regression testing of the backup restore flow is appropriate.
Security signals we found
Logic error in user-input cancellation handling
Use of wrong variable in guard condition
Potential null/empty value appended to password list
UI flow bug in backup restore path
Evidence from the diff
In shared/backups.py, inside restore_complete(), when restoring from a words-free backup and prompting for the backup password via ux_input_text(), the cancellation check used if not pwd: return. However, pwd is a Python list initialized earlier and is always truthy, so the guard never triggered. The correct variable to check is ipw (the string returned by ux_input_text()), which is empty/None when the user cancels. The fix changes the condition to if not ipw: return. This prevents the function from appending a null/empty value and continuing to done(pwd).
Changed components
shared/backups.pyrestore_complete() functionBackup password input flowInspect captured patch +1 / −1
diff --git a/shared/backups.py b/shared/backups.py
index eeaef4b..41baa3f 100644
--- a/shared/backups.py
+++ b/shared/backups.py
@@ -584,7 +584,7 @@ async def restore_complete(fname_or_fd, temporary=False, words=True, usb=False):
if words is False:
ipw = await ux_input_text("", prompt="Your Backup Password",
min_len=bkpw_min_len, max_len=128)
- if not pwd: return
+ if not ipw: return
pwd.append(ipw)
await done(pwd)
Why this scored 31/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.