11import java
22import semmle.code.java.dataflow.FlowSources
33import semmle.code.java.dataflow.TaintTracking
4- import DataFlow:: PathGraph
54
65/**
76 * A taint-tracking configuration for unsafe user input
@@ -54,7 +53,7 @@ class MvelEvaluationSink extends DataFlow::ExprNode {
5453 m instanceof CompiledScriptEvaluationMethod or
5554 m instanceof MvelCompiledScriptEvaluationMethod
5655 ) and
57- ( ma = asExpr ( ) or ma .getQualifier ( ) = asExpr ( ) )
56+ ma .getQualifier ( ) = asExpr ( )
5857 )
5958 or
6059 exists ( StaticMethodAccess ma , Method m | m = ma .getMethod ( ) |
@@ -73,7 +72,7 @@ predicate expressionCompilationStep(DataFlow::Node node1, DataFlow::Node node2)
7372 m .getDeclaringType ( ) instanceof MVEL and
7473 m .hasName ( "compileExpression" ) and
7574 ma .getAnArgument ( ) = node1 .asExpr ( ) and
76- ( node2 .asExpr ( ) = ma . getQualifier ( ) or node2 . asExpr ( ) = ma )
75+ node2 .asExpr ( ) = ma
7776 )
7877}
7978
@@ -84,7 +83,7 @@ predicate expressionCompilationStep(DataFlow::Node node1, DataFlow::Node node2)
8483predicate createExpressionCompilerStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
8584 exists ( ConstructorCall cc |
8685 cc .getConstructedType ( ) instanceof ExpressionCompiler and
87- ( cc = node2 .asExpr ( ) or cc . getQualifier ( ) = node2 . asExpr ( ) ) and
86+ cc = node2 .asExpr ( ) and
8887 cc .getArgument ( 0 ) = node1 .asExpr ( )
8988 )
9089}
@@ -96,7 +95,7 @@ predicate createExpressionCompilerStep(DataFlow::Node node1, DataFlow::Node node
9695predicate createCompiledAccExpressionStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
9796 exists ( ConstructorCall cc |
9897 cc .getConstructedType ( ) instanceof CompiledAccExpression and
99- ( cc = node2 .asExpr ( ) or cc . getQualifier ( ) = node2 . asExpr ( ) ) and
98+ cc = node2 .asExpr ( ) and
10099 cc .getArgument ( 0 ) = node1 .asExpr ( )
101100 )
102101}
@@ -125,7 +124,7 @@ predicate expressionCompilerCompileStep(DataFlow::Node node1, DataFlow::Node nod
125124predicate scriptCompileStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
126125 exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
127126 m instanceof MvelScriptEngineCompilationMethod and
128- ( ma = node2 .asExpr ( ) or ma . getQualifier ( ) = node2 . asExpr ( ) ) and
127+ ma = node2 .asExpr ( ) and
129128 ma .getArgument ( 0 ) = node1 .asExpr ( )
130129 )
131130}
@@ -137,7 +136,7 @@ predicate scriptCompileStep(DataFlow::Node node1, DataFlow::Node node2) {
137136predicate createMvelCompiledScriptStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
138137 exists ( ConstructorCall cc |
139138 cc .getConstructedType ( ) instanceof MvelCompiledScript and
140- ( cc = node2 .asExpr ( ) or cc . getQualifier ( ) = node2 . asExpr ( ) ) and
139+ cc = node2 .asExpr ( ) and
141140 cc .getArgument ( 1 ) = node1 .asExpr ( )
142141 )
143142}
@@ -149,7 +148,7 @@ predicate createMvelCompiledScriptStep(DataFlow::Node node1, DataFlow::Node node
149148predicate createTemplateCompilerStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
150149 exists ( ConstructorCall cc |
151150 cc .getConstructedType ( ) instanceof TemplateCompiler and
152- ( cc = node2 .asExpr ( ) or cc . getQualifier ( ) = node2 . asExpr ( ) ) and
151+ cc = node2 .asExpr ( ) and
153152 cc .getArgument ( 0 ) = node1 .asExpr ( )
154153 )
155154}
@@ -167,7 +166,7 @@ predicate templateCompileStep(DataFlow::Node node1, DataFlow::Node node2) {
167166 or
168167 exists ( StaticMethodAccess ma , Method m | ma .getMethod ( ) = m |
169168 m instanceof TemplateCompilerCompileTemplateMethod and
170- ( ma = node2 .asExpr ( ) or ma . getQualifier ( ) = node2 . asExpr ( ) ) and
169+ ma = node2 .asExpr ( ) and
171170 ma .getArgument ( 0 ) = node1 .asExpr ( )
172171 )
173172}
0 commit comments