@@ -16,16 +16,13 @@ import semmle.code.java.Expr
16
16
import semmle.code.java.dataflow.FlowSources
17
17
import semmle.code.java.security.ExternalProcess
18
18
import semmle.code.java.security.CommandArguments
19
- import DataFlow:: PathGraph
20
19
21
- class LocalUserInputToArgumentToExecFlowConfig extends TaintTracking :: Configuration {
22
- LocalUserInputToArgumentToExecFlowConfig ( ) { this = "LocalUserInputToArgumentToExecFlowConfig" }
20
+ private module LocalUserInputToArgumentToExecFlowConfig implements DataFlow :: ConfigSig {
21
+ predicate isSource ( DataFlow :: Node src ) { src instanceof LocalUserInput }
23
22
24
- override predicate isSource ( DataFlow:: Node src ) { src instanceof LocalUserInput }
23
+ predicate isSink ( DataFlow:: Node sink ) { sink . asExpr ( ) instanceof ArgumentToExec }
25
24
26
- override predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) instanceof ArgumentToExec }
27
-
28
- override predicate isSanitizer ( DataFlow:: Node node ) {
25
+ predicate isBarrier ( DataFlow:: Node node ) {
29
26
node .getType ( ) instanceof PrimitiveType
30
27
or
31
28
node .getType ( ) instanceof BoxedType
@@ -34,9 +31,16 @@ class LocalUserInputToArgumentToExecFlowConfig extends TaintTracking::Configurat
34
31
}
35
32
}
36
33
34
+ module LocalUserInputToArgumentToExecFlow =
35
+ TaintTracking:: Make< LocalUserInputToArgumentToExecFlowConfig > ;
36
+
37
+ import LocalUserInputToArgumentToExecFlow:: PathGraph
38
+
37
39
from
38
- DataFlow:: PathNode source , DataFlow:: PathNode sink , ArgumentToExec execArg ,
39
- LocalUserInputToArgumentToExecFlowConfig conf
40
- where conf .hasFlowPath ( source , sink ) and sink .getNode ( ) .asExpr ( ) = execArg
40
+ LocalUserInputToArgumentToExecFlow:: PathNode source ,
41
+ LocalUserInputToArgumentToExecFlow:: PathNode sink , ArgumentToExec execArg
42
+ where
43
+ LocalUserInputToArgumentToExecFlow:: hasFlowPath ( source , sink ) and
44
+ sink .getNode ( ) .asExpr ( ) = execArg
41
45
select execArg , source , sink , "This command line depends on a $@." , source .getNode ( ) ,
42
46
"user-provided value"
0 commit comments