Skip to content

Commit 7a9a458

Browse files
committed
ci(codeql): update shell sanitizer
1 parent 8639cbe commit 7a9a458

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/codeql/custom-queries-javascript/ShellSanitizer.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import semmle.javascript.security.dataflow.CommandInjectionCustomizations
33

44

55
// General flow via config https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/#sanitizers
6-
// This follows this instead https://github.com/github/codeql/blob/a3e9aed00ae5c1e70da8fbc4fc4a7cc803f177ca/javascript/documentation/library-customization.rst?plain=1#L244-L245
7-
// to modify the pre-defined flow javascript
6+
// Instead this follows https://github.com/github/codeql/blob/a3e9aed00ae5c1e70da8fbc4fc4a7cc803f177ca/javascript/documentation/library-customization.rst?plain=1#L244-L245
7+
// to modify the pre-defined javascript CommandInjection flow's Sanitizer
88

99
/**
1010
* Treat Util.sanitizeShellArg(x) as a sanitizer for shell‑command injection.
1111
*/
1212
class ShellArgSanitizer extends CommandInjection::Sanitizer {
13-
ShellArgSanitizer() {
14-
this.(DataFlow::CallNode).getCalleeName() = "sanitizeShellArg"
15-
}
13+
ShellArgSanitizer() {
14+
this.(DataFlow::MethodCallNode).getReceiver().toString() = "Util" and
15+
this.(DataFlow::MethodCallNode).getMethodName() = "sanitizeShellArg"
16+
}
1617
}

0 commit comments

Comments
 (0)