ENG-1640: Confine untrusted archive extraction under the destination root#3815
Open
mitchell-as wants to merge 1 commit into
Open
ENG-1640: Confine untrusted archive extraction under the destination root#3815mitchell-as wants to merge 1 commit into
mitchell-as wants to merge 1 commit into
Conversation
…1640) Private ingredient wheels come from untrusted sources, so their extraction must not be able to write or point anywhere outside the destination directory. Unarchive now takes a WithUntrustedSource option. When set, every entry path, symlink target, and hardlink target is confined under the destination root and anything that would escape aborts extraction. It is off by default: trusted Platform artifacts may legitimately contain absolute symlinks (for example into /usr/share), so their extraction is unchanged. The ENG-1635 decrypt path will extract private wheels WithUntrustedSource; per- user isolation of decrypted content and the decrypt temp dir are handled there. testfile.tar.gz is a contained fixture backing the successful-extraction test; the previous fixture, which has a root-level escaping symlink, is renamed to testfile-escapes.tar.gz and backs the rejection test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5af4724 to
6779777
Compare
Collaborator
Author
|
Test failures are known or sporadic and unrelated to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ENG-1640: Contain decrypted installs: path sanitization, private temps, user isolation
Part of the private ingredient work (ENG-1563). Private ingredient wheels come from untrusted sources, so their extraction must not be able to write or point anywhere outside the destination directory.
Unarchivenow takes aWithUntrustedSourceoption. When set, every entry path, symlink target, and hardlink target is confined under the destination root, and anything that escapes aborts extraction. It's off by default — trusted Platform artifacts may legitimately contain absolute symlinks (e.g. into/usr/share), so their extraction is unchanged. The decrypt-and-install path (ENG-1635) will extract private wheels with this option.Scope: just the extraction sanitizer. The decrypt temp dir and per-user isolation of decrypted content are deferred to ENG-1635, where they're applied at the deploy site.
Base branch: targets
mitchell/eng-1632(in review) so the diff is only this change; GitHub will retarget it toversion/0-48-1-RC2once the upstream PRs land.Tested with successful and rejected (untrusted) tar.gz fixtures, the same escaping archive extracting when trusted, a zip happy path, and contained symlink/hardlink extraction.
🤖 Generated with Claude Code