1
- /** Provides classes to reason about Server -side Request Forgery attacks. */
1
+ /** Provides classes to reason about server -side request forgery (SSRF) attacks. */
2
2
3
3
import java
4
4
import semmle.code.java.frameworks.Networking
@@ -58,11 +58,11 @@ private class DefaultRequestForgeryAdditionalTaintStep extends RequestForgeryAdd
58
58
}
59
59
}
60
60
61
- /** A data flow sink for request forgery vulnerabilities. */
61
+ /** A data flow sink for server-side request forgery (SSRF) vulnerabilities. */
62
62
abstract class RequestForgerySink extends DataFlow:: Node { }
63
63
64
64
/**
65
- * An argument to an url `openConnection` or `openStream` call
65
+ * An argument to a url `openConnection` or `openStream` call
66
66
* taken as a sink for request forgery vulnerabilities.
67
67
*/
68
68
private class UrlOpen extends RequestForgerySink {
@@ -92,7 +92,7 @@ private class ApacheSetUri extends RequestForgerySink {
92
92
}
93
93
94
94
/**
95
- * An argument to any Apache Request Instantiation call taken as a
95
+ * An argument to any Apache `HttpRequest` instantiation taken as a
96
96
* sink for request forgery vulnerabilities.
97
97
*/
98
98
private class ApacheHttpRequestInstantiation extends RequestForgerySink {
@@ -104,7 +104,7 @@ private class ApacheHttpRequestInstantiation extends RequestForgerySink {
104
104
}
105
105
106
106
/**
107
- * An argument to a Apache RequestBuilder method call taken as a
107
+ * An argument to an Apache ` RequestBuilder` method call taken as a
108
108
* sink for request forgery vulnerabilities.
109
109
*/
110
110
private class ApacheHttpRequestBuilderArgument extends RequestForgerySink {
@@ -119,22 +119,22 @@ private class ApacheHttpRequestBuilderArgument extends RequestForgerySink {
119
119
}
120
120
121
121
/**
122
- * An argument to any Java .net.http.request Instantiation call taken as a
122
+ * An argument to any `java .net.http.HttpRequest` Instantiation taken as a
123
123
* sink for request forgery vulnerabilities.
124
124
*/
125
125
private class HttpRequestNewBuilder extends RequestForgerySink {
126
126
HttpRequestNewBuilder ( ) {
127
127
exists ( MethodAccess call |
128
128
call .getCallee ( ) .hasName ( "newBuilder" ) and
129
- call .getMethod ( ) .getDeclaringType ( ) .getName ( ) = "HttpRequest"
129
+ call .getMethod ( ) .getDeclaringType ( ) .hasQualifiedName ( "java.net.http" , "HttpRequest" )
130
130
|
131
131
this .asExpr ( ) = call .getArgument ( 0 )
132
132
)
133
133
}
134
134
}
135
135
136
136
/**
137
- * An argument to an Http Builder `uri` call taken as a
137
+ * An argument to an `HttpBuilder` `uri` call taken as a
138
138
* sink for request forgery vulnerabilities.
139
139
*/
140
140
private class HttpBuilderUriArgument extends RequestForgerySink {
@@ -146,7 +146,7 @@ private class HttpBuilderUriArgument extends RequestForgerySink {
146
146
}
147
147
148
148
/**
149
- * An argument to a Spring Rest Template method call taken as a
149
+ * An argument to a Spring `RestTemplate` method call taken as a
150
150
* sink for request forgery vulnerabilities.
151
151
*/
152
152
private class SpringRestTemplateArgument extends RequestForgerySink {
@@ -158,7 +158,7 @@ private class SpringRestTemplateArgument extends RequestForgerySink {
158
158
}
159
159
160
160
/**
161
- * An argument to `javax.ws.rs.Client`s `target` method call taken as a
161
+ * An argument to a `javax.ws.rs.Client` `target` method call taken as a
162
162
* sink for request forgery vulnerabilities.
163
163
*/
164
164
private class JaxRsClientTarget extends RequestForgerySink {
@@ -173,7 +173,7 @@ private class JaxRsClientTarget extends RequestForgerySink {
173
173
}
174
174
175
175
/**
176
- * An argument to `org.springframework.http.RequestEntity`s constructor call
176
+ * An argument to an `org.springframework.http.RequestEntity` constructor call
177
177
* which is an URI taken as a sink for request forgery vulnerabilities.
178
178
*/
179
179
private class RequestEntityUriArg extends RequestForgerySink {
@@ -188,11 +188,11 @@ private class RequestEntityUriArg extends RequestForgerySink {
188
188
}
189
189
190
190
/**
191
- * A class representing all Spring Rest Template methods
192
- * which take an URL as an argument.
191
+ * A Spring Rest Template method
192
+ * which take a URL as an argument.
193
193
*/
194
- private class SpringRestTemplateUrlMethods extends Method {
195
- SpringRestTemplateUrlMethods ( ) {
194
+ private class SpringRestTemplateUrlMethod extends Method {
195
+ SpringRestTemplateUrlMethod ( ) {
196
196
this .getDeclaringType ( ) instanceof SpringRestTemplate and
197
197
this .hasName ( [
198
198
"doExecute" , "postForEntity" , "postForLocation" , "postForObject" , "put" , "exchange" ,
@@ -305,7 +305,7 @@ private class HostnameSanitizedExpr extends Expr {
305
305
|
306
306
formatString = unique( FormatString fs | fs = formatCall .getAFormatString ( ) ) and
307
307
(
308
- // An argument that sanitizes will be come before this:
308
+ // A sanitizing argument comes before this:
309
309
exists ( int argIdx |
310
310
formatCall .getArgumentToBeFormatted ( argIdx ) = prefix and
311
311
sanitizedFromOffset = formatString .getAnArgUsageOffset ( argIdx )
0 commit comments