Repository navigation
Conversation
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.
Closes #663
A key file whose
dataholds fewer than 32 bytes (nonce plus MAC) failed the MAC check withC001, sofind_key_in_backendskipped it like a key for another password and opening ended inC002, telling the user to retry a password that can never work.Changes
KeyFile::key_from_dataandKeyFile::key_from_passwordreturn anErrorKind::Keyerror with codeC004whendatais shorter than 32 bytes.key_from_passwordchecks this before running scrypt.find_key_in_backendno longer stops at such a file and keeps trying the other keys:C001), it returns theC004error with thekey_idof the damaged file, so a repository whose only key is truncated says so;C002, sois_incorrect_password()keeps working for a mistyped password, with the damaged ids in adamaged_key_filescontext.Tests
In
tests/keys.rs, withdatacut to 20 zero bytes as in the issue:C004and notis_incorrect_password()(both fail onmain);key1: the right password opens, a wrong one givesC002with the damaged id indamaged_key_files(the second fails onmain).cargo +stable fmt --all -- --check,cargo +stable clippy -p rustic_core --all-targets --all-features -- -D warningsandcargo test -p rustic_core --test keyspass locally.