File tree Expand file tree Collapse file tree
java/ql/src/Security/CWE/CWE-918 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ import DataFlow::PathGraph
1818class RequestForgeryConfiguration extends TaintTracking:: Configuration {
1919 RequestForgeryConfiguration ( ) { this = "Server Side Request Forgery" }
2020
21- override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
21+ override predicate isSource ( DataFlow:: Node source ) {
22+ source instanceof RemoteFlowSource and
23+ // Exclude results of remote HTTP requests: fetching something else based on that result
24+ // is no worse than following a redirect returned by the remote server, and typically
25+ // we're requesting a resource via https which we trust to only send us to safe URLs.
26+ not source .asExpr ( ) .( MethodAccess ) .getCallee ( ) instanceof URLConnectionGetInputStreamMethod
27+ }
2228
2329 override predicate isSink ( DataFlow:: Node sink ) { sink instanceof RequestForgerySink }
2430
You can’t perform that action at this time.
0 commit comments