@@ -12,13 +12,33 @@ import semmle.code.powershell.dataflow.TaintTracking
1212import SqlInjectionCustomizations:: SqlInjection
1313import semmle.code.powershell.dataflow.DataFlow
1414
15- private module Config implements DataFlow:: ConfigSig {
16- predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
15+ private module Config implements DataFlow:: StateConfigSig {
16+ newtype FlowState =
17+ additional BeforeConcat ( ) or
18+ additional AfterConcat ( )
1719
18- predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
20+ predicate isSource ( DataFlow:: Node source , FlowState state ) {
21+ source instanceof Source and state = BeforeConcat ( )
22+ }
23+
24+ predicate isSink ( DataFlow:: Node sink , FlowState state ) {
25+ sink instanceof Sink and state = AfterConcat ( )
26+ }
1927
2028 predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
2129
30+ predicate isAdditionalFlowStep (
31+ DataFlow:: Node node1 , FlowState state1 , DataFlow:: Node node2 , FlowState state2
32+ ) {
33+ state1 = BeforeConcat ( ) and
34+ state2 = AfterConcat ( ) and
35+ (
36+ TaintTracking:: stringInterpolationTaintStep ( node1 , node2 )
37+ or
38+ TaintTracking:: operationTaintStep ( node1 , node2 )
39+ )
40+ }
41+
2242 predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet cs ) {
2343 node .( Sink ) .allowImplicitRead ( cs )
2444 }
@@ -27,4 +47,4 @@ private module Config implements DataFlow::ConfigSig {
2747/**
2848 * Taint-tracking for reasoning about SQL-injection vulnerabilities.
2949 */
30- module SqlInjectionFlow = TaintTracking:: Global < Config > ;
50+ module SqlInjectionFlow = TaintTracking:: GlobalWithState < Config > ;
0 commit comments