@@ -12,9 +12,11 @@ import semmle.code.java.security.ExternalProcess
12
12
import semmle.code.java.security.CommandArguments
13
13
14
14
/**
15
+ * DEPRECATED: Use `RemoteUserInputToArgumentToExecFlow` instead.
16
+ *
15
17
* A taint-tracking configuration for unvalidated user input that is used to run an external process.
16
18
*/
17
- class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking:: Configuration {
19
+ deprecated class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking:: Configuration {
18
20
RemoteUserInputToArgumentToExecFlowConfig ( ) {
19
21
this = "ExecCommon::RemoteUserInputToArgumentToExecFlowConfig"
20
22
}
@@ -32,13 +34,35 @@ class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking::Configura
32
34
}
33
35
}
34
36
37
+ /**
38
+ * A taint-tracking configuration for unvalidated user input that is used to run an external process.
39
+ */
40
+ private module RemoteUserInputToArgumentToExecFlowConfig implements DataFlow:: ConfigSig {
41
+ predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
42
+
43
+ predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) instanceof ArgumentToExec }
44
+
45
+ predicate isBarrier ( DataFlow:: Node node ) {
46
+ node .getType ( ) instanceof PrimitiveType
47
+ or
48
+ node .getType ( ) instanceof BoxedType
49
+ or
50
+ isSafeCommandArgument ( node .asExpr ( ) )
51
+ }
52
+ }
53
+
54
+ module RemoteUserInputToArgumentToExecFlow =
55
+ TaintTracking:: Make< RemoteUserInputToArgumentToExecFlowConfig > ;
56
+
35
57
/**
36
58
* Implementation of `ExecTainted.ql`. It is extracted to a QLL
37
59
* so that it can be excluded from `ExecUnescaped.ql` to avoid
38
60
* reporting overlapping results.
39
61
*/
40
- predicate execTainted ( DataFlow:: PathNode source , DataFlow:: PathNode sink , ArgumentToExec execArg ) {
41
- exists ( RemoteUserInputToArgumentToExecFlowConfig conf |
42
- conf .hasFlowPath ( source , sink ) and sink .getNode ( ) = DataFlow:: exprNode ( execArg )
43
- )
62
+ predicate execTainted (
63
+ RemoteUserInputToArgumentToExecFlow:: PathNode source ,
64
+ RemoteUserInputToArgumentToExecFlow:: PathNode sink , ArgumentToExec execArg
65
+ ) {
66
+ RemoteUserInputToArgumentToExecFlow:: hasFlowPath ( source , sink ) and
67
+ sink .getNode ( ) = DataFlow:: exprNode ( execArg )
44
68
}
0 commit comments