Skip to content

Commit cbfa1cd

Browse files
authored
Merge pull request #2168 from xiemaisi/js/remove-duplicate-configuration
Approved by erik-krogh
2 parents 72de1b2 + b920337 commit cbfa1cd

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/CommandInjection.qll

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,43 +36,4 @@ module CommandInjection {
3636
override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
3737
}
3838

39-
/**
40-
* Auxiliary data flow configuration for tracking string literals that look like they
41-
* may refer to an operating system shell, and array literals that may end up being
42-
* interpreted as argument lists for system commands.
43-
*/
44-
class ArgumentListTracking extends DataFlow::Configuration {
45-
ArgumentListTracking() { this = "ArgumentListTracking" }
46-
47-
override predicate isSource(DataFlow::Node nd) {
48-
nd instanceof DataFlow::ArrayCreationNode
49-
or
50-
exists(ConstantString shell | shellCmd(shell, _) | nd = DataFlow::valueNode(shell))
51-
}
52-
53-
override predicate isSink(DataFlow::Node nd) {
54-
exists(SystemCommandExecution sys |
55-
nd = sys.getACommandArgument() or
56-
nd = sys.getArgumentList()
57-
)
58-
}
59-
}
60-
61-
/**
62-
* Holds if `shell arg <cmd>` runs `<cmd>` as a shell command.
63-
*
64-
* That is, either `shell` is a Unix shell (`sh` or similar) and
65-
* `arg` is `"-c"`, or `shell` is `cmd.exe` and `arg` is `"/c"`.
66-
*/
67-
private predicate shellCmd(ConstantString shell, string arg) {
68-
exists(string s | s = shell.getStringValue() |
69-
(s = "sh" or s = "bash" or s = "/bin/sh" or s = "/bin/bash") and
70-
arg = "-c"
71-
)
72-
or
73-
exists(string s | s = shell.getStringValue().toLowerCase() |
74-
(s = "cmd" or s = "cmd.exe") and
75-
(arg = "/c" or arg = "/C")
76-
)
77-
}
7839
}

0 commit comments

Comments
 (0)