Skip to content

Potential fix for code scanning alert no. 25: Uncontrolled data used in path expression#1

Merged
Yardapestr merged 1 commit intomasterfrom
alert-autofix-25
Apr 4, 2025
Merged

Potential fix for code scanning alert no. 25: Uncontrolled data used in path expression#1
Yardapestr merged 1 commit intomasterfrom
alert-autofix-25

Conversation

@Yardapestr
Copy link

Potential fix for https://github.com/Yardapemines/lightning/security/code-scanning/25

To fix the problem, we need to ensure that the constructed file path is safe and does not allow directory traversal. We can achieve this by normalizing the path and ensuring it is contained within a predefined safe directory. We will use os.path.normpath to normalize the path and then check if the resulting path starts with the safe base directory.

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

…in path expression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Yardapestr Yardapestr marked this pull request as ready for review April 4, 2025 11:20
@Yardapestr Yardapestr merged commit 5bc3843 into master Apr 4, 2025
1 of 4 checks passed
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