Commit Graph

18 Commits

Author SHA1 Message Date
Thomas Waldmann abe6545853
do not return the rc from Archiver methods
this is not needed and getting rid of it makes
the code / behaviour simpler to understand:

if a fatal error is detected, we throw an exception.

if we encounter something warning worthy, we emit and collect the warning.

in a few cases, we directly call set_ec to set the
exit code as needed, e.g. if passing it through
from a subprocess.

also:
- get rid of Archiver.exit_code
- assert that return value of archiver methods is None
- fix a print_warning call to use the correct formatting method
2024-02-17 22:07:47 +01:00
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 0b62338d4a
borg transfer --compression=C --recompress=M, fixes #7529 2023-04-24 23:46:38 +02:00
Thomas Waldmann afccb1dee5
transfer: more Highlander options, fixes #6269 2023-04-06 17:33:41 +02:00
Thomas Waldmann 3d65cb3fea
transfer: verify chunks we get using assert_id, fixes #7383
this needs to decompress and to hash the chunk data,
but better let's play safe.

at least we still can avoid the (re-)compression with
borg transfer (which is often much more expensive
than decompression).
2023-03-27 16:36:53 +02:00
Thomas Waldmann 2b935cfe41
transfer: fix exception in dry-run mode
Only call archive.stats.show_progress(final=True) if
we actually have an archive (== not in dry-run mode).
2023-02-26 00:41:13 +01:00
Thomas Waldmann 7ad25ba9e2
transfer: support --progress 2023-02-03 02:10:29 +01:00
Thomas Waldmann d2cc167afd
borg transfer: drop part files 2023-02-01 13:04:19 +01:00
Thomas Waldmann a0330d578e
run black 23.1.0 on the code 2023-02-01 12:30:37 +01:00
Thomas Waldmann a475227e18
use archivename_validator everywhere
also: simplify, reuse code from text_validator.
2022-12-15 22:54:46 +01:00
Thomas Waldmann 4b54b5565e
use comment validator for cli args and borg transfer 2022-12-12 18:48:01 +01:00
Thomas Waldmann ebff12ad41
transfer: validate archive names before transfer 2022-12-12 17:06:13 +01:00
Thomas Waldmann 2e83d18d35 archive.save(): always use metadata from stats, fixes #7072
e.g. nfiles, size, etc.

fixes:
- checkpoint archives did not have this metadata yet
- borg import-tar did not have this metadata yet
2022-10-03 23:25:02 +02:00
Thomas Waldmann f647fa9f08 transfer: check if correct upgrader class is used for v1 repos 2022-09-09 21:20:35 +02:00
Thomas Waldmann cf333cef91 upgrader fixes for new api 2022-09-07 20:27:03 +02:00
Thomas Waldmann 1e156ca02b fix upgrader 2022-09-07 19:23:11 +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 66e74e0471 archiver modules: rename to *_cmd[s]
this was already required for list_cmd (due to "list"
being a builtin), now renamed all else also.
2022-08-13 22:59:48 +02:00
Renamed from src/borg/archiver/transfer.py (Browse further)