Skip to content

Conversation

@amezng
Copy link
Contributor

@amezng amezng commented Jan 14, 2025

Fixes https://github.com/torqbit/torqbit/security/code-scanning/49

To fix the problem, we need to ensure that the sourcePath is validated before it is used to read the file. We can achieve this by normalizing the path and ensuring it is within a designated safe directory. This will prevent path traversal attacks.

  1. Normalize the sourcePath using path.resolve.
  2. Check that the normalized path starts with the designated safe directory.
  3. If the path is not valid, handle the error appropriately.

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

…sion

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