check: always require the key - #10385
Open
ThomasWaldmann wants to merge 1 commit into
Open
ThomasWaldmann wants to merge 1 commit into
ThomasWaldmann wants to merge 1 commit into
Conversation
borg check loads the key right after the argument validation, in every mode: a --repository-only check without --repair needed no key until now, and a check without --repair let a repository config without key info through. Every borg 2 repository has a borg key and the key class comes from the repository config, so loading the key reads no repository object. The passphrase is still asked for before the repository check starts (borgbackup#1931). Repository.check() always gets the object validator (it uses it for the index rebuild, which only a repair does) and ArchiveChecker.check() has no path without a key any more, so its chunk index rebuild always validates the object headers it walks. A check without the key is gone, so the test for it is replaced by tests that a wrong passphrase and a repository config without key info abort the full, the --repository-only and the --archives-only check. Docs: the check epilog says that check always needs the key, packs.rst no longer describes a repair walking the packs without the key. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Member
Author
|
@mr-raj12 please check. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10385 +/- ##
==========================================
- Coverage 88.15% 88.14% -0.02%
==========================================
Files 103 103
Lines 18822 18810 -12
Branches 2919 2915 -4
==========================================
- Hits 16593 16580 -13
- Misses 1552 1554 +2
+ Partials 677 676 -1 ☔ View full report in Codecov by Harness. |
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.
borg checknow loads the key before it checks anything, in every mode, and aborts if it can not.Before
borg check --repository-only(without--repair) needed no key at all.--repairswallowedRepositoryKeyInfoMissingand carried on without a key: the archives check then rebuilt the chunk index without an object validator and only failed at its second attempt to load the key.--repairreally required the key (borg2: index rebuild trusts pack headers #9901).Now
do_checkcallskey_factory(repository)right after the argument validation. Every borg 2 repository has a borg key (remove the none-sha256 and none-blake3 encryption modes #10381) and the key class comes from the repository config (repository: single config/config text object (repo version 5) #10377), so loading the key reads no repository object. The passphrase is still asked for before a repository check that can take hours (ux: borg check asks for passphrase very late #1931).Repository.check()always gets the object validator. It uses it for the index rebuild, which only a repair does, so a non-repair repository check verifies the same things as before.ArchiveChecker.check()has no path without a key any more, so its chunk index rebuild always validates the object headers it walks. It still loads the key itself if the caller did not set.key(several tests use it that way).User-visible consequences
borg check --repository-onlycan not be run without the key / passphrase any more, e.g. on a repository server that does not have them.Repository(..., create=True)) fails every check with rc 54 (RepositoryKeyInfoMissing); a wrong passphrase fails with rc 52, before anything is checked.Tests
test_check_without_key_aborts_on_a_corrupt_pack_headeris removed: a check without the key does not exist any more.test_check_aborts_on_wrong_passphraseandtest_check_aborts_without_key_info, each for the full, the--repository-onlyand the--archives-onlycheck. The--repository-onlycases fail on master.Docs
--repository-onlyincluded; the repair-only sentence about it is gone.docs/internals/packs.rstno longer describes a repair that walks the packs without the key (stale since borg2: index rebuild trusts pack headers #9901).🤖 Generated with Claude Code