@@ -8,9 +8,11 @@ import semmle.code.java.dataflow.FlowSources
8
8
import semmle.code.java.security.RequestForgery
9
9
10
10
/**
11
+ * DEPRECATED: Use `RequestForgeryConfiguration` module instead.
12
+ *
11
13
* A taint-tracking configuration characterising request-forgery risks.
12
14
*/
13
- class RequestForgeryConfiguration extends TaintTracking:: Configuration {
15
+ deprecated class RequestForgeryConfiguration extends TaintTracking:: Configuration {
14
16
RequestForgeryConfiguration ( ) { this = "Server-Side Request Forgery" }
15
17
16
18
override predicate isSource ( DataFlow:: Node source ) {
@@ -29,3 +31,26 @@ class RequestForgeryConfiguration extends TaintTracking::Configuration {
29
31
30
32
override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof RequestForgerySanitizer }
31
33
}
34
+
35
+ /**
36
+ * A taint-tracking configuration characterising request-forgery risks.
37
+ */
38
+ module RequestForgeryConfiguration implements DataFlow:: ConfigSig {
39
+ predicate isSource ( DataFlow:: Node source ) {
40
+ source instanceof RemoteFlowSource and
41
+ // Exclude results of remote HTTP requests: fetching something else based on that result
42
+ // is no worse than following a redirect returned by the remote server, and typically
43
+ // we're requesting a resource via https which we trust to only send us to safe URLs.
44
+ not source .asExpr ( ) .( MethodAccess ) .getCallee ( ) instanceof UrlConnectionGetInputStreamMethod
45
+ }
46
+
47
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof RequestForgerySink }
48
+
49
+ predicate isAdditionalFlowStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
50
+ any ( RequestForgeryAdditionalTaintStep r ) .propagatesTaint ( pred , succ )
51
+ }
52
+
53
+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof RequestForgerySanitizer }
54
+ }
55
+
56
+ module RequestForgeryFlow = TaintTracking:: Make< RequestForgeryConfiguration > ;
0 commit comments