Skip to content

Conversation

@pixee-demo
Copy link

@pixee-demo pixee-demo bot commented Mar 13, 2025

✨✨✨

Remediation

This change fixes "csharp/PT" (id = csharp/PT) identified by Snyk.

Details

Path Traversal is a security vulnerability that allows attackers to access files and directories outside the intended directory by manipulating file paths. This can lead to unauthorized access to sensitive files and data. The fix involves several steps: checking if the provided path is not null or empty, converting the path to its absolute form, ensuring the absolute path starts with the intended base directory, and throwing an exception if the path is invalid. Additionally, a new method, SanitizePath, was introduced to sanitize the input path by stripping out any directory information, further preventing directory traversal attacks.

@sonarqubecloud
Copy link

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