@@ -8,9 +8,11 @@ import semmle.code.java.dataflow.FlowSources
88import semmle.code.java.security.RequestForgery
99
1010/**
11+ * DEPRECATED: Use `RequestForgeryConfiguration` module instead.
12+ *
1113 * A taint-tracking configuration characterising request-forgery risks.
1214 */
13- class RequestForgeryConfiguration extends TaintTracking:: Configuration {
15+ deprecated class RequestForgeryConfiguration extends TaintTracking:: Configuration {
1416 RequestForgeryConfiguration ( ) { this = "Server-Side Request Forgery" }
1517
1618 override predicate isSource ( DataFlow:: Node source ) {
@@ -29,3 +31,26 @@ class RequestForgeryConfiguration extends TaintTracking::Configuration {
2931
3032 override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof RequestForgerySanitizer }
3133}
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