mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-09 08:51:54 -04:00
testsuite: move manifest corruption offset into data_encrypted region, refs #8572
Corruption at offset 123 lands inside meta_encrypted (header is 49 bytes), causing extract_crypted_data to return a shifted slice whose first byte is a random AES-OCB ciphertext byte. When that byte equals 0x02 (PlaintextKey type) key detection silently selects the wrong key, leading to a flaky IntegrityError in rebuild_archives. Move the insertion point to offset 250, which is safely inside data_encrypted for any realistic manifest size, so key detection always reads the correct type byte and the corruption is caught by AEAD authentication instead.
This commit is contained in:
parent
0a9913b658
commit
a4eac0b62c
1 changed files with 3 additions and 3 deletions
|
|
@ -225,7 +225,7 @@ def test_corrupted_manifest(archivers, request):
|
|||
archive, repository = open_archive(archiver.repository_path, "archive1")
|
||||
with repository:
|
||||
manifest = repository.get_manifest()
|
||||
corrupted_manifest = manifest[:123] + b"corrupted!" + manifest[123:]
|
||||
corrupted_manifest = manifest[:250] + b"corrupted!" + manifest[250:]
|
||||
repository.put_manifest(corrupted_manifest)
|
||||
cmd(archiver, "check", exit_code=1)
|
||||
output = cmd(archiver, "check", "-v", "--repair", exit_code=0)
|
||||
|
|
@ -273,7 +273,7 @@ def test_manifest_rebuild_corrupted_chunk(archivers, request):
|
|||
archive, repository = open_archive(archiver.repository_path, "archive1")
|
||||
with repository:
|
||||
manifest = repository.get_manifest()
|
||||
corrupted_manifest = manifest[:123] + b"corrupted!" + manifest[123:]
|
||||
corrupted_manifest = manifest[:250] + b"corrupted!" + manifest[250:]
|
||||
repository.put_manifest(corrupted_manifest)
|
||||
chunk = repository.get(archive.id)
|
||||
corrupted_chunk = chunk + b"corrupted!"
|
||||
|
|
@ -312,7 +312,7 @@ def test_spoofed_archive(archivers, request):
|
|||
with repository:
|
||||
# attacker would corrupt or delete the manifest to trigger a rebuild of it:
|
||||
manifest = repository.get_manifest()
|
||||
corrupted_manifest = manifest[:123] + b"corrupted!" + manifest[123:]
|
||||
corrupted_manifest = manifest[:250] + b"corrupted!" + manifest[250:]
|
||||
repository.put_manifest(corrupted_manifest)
|
||||
archive_dict = {
|
||||
"command_line": "",
|
||||
|
|
|
|||
Loading…
Reference in a new issue