Skip to content

Conversation

@securebeats
Copy link
Owner

Potential fix for https://github.com/securebeats/skills-secure-repository-supply-chain/security/code-scanning/1

To fix this vulnerability, the code should resolve the full, absolute path of the intended destination file using Path.GetFullPath after combining the destination folder and entry name. Then, determine the absolute path of the destination directory (ensuring it ends with a path separator). Finally, check that the destination file's full path starts with the absolute destination directory path (case-sensitive comparison), and throw an exception if not. This ensures that no archive entry can escape the destination directory through directory traversal or similar path manipulation.

The changes are restricted to the WriteToDirectory method in code/src/Attendee/Attendee.cs. No new methods need to be written; only additional lines added to apply the appropriate validation before extracting the file.

Steps:

  1. Replace the naive path combination with one validated by Path.GetFullPath.
  2. Get the full path of the destination directory with a separator.
  3. Check if the resulting file path starts with the full destination path, abort otherwise.
  4. Only extract if the validation passes.

No new external dependencies are required, only standard .NET libraries already imported.


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

…ring archive extraction ("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.

2 participants