Skip to content

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

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

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

Conversation

frajavapu
Copy link
Owner

Fixes https://github.com/frajavapu/code-scanning-javascript-demo/security/code-scanning/1

To fix the problem, we need to ensure that header.linkname does not contain any directory traversal sequences like ... This can be done by validating the path before using it in file system operations. Specifically, we should check that header.linkname does not contain .. and is a relative path.

  1. Add a validation function to check for directory traversal sequences.
  2. Use this validation function before constructing srcpath and performing file system operations.

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