Skip to content

Fix code scanning alert no. 2: Arbitrary file access during archive extraction ("Zip Slip") #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

marcelloraffaele
Copy link
Owner

Fixes https://github.com/marcelloraffaele/TechExcel-Accelerate-developer-productivity-with-GitHub-Copilot-and-Dev-Box/security/code-scanning/2

To fix the problem, we need to ensure that the output paths constructed from zip archive entries are validated to prevent writing files to unexpected locations. This involves:

  1. Using Path.GetFullPath to resolve any directory traversal elements in the combined path.
  2. Ensuring the destination directory path ends with a directory separator character before resolving its full path.
  3. Validating that the resolved output path starts with the resolved destination directory path.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…xtraction ("Zip Slip")

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@marcelloraffaele marcelloraffaele marked this pull request as ready for review October 30, 2024 12:45
@marcelloraffaele marcelloraffaele merged commit 4d664c6 into main Oct 30, 2024
8 checks passed
@marcelloraffaele marcelloraffaele deleted the alert-autofix-2 branch October 30, 2024 13:21
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.

1 participant