bundle.Import: skip dot entries, use filepath.Abs for destDir containment check#345
Merged
intel352 merged 2 commits intoalert-autofix-65from Mar 16, 2026
Merged
bundle.Import: skip dot entries, use filepath.Abs for destDir containment check#345intel352 merged 2 commits intoalert-autofix-65from
intel352 merged 2 commits intoalert-autofix-65from
Conversation
Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [65] Potential fix for uncontrolled data path expression
bundle.Import: skip dot entries, use filepath.Abs for destDir containment check
Mar 16, 2026
intel352
added a commit
that referenced
this pull request
Mar 16, 2026
…in path expression (#344) * Potential fix for code scanning alert no. 65: Uncontrolled data used in path expression Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * bundle.Import: skip dot entries, use filepath.Abs for destDir containment check (#345) * Initial plan * Fix bundle.Import: skip dot entries, use filepath.Abs for destDir Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
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.
Two correctness issues in the path-traversal hardening added to
bundle.Import:tar -czf bundle.tar.gz .emits a top-level.directory entry. The previous fix returned an error onclean == "."— now itcontinues (skips) instead.filepath.Clean(destDir)does not produce an absolute path whendestDiris relative (e.g..), so thestrings.HasPrefixcheck against joined paths could incorrectly reject valid entries. Replaced withfilepath.Abs(destDir).Changes
bundle/import.goclean == "."→continueinstead of returning an errorfilepath.Clean(destDir)→filepath.Abs(destDir)(with error handling) so the containment prefix check operates on true absolute pathsbundle/bundle_test.goTestImportDotDirectoryEntry: tarballs with a.entry succeedTestImportRelativeDestDir: relativedestDirresolves correctly; returnedworkflowPathis absolute✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.