|
@@ -534,7 +534,7 @@ class Archive:
|
|
cdata = self.repository.get(id)
|
|
cdata = self.repository.get(id)
|
|
_, data = self.repo_objs.parse(id, cdata)
|
|
_, data = self.repo_objs.parse(id, cdata)
|
|
# we do not require TAM for archives, otherwise we can not even borg list a repo with old archives.
|
|
# we do not require TAM for archives, otherwise we can not even borg list a repo with old archives.
|
|
- archive, self.tam_verified = self.key.unpack_and_verify_archive(data, force_tam_not_required=True)
|
|
|
|
|
|
+ archive, self.tam_verified, _ = self.key.unpack_and_verify_archive(data, force_tam_not_required=True)
|
|
metadata = ArchiveItem(internal_dict=archive)
|
|
metadata = ArchiveItem(internal_dict=archive)
|
|
if metadata.version not in (1, 2): # legacy: still need to read v1 archives
|
|
if metadata.version not in (1, 2): # legacy: still need to read v1 archives
|
|
raise Exception("Unknown archive metadata version")
|
|
raise Exception("Unknown archive metadata version")
|
|
@@ -1998,7 +1998,7 @@ class ArchiveChecker:
|
|
# **after** doing the low-level checks and having a strong indication that we
|
|
# **after** doing the low-level checks and having a strong indication that we
|
|
# are likely looking at an archive item here, also check the TAM authentication:
|
|
# are likely looking at an archive item here, also check the TAM authentication:
|
|
try:
|
|
try:
|
|
- archive, verified = self.key.unpack_and_verify_archive(data, force_tam_not_required=False)
|
|
|
|
|
|
+ archive, verified, _ = self.key.unpack_and_verify_archive(data, force_tam_not_required=False)
|
|
except IntegrityError:
|
|
except IntegrityError:
|
|
# TAM issues - do not accept this archive!
|
|
# TAM issues - do not accept this archive!
|
|
# either somebody is trying to attack us with a fake archive data or
|
|
# either somebody is trying to attack us with a fake archive data or
|
|
@@ -2265,7 +2265,7 @@ class ArchiveChecker:
|
|
del self.manifest.archives[info.name]
|
|
del self.manifest.archives[info.name]
|
|
continue
|
|
continue
|
|
try:
|
|
try:
|
|
- archive, verified = self.key.unpack_and_verify_archive(data, force_tam_not_required=False)
|
|
|
|
|
|
+ archive, verified, salt = self.key.unpack_and_verify_archive(data, force_tam_not_required=False)
|
|
except IntegrityError as integrity_error:
|
|
except IntegrityError as integrity_error:
|
|
# looks like there is a TAM issue with this archive, this might be an attack!
|
|
# looks like there is a TAM issue with this archive, this might be an attack!
|
|
# when upgrading to borg 1.2.5, users are expected to TAM-authenticate all archives they
|
|
# when upgrading to borg 1.2.5, users are expected to TAM-authenticate all archives they
|
|
@@ -2293,7 +2293,7 @@ class ArchiveChecker:
|
|
archive.item_ptrs = archive_put_items(
|
|
archive.item_ptrs = archive_put_items(
|
|
items_buffer.chunks, repo_objs=self.repo_objs, add_reference=add_reference
|
|
items_buffer.chunks, repo_objs=self.repo_objs, add_reference=add_reference
|
|
)
|
|
)
|
|
- data = self.key.pack_and_authenticate_metadata(archive.as_dict(), context=b"archive")
|
|
|
|
|
|
+ data = self.key.pack_and_authenticate_metadata(archive.as_dict(), context=b"archive", salt=salt)
|
|
new_archive_id = self.key.id_hash(data)
|
|
new_archive_id = self.key.id_hash(data)
|
|
cdata = self.repo_objs.format(new_archive_id, {}, data)
|
|
cdata = self.repo_objs.format(new_archive_id, {}, data)
|
|
add_reference(new_archive_id, len(data), cdata)
|
|
add_reference(new_archive_id, len(data), cdata)
|