Skip to content

Commit b5d08ad

Browse files
committed
Formatting
1 parent 3bc7cf6 commit b5d08ad

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

java/ql/src/experimental/Security/CWE/CWE-078/CommandInjectionRuntimeExec.ql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ import ExecUserFlow::PathGraph
1717
class RemoteSource extends Source instanceof RemoteFlowSource { }
1818

1919
from
20-
ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink,
21-
MethodAccess call, DataFlow::Node sourceCmd, DataFlow::Node sinkCmd
22-
where
23-
callIsTaintedByUserInputAndDangerousCommand(call, source, sink, sourceCmd, sinkCmd)
20+
ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink, MethodAccess call,
21+
DataFlow::Node sourceCmd, DataFlow::Node sinkCmd
22+
where callIsTaintedByUserInputAndDangerousCommand(call, source, sink, sourceCmd, sinkCmd)
2423
select sink, source, sink,
2524
"Call to dangerous java.lang.Runtime.exec() with command '$@' with arg from untrusted input '$@'",
2625
sourceCmd, sourceCmd.toString(), source.getNode(), source.toString()

java/ql/src/experimental/Security/CWE/CWE-078/CommandInjectionRuntimeExec.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ deprecated class ExecTaintConfiguration2 extends TaintTracking::Configuration {
8989
}
9090

9191
module ExecUserFlowConfig implements DataFlow::ConfigSig {
92-
predicate isSource(DataFlow::Node source) {
93-
source instanceof Source
94-
}
92+
predicate isSource(DataFlow::Node source) { source instanceof Source }
9593

9694
predicate isSink(DataFlow::Node sink) {
9795
exists(RuntimeExecMethod method, MethodAccess call |
@@ -155,7 +153,10 @@ class UnSafeExecutable extends string {
155153
}
156154
}
157155

158-
predicate callIsTaintedByUserInputAndDangerousCommand(MethodAccess call, ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink, DataFlow::Node sourceCmd, DataFlow::Node sinkCmd) {
156+
predicate callIsTaintedByUserInputAndDangerousCommand(
157+
MethodAccess call, ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink,
158+
DataFlow::Node sourceCmd, DataFlow::Node sinkCmd
159+
) {
159160
call.getMethod() instanceof RuntimeExecMethod and
160161
// this is a command-accepting call to exec, e.g. rt.exec(new String[]{"/bin/sh", ...})
161162
(
@@ -167,4 +168,4 @@ predicate callIsTaintedByUserInputAndDangerousCommand(MethodAccess call, ExecUse
167168
ExecUserFlow::flowPath(source, sink) and
168169
sink.getNode().asExpr() = call.getArgument(0)
169170
)
170-
}
171+
}

java/ql/src/experimental/Security/CWE/CWE-078/CommandInjectionRuntimeExecLocal.ql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ import ExecUserFlow::PathGraph
1818
class LocalSource extends Source instanceof LocalUserInput { }
1919

2020
from
21-
ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink,
22-
MethodAccess call, DataFlow::Node sourceCmd, DataFlow::Node sinkCmd
23-
where
24-
callIsTaintedByUserInputAndDangerousCommand(call, source, sink, sourceCmd, sinkCmd)
21+
ExecUserFlow::PathNode source, ExecUserFlow::PathNode sink, MethodAccess call,
22+
DataFlow::Node sourceCmd, DataFlow::Node sinkCmd
23+
where callIsTaintedByUserInputAndDangerousCommand(call, source, sink, sourceCmd, sinkCmd)
2524
select sink, source, sink,
2625
"Call to dangerous java.lang.Runtime.exec() with command '$@' with arg from untrusted input '$@'",
2726
sourceCmd, sourceCmd.toString(), source.getNode(), source.toString()

0 commit comments

Comments
 (0)