@@ -11,9 +11,11 @@ import semmle.code.java.dataflow.FlowSources
1111import semmle.code.java.security.QueryInjection
1212
1313/**
14+ * DEPRECATED: Use `QueryInjectionFlow` instead.
15+ *
1416 * A taint-tracking configuration for unvalidated user input that is used in SQL queries.
1517 */
16- class QueryInjectionFlowConfig extends TaintTracking:: Configuration {
18+ deprecated class QueryInjectionFlowConfig extends TaintTracking:: Configuration {
1719 QueryInjectionFlowConfig ( ) { this = "SqlInjectionLib::QueryInjectionFlowConfig" }
1820
1921 override predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
@@ -31,12 +33,34 @@ class QueryInjectionFlowConfig extends TaintTracking::Configuration {
3133 }
3234}
3335
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+
3458/**
3559 * Implementation of `SqlTainted.ql`. This is extracted to a QLL so that it
3660 * can be excluded from `SqlConcatenated.ql` to avoid overlapping results.
3761 */
3862predicate queryTaintedBy (
39- QueryInjectionSink query , DataFlow :: PathNode source , DataFlow :: PathNode sink
63+ QueryInjectionSink query , QueryInjectionFlow :: PathNode source , QueryInjectionFlow :: PathNode sink
4064) {
41- exists ( QueryInjectionFlowConfig conf | conf . hasFlowPath ( source , sink ) and sink .getNode ( ) = query )
65+ QueryInjectionFlow :: hasFlowPath ( source , sink ) and sink .getNode ( ) = query
4266}
0 commit comments