-
Hey, I'm pretty new to CodeQL and I haven’t been able to determine if a case I have in mind can be written as a CodeQL query. I want to check if a Ex: Public UnsecureFunction() {
// Do something with the user input
}
Public VerifyInput() {
// Make sure user input doesn't have anything malicious
}
// Say it is URL type variable
URL myUrl = "https://google.com" Now I want to make sure that before the code does So a code that should be flagged looks like this:
And the code which shouldn't be flagged looks like this:
or even something like:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Just wanted to say that language is Java |
Beta Was this translation helpful? Give feedback.
-
You would write a CodeQL query for this kind of thing using the taint tracking library. The concept you are looking for is a I think questions about CodeQL might get a better response in the codeql repo, where I see you've already posted a different question. |
Beta Was this translation helpful? Give feedback.
-
See github/codeql#3358, which might help. |
Beta Was this translation helpful? Give feedback.
-
You may also want to watch the second episode of LiveQL where we discussed a similar issue. TL;DR; You need to add a sanitizer that checks basic block dominance |
Beta Was this translation helpful? Give feedback.
You would write a CodeQL query for this kind of thing using the taint tracking library. The concept you are looking for is a
SanitizerGuard
. There's a simpler concept called aSanitizer
, which it is probalby easier to learn about first.I think questions about CodeQL might get a better response in the codeql repo, where I see you've already posted a different question.