Nettacker
Nettacker copied to clipboard
Fix code scanning alert no. 28: Uncontrolled data used in path expression
Fixes https://github.com/OWASP/Nettacker/security/code-scanning/28
To fix the problem, we need to ensure that the filename parameter is securely validated before being used to access the file system. The best way to do this is to:
- Normalize the path to remove any relative path components.
- Ensure that the resulting path is within the intended directory by comparing the common prefix of the normalized path and the base directory.
We will modify the get_file function to include these steps.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.