Reject backup output inside data dir (#1587)

This commit is contained in:
red person
2026-06-03 02:38:27 +03:00
committed by GitHub
parent f39c87561b
commit db3a5c17b0
2 changed files with 22 additions and 0 deletions

View File

@@ -30,6 +30,17 @@ def _verify_args(path: Path):
return SimpleNamespace(path=str(path), pretty=False)
def test_snapshot_rejects_output_inside_data_dir(tmp_path, monkeypatch):
backup = _load_backup_cli()
repo = tmp_path / "repo"
data = repo / "data"
data.mkdir(parents=True)
_patch_repo(backup, monkeypatch, repo)
with pytest.raises(SystemExit):
backup._reject_output_inside_data(data / "self.tar.gz")
def test_restore_rejects_symlink_escape(tmp_path, monkeypatch):
backup = _load_backup_cli()
repo = tmp_path / "repo"