How to make CodeQL understand that log injection is being sanitized? #10702
-
I have a case where a user input My first sanitization attempt was a whitelist approach where only the expected characters are allowed.
When CodeQL didn't get that, I added an example from right out of the CodeQL documentation where newlines are explicitly removed.
I can see in the alert that the sanitization code is in the path, but the alert is still there. Can CodeQL detect sanitization by itself at all, or is a "False Positive" flag the only way around this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi I think the query is maybe lacking appropriate sanitizers, but I'll let @github/codeql-java have a further look. |
Beta Was this translation helpful? Give feedback.
-
Hey @Sarastro72, @hvitved is right. Our log injection query was missing some sanitizers to match the recommendations given in the query help. This is addressed in #10707, thanks for reporting the issue. |
Beta Was this translation helpful? Give feedback.
-
Thank you for a very fast reply and PR! ⭐ |
Beta Was this translation helpful? Give feedback.
Hey @Sarastro72,
@hvitved is right. Our log injection query was missing some sanitizers to match the recommendations given in the query help.
This is addressed in #10707, thanks for reporting the issue.