@@ -17,12 +17,10 @@ import semmle.code.java.dataflow.FlowSources
17
17
import semmle.code.java.dataflow.TaintTracking
18
18
import experimental.semmle.code.java.frameworks.Jsf
19
19
import semmle.code.java.security.PathSanitizer
20
- import DataFlow :: PathGraph
20
+ import UnsafeUrlForwardFlow :: PathGraph
21
21
22
- class UnsafeUrlForwardFlowConfig extends TaintTracking:: Configuration {
23
- UnsafeUrlForwardFlowConfig ( ) { this = "UnsafeUrlForwardFlowConfig" }
24
-
25
- override predicate isSource ( DataFlow:: Node source ) {
22
+ module UnsafeUrlForwardFlowConfig implements DataFlow:: ConfigSig {
23
+ predicate isSource ( DataFlow:: Node source ) {
26
24
source instanceof RemoteFlowSource and
27
25
not exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
28
26
(
@@ -34,18 +32,16 @@ class UnsafeUrlForwardFlowConfig extends TaintTracking::Configuration {
34
32
)
35
33
}
36
34
37
- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof UnsafeUrlForwardSink }
35
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof UnsafeUrlForwardSink }
38
36
39
- override predicate isSanitizer ( DataFlow:: Node node ) {
37
+ predicate isBarrier ( DataFlow:: Node node ) {
40
38
node instanceof UnsafeUrlForwardSanitizer or
41
39
node instanceof PathInjectionSanitizer
42
40
}
43
41
44
- override DataFlow:: FlowFeature getAFeature ( ) {
45
- result instanceof DataFlow:: FeatureHasSourceCallContext
46
- }
42
+ DataFlow:: FlowFeature getAFeature ( ) { result instanceof DataFlow:: FeatureHasSourceCallContext }
47
43
48
- override predicate isAdditionalTaintStep ( DataFlow:: Node prev , DataFlow:: Node succ ) {
44
+ predicate isAdditionalFlowStep ( DataFlow:: Node prev , DataFlow:: Node succ ) {
49
45
exists ( MethodAccess ma |
50
46
(
51
47
ma .getMethod ( ) instanceof GetServletResourceMethod or
@@ -60,7 +56,9 @@ class UnsafeUrlForwardFlowConfig extends TaintTracking::Configuration {
60
56
}
61
57
}
62
58
63
- from DataFlow:: PathNode source , DataFlow:: PathNode sink , UnsafeUrlForwardFlowConfig conf
64
- where conf .hasFlowPath ( source , sink )
59
+ module UnsafeUrlForwardFlow = TaintTracking:: Global< UnsafeUrlForwardFlowConfig > ;
60
+
61
+ from UnsafeUrlForwardFlow:: PathNode source , UnsafeUrlForwardFlow:: PathNode sink
62
+ where UnsafeUrlForwardFlow:: flowPath ( source , sink )
65
63
select sink .getNode ( ) , source , sink , "Potentially untrusted URL forward due to $@." ,
66
64
source .getNode ( ) , "user-provided value"
0 commit comments