@@ -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 }
@@ -33,12 +35,52 @@ class RemoteUserInputToArgumentToExecFlowConfig extends TaintTracking::Configura
3335}
3436
3537/**
38+ * A taint-tracking configuration for unvalidated user input that is used to run an external process.
39+ */
40+ 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+ /**
55+ * Taint-tracking flow for unvalidated user input that is used to run an external process.
56+ */
57+ module RemoteUserInputToArgumentToExecFlow =
58+ TaintTracking:: Global< RemoteUserInputToArgumentToExecFlowConfig > ;
59+
60+ /**
61+ * DEPRECATED: Use `execIsTainted` instead.
62+ *
3663 * Implementation of `ExecTainted.ql`. It is extracted to a QLL
3764 * so that it can be excluded from `ExecUnescaped.ql` to avoid
3865 * reporting overlapping results.
3966 */
40- predicate execTainted ( DataFlow:: PathNode source , DataFlow:: PathNode sink , ArgumentToExec execArg ) {
67+ deprecated predicate execTainted (
68+ DataFlow:: PathNode source , DataFlow:: PathNode sink , ArgumentToExec execArg
69+ ) {
4170 exists ( RemoteUserInputToArgumentToExecFlowConfig conf |
4271 conf .hasFlowPath ( source , sink ) and sink .getNode ( ) = DataFlow:: exprNode ( execArg )
4372 )
4473}
74+
75+ /**
76+ * Implementation of `ExecTainted.ql`. It is extracted to a QLL
77+ * so that it can be excluded from `ExecUnescaped.ql` to avoid
78+ * reporting overlapping results.
79+ */
80+ predicate execIsTainted (
81+ RemoteUserInputToArgumentToExecFlow:: PathNode source ,
82+ RemoteUserInputToArgumentToExecFlow:: PathNode sink , ArgumentToExec execArg
83+ ) {
84+ RemoteUserInputToArgumentToExecFlow:: flowPath ( source , sink ) and
85+ sink .getNode ( ) = DataFlow:: exprNode ( execArg )
86+ }
0 commit comments