Add CodeQL recommendation against Path.Combine#18865
Merged
michaelnebel merged 7 commits intogithub:mainfrom Mar 4, 2025
Merged
Add CodeQL recommendation against Path.Combine#18865michaelnebel merged 7 commits intogithub:mainfrom
michaelnebel merged 7 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
csharp/ql/test/query-tests/Bad Practices/Path Combine/PathCombine.cs:3
- [nitpick] The class name 'EmptyCatchBlock' does not convey its purpose related to Path.Combine testing. Consider renaming it to 'PathCombineTest' for better clarity.
class EmptyCatchBlock
Contributor
|
QHelp previews: csharp/ql/src/Bad Practices/PathCombine.qhelpCall to System.IO.Path.Combine
RecommendationUse References
|
Contributor
|
I will start a DCA run to see how this impacts the security and quality suite. |
Contributor
|
DCA looks good. Around 16k results found in our |
michaelnebel
previously approved these changes
Feb 27, 2025
Contributor
michaelnebel
left a comment
There was a problem hiding this comment.
Thank you @carldybdahl-microsoft !
LGTM!
hvitved
reviewed
Feb 27, 2025
b8629d2 to
a3a5a03
Compare
a3a5a03 to
2f7cdf1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs for Path.Combine warns:
Important
This method assumes that the first argument is an absolute path and that the following argument or arguments are relative paths. If this is not the case, and particularly if any subsequent arguments are strings input by the user, call the Join or TryJoin method instead.
This commit adds a corresponding CodeQL query to recommend against Path.Combine.