From ed80bf2c37f27ff0cf230182ad3f028e665e308e Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 24 Mar 2024 17:47:51 +0100 Subject: [PATCH] do a late lookup on helpers.workarounds so we can modify it within borg code elsewhere and it will get the updated value when it accesses the attribute. --- src/borg/crypto/key.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/borg/crypto/key.py b/src/borg/crypto/key.py index 5def0caba..0a634ba23 100644 --- a/src/borg/crypto/key.py +++ b/src/borg/crypto/key.py @@ -13,6 +13,7 @@ from ..logger import create_logger logger = create_logger() +from .. import helpers from ..constants import * # NOQA from ..compress import Compressor from ..helpers import StableDict @@ -23,7 +24,6 @@ from ..helpers import get_limited_unpacker from ..helpers import bin_to_hex from ..helpers import prepare_subprocess_env from ..helpers import msgpack -from ..helpers import workarounds from ..item import Key, EncryptedKey from ..platform import SaveFile @@ -33,7 +33,7 @@ from .low_level import AES256_CTR_HMAC_SHA256, AES256_CTR_BLAKE2b # workaround for lost passphrase or key in "authenticated" or "authenticated-blake2" mode -AUTHENTICATED_NO_KEY = 'authenticated_no_key' in workarounds +AUTHENTICATED_NO_KEY = 'authenticated_no_key' in helpers.workarounds class NoPassphraseFailure(Error): @@ -331,7 +331,7 @@ class KeyBase: tam_key = self._tam_key(tam_salt, context=b'archive') calculated_hmac = hmac.digest(tam_key, data, 'sha512') if not hmac.compare_digest(calculated_hmac, tam_hmac): - if 'ignore_invalid_archive_tam' in workarounds: + if 'ignore_invalid_archive_tam' in helpers.workarounds: logger.debug('ignoring invalid archive TAM due to BORG_WORKAROUNDS') return unpacked, False, None # same as if no TAM is present else: