1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-21 13:47:16 +00:00

Strengthen the test: we can read data w/o nonces

This commit is contained in:
Andrey Bienkowski 2022-01-28 15:16:19 +03:00
parent 37dde58154
commit e663c9aa10

View file

@ -3507,12 +3507,20 @@ def test_do_not_mention_archive_if_you_can_not_find_repo(self):
self.assert_not_in('this-repository-does-not-exist::test', output)
def test_can_read_repo_even_if_nonce_is_deleted(self):
"""Nonce is only used for encrypting new data.
It should be possible to retrieve the data from an archive even if
both the client and the server forget the nonce"""
self.create_regular_file('file1', contents=b'Hello, borg')
self.cmd('init', '--encryption=repokey', self.repository_location)
self.cmd('create', self.repository_location + '::test', 'input')
# Oops! We have removed the repo-side memory of the nonce!
# See https://github.com/borgbackup/borg/issues/5858
os.remove(os.path.join(self.repository_path, 'nonce'))
# Oops! The client has lost the nonce too!
repository_id = bin_to_hex(self._extract_repository_id(self.repository_path))
security_dir = get_security_dir(repository_id)
os.remove(os.path.join(security_dir, 'nonce'))
# The repo should still be readable
repo_info = self.cmd('info', self.repository_location)