Repository navigation
Conversation
Validate paths of tar and zip entries after stripping the top-level directory, accepting only plain file names. Reject hard links in tar archives and accept symbolic links only if their target stays within the link's own directory. Update tar to 0.4.46. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
|
hummbl-dev
left a comment
There was a problem hiding this comment.
Summary
The patch strips the archive root, then rebuilds tar and zip paths from plain components and writes through that full_path (entry.unpack(&full_path) / File::create), so a lexical .., drive prefix, or absolute remainder no longer survives Path::join. Hard links are rejected before tar 0.4.46's Entry::unpack, which would otherwise fs::hard_link the target against the process cwd. The hole is symbolic links whose path collapses to the destination itself: the target check never joins the link location, and a later entry is created through that link.
Issue counts by severity
- bugs: 1
- suggestions: 0
- nits: 0
An entry such as `pkg` or `pkg/.` strips to an empty path and would be unpacked at the destination itself; a symlink there is resolved relative to the destination's parent. Allow only directories at that path, in both tar and zip archives. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🤖 Claude+Codex say: @Kha, that guarantee applies to
On master, |
This PR hardens toolchain archive extraction so that entries cannot be written outside the destination directory. After the top-level directory is stripped, tar and zip entry paths may only consist of plain file names; components such as
.., roots, drive prefixes, or names that Windows would reinterpret are rejected with an error. Tar hard links are rejected, and symbolic links are accepted only if their target stays within the link's own directory, which covers the relative library links in current Linux releases. It also updatestarto 0.4.46 for its own symlink handling fix.🤖 Prepared with Claude Code