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

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yarlson
Copy link
Owner

@yarlson yarlson commented Nov 4, 2024

Fixes https://github.com/yarlson/ftl/security/code-scanning/6

To fix the problem, we need to ensure that the paths extracted from the tar archive do not contain any directory traversal sequences like ... This can be done by validating the header.Name before using it to construct the target path. We should also ensure that the target path is within the intended destination directory.

  1. Add a check to ensure that header.Name does not contain ...
  2. Use filepath.Clean to normalize the path and ensure it is within the destPath directory.

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>
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