Repository navigation
Ask for the backup password again when it is wrong - #984
Merged
besendorf merged 1 commit intoOct 28, 2026
Merged
Conversation
A wrong password typed at the prompt ended the check with "Invalid backup password", and check-androidqf skipped the backup modules. An analyst who was handed several candidate passwords had to start the whole run again for each one. Ask for the password again, up to three attempts in total. A password given with --backup-password or in the environment is not asked for again, as before, so scripted runs fail the same way. Fixes #979
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #979
When the backup password typed at the prompt was wrong,
check-backupandcheck-androidqfended with "Invalid backup password" (andcheck-androidqfskipped the backup modules), so an analyst with several candidate passwords had to run everything again for each one.CmdAndroidCheckBackup.from_ab()now asks for the password again after a wrong one, up to three attempts in total (MAX_BACKUP_PASSWORD_ATTEMPTS). Each retry logsInvalid backup password, try again (attempt 2 of 3). After the last attempt it fails exactly as before:sys.exit(1)on its own,InvalidAndroidBackupwhen run as a sub-command. An empty answer on a retry ends the check with "No backup password provided", the same as an empty first answer.A password given with
--backup-passwordor in the environment is not asked for again. That keeps scripted runs andtest_check_encrypted_backup_cli_invalidunchanged. Non-interactive runs still can't prompt, so they behave as before.The shared "ask for a password, fail if there is none" step moved into
_get_backup_password(); the rest offrom_ab()is the same code in a loop.Tests, in
tests/test_check_android_backup.py:--backup-passwordstill fails without promptingThe first three fail on
mainand pass here. I ran them with the related backup and androidqf test files,ruff check .andmypyon the changed module. The full suite has three failures intests/test_cli_entry_points.py::test_main_completes_plugin_command_names; they fail the same way on an untouchedmainin my environment, so they are unrelated to this change.