fix(Untar): ensure files are extracted inside the destination directory - #785
Merged
Conversation
- Verify target paths to prevent extraction outside the destination - Add unit tests for validation of target path and content extraction within destination directory
floreks
requested review from
maciaszczykm,
michaeljguarino and
zreigz
as code owners
July 21, 2026 14:34
Contributor
Greptile SummaryThis PR keeps tar extraction inside the destination directory. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| pkg/utils/tar.go | Adds path validation and root-scoped extraction to keep files within the destination. |
| pkg/utils/tar_test.go | Adds coverage for valid extraction, parent traversal, and pre-existing symlink escapes. |
Reviews (2): Last reviewed commit: "fix(Untar): enhance path security and va..." | Re-trigger Greptile
- Use `os.OpenRoot` and consolidate directory creation - Check local path using `filepath.IsLocal` - Refactor `makeDir` to use `root.MkdirAll` - Improve error messaging for file extraction - Add test to reject symlinks resolving outside the destination
Member
Author
michaeljguarino
approved these changes
Jul 21, 2026
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.
Summary
Labels
Test Plan
Checklist