@@ -11,9 +11,11 @@ import semmle.code.java.dataflow.FlowSources
11
11
import semmle.code.java.security.QueryInjection
12
12
13
13
/**
14
+ * DEPRECATED: Use `QueryInjectionFlow` instead.
15
+ *
14
16
* A taint-tracking configuration for unvalidated user input that is used in SQL queries.
15
17
*/
16
- class QueryInjectionFlowConfig extends TaintTracking:: Configuration {
18
+ deprecated class QueryInjectionFlowConfig extends TaintTracking:: Configuration {
17
19
QueryInjectionFlowConfig ( ) { this = "SqlInjectionLib::QueryInjectionFlowConfig" }
18
20
19
21
override predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
@@ -31,12 +33,34 @@ class QueryInjectionFlowConfig extends TaintTracking::Configuration {
31
33
}
32
34
}
33
35
36
+ /**
37
+ * A taint-tracking configuration for unvalidated user input that is used in SQL queries.
38
+ */
39
+ private module QueryInjectionFlowConfig implements DataFlow:: ConfigSig {
40
+ predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
41
+
42
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof QueryInjectionSink }
43
+
44
+ predicate isBarrier ( DataFlow:: Node node ) {
45
+ node .getType ( ) instanceof PrimitiveType or
46
+ node .getType ( ) instanceof BoxedType or
47
+ node .getType ( ) instanceof NumberType
48
+ }
49
+
50
+ predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
51
+ any ( AdditionalQueryInjectionTaintStep s ) .step ( node1 , node2 )
52
+ }
53
+ }
54
+
55
+ /** Tracks flow of unvalidated user input that is used in SQL queries. */
56
+ module QueryInjectionFlow = TaintTracking:: Make< QueryInjectionFlowConfig > ;
57
+
34
58
/**
35
59
* Implementation of `SqlTainted.ql`. This is extracted to a QLL so that it
36
60
* can be excluded from `SqlConcatenated.ql` to avoid overlapping results.
37
61
*/
38
62
predicate queryTaintedBy (
39
- QueryInjectionSink query , DataFlow :: PathNode source , DataFlow :: PathNode sink
63
+ QueryInjectionSink query , QueryInjectionFlow :: PathNode source , QueryInjectionFlow :: PathNode sink
40
64
) {
41
- exists ( QueryInjectionFlowConfig conf | conf . hasFlowPath ( source , sink ) and sink .getNode ( ) = query )
65
+ QueryInjectionFlow :: hasFlowPath ( source , sink ) and sink .getNode ( ) = query
42
66
}
0 commit comments