Skip to content

fix(archive): recheck deferred hardlinks - #837

Merged
indaco merged 1 commit into
indaco:mainfrom
rustytrees:security/tar-deferred-hardlinks
Aug 18, 2026
Merged

fix(archive): recheck deferred hardlinks#837
indaco merged 1 commit into
indaco:mainfrom
rustytrees:security/tar-deferred-hardlinks

Conversation

@rustytrees

@rustytrees rustytrees commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

Deferred hardlink paths are rechecked against every symlink declared by the archive. A symlink that appears later can no longer redirect the hardlink destination or source outside the extraction root.

The regression coverage includes the vulnerable ordering and a valid hardlink followed by an unrelated symlink.

Related Issue

Closes #852.

Notes for Reviewers

Verification completed:

  • zig build test-one: 2,425 passed
  • zig build test: 5,060 passed, 3 skipped
  • Commit signature verified with git verify-commit

Validate deferred hardlink paths against every symlink declared in the archive. This prevents a later symlink from redirecting a hardlink outside the extraction root while preserving valid hardlinks beside unrelated symlinks.
@indaco

indaco commented Aug 13, 2026

Copy link
Copy Markdown
Owner

@rustytrees Thanks for the contribution! One small request: could you please instruct your agent to follow the PR template provided in the repository for PRs? It helps keep the PRs consistent and easier to review. Thanks!

@indaco
indaco merged commit 7b7b4c1 into indaco:main Aug 18, 2026
3 checks passed
indaco pushed a commit that referenced this pull request Aug 18, 2026
Deferred hardlinks are revalidated against the complete set of archive symlinks before they are created, so a symlink declared after a hardlink can no longer redirect either end outside the extraction root.

(cherry picked from commit 7b7b4c1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: deferred TAR hardlinks can escape through a later symlink

2 participants