@@ -5,8 +5,12 @@ import semmle.code.java.dataflow.TaintTracking
5
5
import semmle.code.java.dataflow.FlowSources
6
6
import semmle.code.java.security.TemplateInjection
7
7
8
- /** A taint tracking configuration to reason about server-side template injection (SST) vulnerabilities */
9
- class TemplateInjectionFlowConfig extends TaintTracking:: Configuration {
8
+ /**
9
+ * DEPRECATED: Use `TemplateInjectionFlow` instead.
10
+ *
11
+ * A taint tracking configuration to reason about server-side template injection (SST) vulnerabilities
12
+ */
13
+ deprecated class TemplateInjectionFlowConfig extends TaintTracking:: Configuration {
10
14
TemplateInjectionFlowConfig ( ) { this = "TemplateInjectionFlowConfig" }
11
15
12
16
override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowState state ) {
@@ -36,3 +40,35 @@ class TemplateInjectionFlowConfig extends TaintTracking::Configuration {
36
40
any ( TemplateInjectionAdditionalTaintStep a ) .isAdditionalTaintStep ( node1 , state1 , node2 , state2 )
37
41
}
38
42
}
43
+
44
+ /** A taint tracking configuration to reason about server-side template injection (SST) vulnerabilities */
45
+ private module TemplateInjectionFlowConfig implements DataFlow:: StateConfigSig {
46
+ class FlowState = DataFlow:: FlowState ;
47
+
48
+ predicate isSource ( DataFlow:: Node source , FlowState state ) {
49
+ source .( TemplateInjectionSource ) .hasState ( state )
50
+ }
51
+
52
+ predicate isSink ( DataFlow:: Node sink , FlowState state ) {
53
+ sink .( TemplateInjectionSink ) .hasState ( state )
54
+ }
55
+
56
+ predicate isBarrier ( DataFlow:: Node sanitizer ) { sanitizer instanceof TemplateInjectionSanitizer }
57
+
58
+ predicate isBarrier ( DataFlow:: Node sanitizer , FlowState state ) {
59
+ sanitizer .( TemplateInjectionSanitizerWithState ) .hasState ( state )
60
+ }
61
+
62
+ predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
63
+ any ( TemplateInjectionAdditionalTaintStep a ) .isAdditionalTaintStep ( node1 , node2 )
64
+ }
65
+
66
+ predicate isAdditionalFlowStep (
67
+ DataFlow:: Node node1 , FlowState state1 , DataFlow:: Node node2 , FlowState state2
68
+ ) {
69
+ any ( TemplateInjectionAdditionalTaintStep a ) .isAdditionalTaintStep ( node1 , state1 , node2 , state2 )
70
+ }
71
+ }
72
+
73
+ /** Tracks server-side template injection (SST) vulnerabilities */
74
+ module TemplateInjectionFlow = TaintTracking:: MakeWithState< TemplateInjectionFlowConfig > ;
0 commit comments