mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
24 lines
677 B
Plaintext
24 lines
677 B
Plaintext
import javascript
|
|
|
|
class Assertion extends DataFlow::CallNode {
|
|
Assertion() {
|
|
getCalleeName() = "checkEscaped" or
|
|
getCalleeName() = "checkStripped" or
|
|
getCalleeName() = "checkNotEscaped"
|
|
}
|
|
|
|
predicate shouldBeSanitizer() { getCalleeName() != "checkNotEscaped" }
|
|
|
|
string getMessage() {
|
|
if shouldBeSanitizer() and not getArgument(0) instanceof HtmlSanitizerCall
|
|
then result = "Should be marked as sanitizer"
|
|
else
|
|
if not shouldBeSanitizer() and getArgument(0) instanceof HtmlSanitizerCall
|
|
then result = "Should not be marked as sanitizer"
|
|
else result = "OK"
|
|
}
|
|
}
|
|
|
|
from Assertion assertion
|
|
select assertion, assertion.getMessage()
|