Commit Graph

13 Commits

Author SHA1 Message Date
Thomas Waldmann 1b6f928917
ro_type: typed repo objects, see #7670
writing: put type into repoobj metadata
reading: check wanted type against type we got

repoobj metadata is encrypted and authenticated.
repoobj data is encrypted and authenticated, also (separately).
encryption and decryption of both metadata and data get the
same "chunk ID" as AAD, so both are "bound" to that (same) ID.

a repo-side attacker can neither see cleartext metadata/data,
nor successfully tamper with it (AEAD decryption would fail).

also, a repo-side attacker could not replace a repoobj A with a
differently typed repoobj B without borg noticing:
- the metadata/data is cryptographically bound to its ID.
  authentication/decryption would fail on mismatch.
- the type check would fail.

thus, the problem (see CVEs in changelog) solved in borg 1 by the
manifest and archive TAMs is now already solved by the type check.
2023-09-24 20:10:50 +02:00
Thomas Waldmann 06eab6a228 RepositoryCache: cache complete and meta-only chunks separately 2022-09-08 19:38:18 +02:00
Thomas Waldmann b6cbf045ff add a test for borg 1 -> 2 repo objects transformation 2022-09-05 22:17:51 +02:00
Thomas Waldmann fa986a9f19 repoobj: add a layer to format/parse repo objects
borg < 2:

obj = encrypted(compressed(data))

borg 2:

obj = enc_meta_len32 + encrypted(msgpacked(meta)) + encrypted(compressed(data))

handle compr / decompr in repoobj

move the assert_id call from decrypt to RepoObj.parse

also:
- for AEADKeyBase, add a dummy assert_id (not needed here)
- only test assert_id for other if not AEADKeyBase instance
- remove test_getting_wrong_chunk. assert_id is called elsewhere
  and is not needed any more anyway with the new AEAD crypto.
- only give manifest (includes key, repo, repo_objs)
- only return manifest from Manifest.load (includes key, repo, repo_objs)
2022-09-04 00:49:38 +02:00
Thomas Waldmann b8e48c5036 mypy: fixes / annotations 2022-07-15 14:54:48 +02:00
Thomas Waldmann 7957af562d blacken all the code
https://black.readthedocs.io/
2022-07-06 16:34:38 +02:00
Thomas Waldmann d3b78a6cf5 minor key.encrypt api change/cleanup
we already have .decrypt(id, data, ...).
i changed .encrypt(chunk) to .encrypt(id, data).

the old borg crypto won't really need or use the id,
but the new AEAD crypto will authenticate the id in future.
2022-03-26 17:05:57 +01:00
Thomas Waldmann dc2a57af47 use pytest.fixture instead of yield_fixture, fixes #5575
/vagrant/borg/borg/.tox/py36-none/lib/python3.6/site-packages/borg/testsuite/remote.py:73:
    PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
Use @pytest.fixture instead; they are the same.
Docs: https://docs.pytest.org/en/stable/warnings.html
2020-12-20 00:11:04 +01:00
Marian Beermann f786211b12 RepositoryCache: truncate+unlink errored file 2017-06-11 20:20:00 +02:00
Marian Beermann 4faaa7d1fa RepositoryCache: abort on data corruption 2017-06-03 12:27:35 +02:00
Marian Beermann b544af2af1 RepositoryCache: checksum decrypted cache 2017-06-03 12:23:23 +02:00
Marian Beermann 7f04e00ba2 testsuite: add TestRepositoryCache 2017-06-02 17:43:15 +02:00
Martin Hostettler 84b3295a0d Archiver,RemoteRepository: Add --remote-ratelimit
The --remote-ratelimit option adds a very simple rate limit for the
sending data to the remote.

Currently implemented by sleeping if the transmission speed is greater
than the limit.
2016-09-18 19:00:26 +02:00