Validate topology and destructive path boundaries (#7)
* Validate topology and destructive path boundaries - Canonicalize sources/backups_dir and reject overlap in either direction - Reject duplicate sources and destination basename collisions - Reject non-normalized relative paths in nest_hardlink - Give each backup repository a persistent identity, recorded in every snapshot's completion manifest - Verify repo identity, directory type (no symlinks), containment, and device before any recursive snapshot/staging-dir deletion, refusing to cross mount points Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Address Copilot review: root-path check, symlink/TOCTOU-safe writes, legacy marker adoption - _is_same_or_within: drop the redundant, root-mishandling startswith check; commonpath() alone is already component-aware - _ensure_repo_id/_write_manifest: write via temp-file + atomic rename (O_NOFOLLOW, O_EXCL on the temp file) instead of open+write in place, so writes can never go through a pre-existing symlink and are never left half-written - _verify_safe_to_delete: distinguish a legacy empty marker (pre-dates the manifest format, can only be a pre-migration artifact) from a non-empty-but-invalid one (corrupt or forged); adopt the former into the repository instead of refusing to delete it forever Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Maxim Shulga <maxim.shulga@alludo.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+450
-33
No files matched your search
+7
-7
@@ -56,15 +56,15 @@ Acceptance criteria:
|
||||
|
||||
### Validate topology and destructive path boundaries
|
||||
|
||||
- [ ] Canonicalize source and backup paths and reject every overlap.
|
||||
- [ ] Reject duplicate sources and destination basename collisions, or require
|
||||
- [x] Canonicalize source and backup paths and reject every overlap.
|
||||
- [x] Reject duplicate sources and destination basename collisions, or require
|
||||
explicit source labels.
|
||||
- [ ] Require normalized relative paths for nested operations.
|
||||
- [ ] Verify `commonpath` before every write, rename, or deletion.
|
||||
- [ ] Give each backup repository an identity recorded in its manifest.
|
||||
- [ ] Validate repository identity, snapshot type, marker, and device before
|
||||
- [x] Require normalized relative paths for nested operations.
|
||||
- [x] Verify `commonpath` before every write, rename, or deletion.
|
||||
- [x] Give each backup repository an identity recorded in its manifest.
|
||||
- [x] Validate repository identity, snapshot type, marker, and device before
|
||||
recursive deletion.
|
||||
- [ ] Refuse to cross mount points during deletion.
|
||||
- [x] Refuse to cross mount points during deletion.
|
||||
|
||||
Acceptance criteria:
|
||||
|
||||
|
||||
Reference in new issue
Block a user