@@ -12,9 +12,11 @@ import semmle.code.java.security.ExternalProcess
1212import semmle.code.java.security.CommandArguments
1313
1414/**
15+ * DEPRECATED: Use `RemoteUserInputToArgumentToExecFlow` instead.
16+ *
1517 * A taint-tracking configuration for unvalidated user input that is used to run an external process.
1618 */
17- class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking:: Configuration {
19+ deprecated class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking:: Configuration {
1820 RemoteUserInputToArgumentToExecFlowConfig ( ) {
1921 this = "ExecCommon::RemoteUserInputToArgumentToExecFlowConfig"
2022 }
@@ -32,13 +34,35 @@ class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking::Configura
3234 }
3335}
3436
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+
3557/**
3658 * Implementation of `ExecTainted.ql`. It is extracted to a QLL
3759 * so that it can be excluded from `ExecUnescaped.ql` to avoid
3860 * reporting overlapping results.
3961 */
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 )
4468}
0 commit comments