Harden backup restore tar extraction #574
No reviewers
Labels
No labels
area:chat
area:core
area:llm
area:routes
area:tools
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sleepy/odysseus!574
Loading…
Reference in a new issue
No description provided.
Delete branch "ghreprimand/harden-backup-restore-tar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Why
The restore path already rejected absolute paths and ../ traversal, but tar archives can also redirect writes through link entries. For example, an archive can create a link inside data/ and then include a later regular file beneath that link. Using extractall() leaves that class of archive behavior to tarfile.
This keeps restores constrained to the data/ tree by accepting only regular files/directories and copying file contents directly after validation. It also makes odysseus-backup verify reject archives that restore would refuse.
Tests
Merged via squash. Restore path now validates members before extraction, rejects symlinks/hardlinks/special files, and uses safe member-by-member extraction instead of extractall(). All 4 tests pass.