remove the none-sha256 and none-blake3 encryption modes - #10381
Open
ThomasWaldmann wants to merge 5 commits into
Open
ThomasWaldmann wants to merge 5 commits into
ThomasWaldmann wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10381 +/- ##
==========================================
+ Coverage 88.14% 88.16% +0.02%
==========================================
Files 103 103
Lines 18896 18829 -67
Branches 2931 2921 -10
==========================================
- Hits 16655 16600 -55
+ Misses 1557 1552 -5
+ Partials 684 677 -7 ☔ View full report in Codecov by Harness. |
Every borg 2 mode has a borg key now: the AEAD modes (aes256-ocb, chacha20-poly1305) and the authenticated-sha256 / authenticated-blake3 modes. There is no compatibility with repositories older borg 2 betas created in a none-* mode. - crypto.key: remove ChecksumKeyBase, ChecksumKey, Blake3ChecksumKey and the SHA256NONE / BLAKE3NONE key types. - remove KeyBase.id_check_is_authentication: all borg 2 envelopes authenticate the chunk id, so RepoObj.parse verifies the id only at the BORG_ASSERT_ID places and the mandatory ones. - repo-create: always show the key / passphrase hint. - a borg 1.x "none" repository has unkeyed chunk ids, which no borg 2 mode has, so transferring it needs --chunker-params (docs updated). - tests: use authenticated-sha256 where none-sha256 was used as the cheap default mode, add make_test_key() for tests needing some key. The repository swap detection tests now re-label the repokey of the attacker's repository for the faked repository id. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
All borg 2 key classes are FlexiKey based and have a configurable key location, so the "This repository is not encrypted ..." checks of the borg key subcommands and the NO_STORAGE check of KeyManager could not trigger anymore. UnencryptedRepo is not raised anymore, the class stays defined to keep its exit code (rc 46) reserved. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
0x50 was the beta "authenticated" mode with blake3 ids. Repositories of older borg 2 betas can not be read anyway (repositories need to be created anew), so there is no need to keep that byte reserved. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
They only existed to make derive_key() work for a key without key material, as the chunkers call it for the key of the repository they write to. That is always a borg 2 key with real key material now, the borg 1.x PlaintextKey is only used to read a borg 1.x repository. Also remove test_derive_key_with_plaintext_key, which tested that case. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
SHA256AUTHENTICATED 0x60 -> 0x50, BLAKE3AUTHENTICATED 0x70 -> 0x60, so the borg 2 key types are contiguous (0x10 .. 0x60) again. The type byte is covered by the envelope tag, so the golden vectors of test_format_is_stable change, too (verified by recomputing them from the documented envelope format, independently of the key classes). This breaks authenticated-* repositories created by older borg 2 betas, which is fine: the next beta needs new repositories anyway. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ThomasWaldmann
force-pushed
the
remove-none-modes
branch
from
September 17, 2026 23:22
83d1157 to
2258742
Compare
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.
Removes the
none-sha256/none-blake3modes. Every borg 2 mode has a borg key now:aes256-ocb,chacha20-poly1305,authenticated-sha256,authenticated-blake3.No compatibility with repositories that older borg 2 betas created in a
none-*mode: their key type bytes (0x80 / 0x90) are gone, opening such a repository givesUnsupportedPayloadError.Changes
crypto.key: removeChecksumKeyBase,ChecksumKey,Blake3ChecksumKeyandKeyType.SHA256NONE/BLAKE3NONE.MACKeyBasenow only serves theauthenticated-*modes.KeyBase.id_check_is_authentication: it only existed for the unkeyed modes. All borg 2 envelopes authenticate the chunk id, soRepoObj.parseverifies the id at theBORG_ASSERT_IDplaces and the mandatory ones (check --verify-data).RepoObj1.parse(borg 1.x repos) always verifies, as before.has_secret_keystays, the read-only borg 1.xnonekey class still needs it (repo-create --other-repo).repo-create: help / epilog / completion descriptions updated, the "you will need both KEY AND PASSPHRASE" hint is always shown.borg key ...: remove the "This repository is not encrypted ..." guards and theNO_STORAGEcheck inKeyManager- they can not trigger any more (2nd commit).UnencryptedRepois kept (not raised) so rc 46 stays reserved.KeyType: no longer reserves 0x50, the key type of an older borg 2 beta mode - the next beta needs new repositories anyway (3rd commit).PlaintextKey: remove the emptycrypt_key/id_key, which only existed to makederive_key()work for a key without key material (the chunkers call it for the key of the repository they write to - always a borg 2 key now), andtest_derive_key_with_plaintext_key(4th commit).KeyType: renumberSHA256AUTHENTICATED0x60 -> 0x50 andBLAKE3AUTHENTICATED0x70 -> 0x60, so the borg 2 key types are contiguous (0x10 .. 0x60). The type byte is covered by the envelope tag, so the golden vectors oftest_format_is_stablechanged, too (5th commit). Not a compatibility concern: the next beta can not read repositories of older betas anyway.repo-createexamples,BORG_ASSERT_ID/authenticated_no_keyhelp texts.borg 1.x "none" repositories
They use unkeyed sha256 chunk ids, which no borg 2 mode has any more. So
borg transfer --from-borg1from such a repository needs--chunker-params(like blake2 repositories do), and the new repository is created without--other-repo(there is no key material to copy). Documented indocs/usage/transfer.rst.Tests
make_test_key()helper (anauthenticated-sha256key with fixed key material) replacesChecksumKey(...)where a test just needs some key.none-sha256as the cheap default mode useauthenticated-sha256now; tests about the none modes themselves are removed.test_with_lock,test_disk_full, cockpit) setBORG_PASSPHRASEthemselves.Local run on macOS (rebased onto master incl. #10377): 3061 passed, 1014 skipped (without
mount_cmds_test.py, FUSE does not work on that machine currently;cockpit_testonly runs on FreeBSD / Windows) - so CI has to cover these.Not done here: the generated
docs/usage/*.rst.inc/ man pages still mentionnone-*until they get regenerated, anddocs/changes.rstis untouched (the b25 entry for #9072 mentionsnone-*).🤖 Generated with Claude Code