Skip to content
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

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

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

mvdkleijn
Copy link
Owner

Fixes https://github.com/mvdkleijn/homedash/security/code-scanning/2

To fix the problem, we need to ensure that the paths extracted from the zip file do not contain any directory traversal elements like ... This can be achieved by checking the path components and ensuring they do not navigate outside the intended directory.

  • We will add a check to ensure that the file.Name does not contain any .. elements.
  • If the path is found to be safe, we proceed with the extraction; otherwise, we skip the file and log a warning.

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>
@mvdkleijn mvdkleijn marked this pull request as ready for review October 7, 2024 09:11
@mvdkleijn mvdkleijn merged commit b34a63b into main Oct 7, 2024
3 checks passed
@mvdkleijn mvdkleijn deleted the autofix/alert-2-2b210928fb branch October 7, 2024 09:12
@mvdkleijn mvdkleijn changed the title Fix code scanning alert no. 2: Arbitrary file access during archive extraction ("Zip Slip") bug: Fix code scanning alert no. 2: Arbitrary file access during archive extraction ("Zip Slip") Oct 7, 2024
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