Skip to content

Commit fb2989c

Browse files
smowtonfelicitymay
andcommitted
Copyedit comments and function names
Co-authored-by: Felicity Chapman <[email protected]>
1 parent 960a903 commit fb2989c

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
lgtm,codescanning
2-
* The query "Server-Side Request Forgery (SSRF)" (`java/ssrf`) has been promoted from experimental to the main query pack. Its results will now appear by default. Thanks to original experimental query author @porcupineyhairs.
2+
* The query "Server-Side Request Forgery (SSRF)" (`java/ssrf`) has been promoted from experimental to the main query pack. Its results will now appear by default. This query was originally [submitted as an experimental query by @porcupineyhairs](https://github.com/github/codeql/pull/3454).

java/ql/src/Security/CWE/CWE-918/RequestForgery.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<overview>
88
<p>Directly incorporating user input into an HTTP request without validating the input
9-
can facilitate Server-Side Request Forgery (SSRF) attacks. In these attacks, the server
9+
can facilitate server-side request forgery (SSRF) attacks. In these attacks, the server
1010
may be tricked into making a request and interacting with an attacker-controlled server.
1111
</p>
1212

java/ql/src/Security/CWE/CWE-918/RequestForgery.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* @name Server-Side Request Forgery (SSRF)
2+
* @name Server-side request forgery
33
* @description Making web requests based on unvalidated user-input
4-
* may cause server to communicate with malicious servers.
4+
* may cause the server to communicate with malicious servers.
55
* @kind path-problem
66
* @problem.severity error
77
* @precision high

java/ql/src/semmle/code/java/security/RequestForgery.qll

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Provides classes to reason about Server-side Request Forgery attacks. */
1+
/** Provides classes to reason about server-side request forgery (SSRF) attacks. */
22

33
import java
44
import semmle.code.java.frameworks.Networking
@@ -58,11 +58,11 @@ private class DefaultRequestForgeryAdditionalTaintStep extends RequestForgeryAdd
5858
}
5959
}
6060

61-
/** A data flow sink for request forgery vulnerabilities. */
61+
/** A data flow sink for server-side request forgery (SSRF) vulnerabilities. */
6262
abstract class RequestForgerySink extends DataFlow::Node { }
6363

6464
/**
65-
* An argument to an url `openConnection` or `openStream` call
65+
* An argument to a url `openConnection` or `openStream` call
6666
* taken as a sink for request forgery vulnerabilities.
6767
*/
6868
private class UrlOpen extends RequestForgerySink {
@@ -92,7 +92,7 @@ private class ApacheSetUri extends RequestForgerySink {
9292
}
9393

9494
/**
95-
* An argument to any Apache Request Instantiation call taken as a
95+
* An argument to any Apache `HttpRequest` instantiation taken as a
9696
* sink for request forgery vulnerabilities.
9797
*/
9898
private class ApacheHttpRequestInstantiation extends RequestForgerySink {
@@ -104,7 +104,7 @@ private class ApacheHttpRequestInstantiation extends RequestForgerySink {
104104
}
105105

106106
/**
107-
* An argument to a Apache RequestBuilder method call taken as a
107+
* An argument to an Apache `RequestBuilder` method call taken as a
108108
* sink for request forgery vulnerabilities.
109109
*/
110110
private class ApacheHttpRequestBuilderArgument extends RequestForgerySink {
@@ -119,22 +119,22 @@ private class ApacheHttpRequestBuilderArgument extends RequestForgerySink {
119119
}
120120

121121
/**
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
123123
* sink for request forgery vulnerabilities.
124124
*/
125125
private class HttpRequestNewBuilder extends RequestForgerySink {
126126
HttpRequestNewBuilder() {
127127
exists(MethodAccess call |
128128
call.getCallee().hasName("newBuilder") and
129-
call.getMethod().getDeclaringType().getName() = "HttpRequest"
129+
call.getMethod().getDeclaringType().hasQualifiedName("java.net.http", "HttpRequest")
130130
|
131131
this.asExpr() = call.getArgument(0)
132132
)
133133
}
134134
}
135135

136136
/**
137-
* An argument to an Http Builder `uri` call taken as a
137+
* An argument to an `HttpBuilder` `uri` call taken as a
138138
* sink for request forgery vulnerabilities.
139139
*/
140140
private class HttpBuilderUriArgument extends RequestForgerySink {
@@ -146,7 +146,7 @@ private class HttpBuilderUriArgument extends RequestForgerySink {
146146
}
147147

148148
/**
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
150150
* sink for request forgery vulnerabilities.
151151
*/
152152
private class SpringRestTemplateArgument extends RequestForgerySink {
@@ -158,7 +158,7 @@ private class SpringRestTemplateArgument extends RequestForgerySink {
158158
}
159159

160160
/**
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
162162
* sink for request forgery vulnerabilities.
163163
*/
164164
private class JaxRsClientTarget extends RequestForgerySink {
@@ -173,7 +173,7 @@ private class JaxRsClientTarget extends RequestForgerySink {
173173
}
174174

175175
/**
176-
* An argument to `org.springframework.http.RequestEntity`s constructor call
176+
* An argument to an `org.springframework.http.RequestEntity` constructor call
177177
* which is an URI taken as a sink for request forgery vulnerabilities.
178178
*/
179179
private class RequestEntityUriArg extends RequestForgerySink {
@@ -188,11 +188,11 @@ private class RequestEntityUriArg extends RequestForgerySink {
188188
}
189189

190190
/**
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.
193193
*/
194-
private class SpringRestTemplateUrlMethods extends Method {
195-
SpringRestTemplateUrlMethods() {
194+
private class SpringRestTemplateUrlMethod extends Method {
195+
SpringRestTemplateUrlMethod() {
196196
this.getDeclaringType() instanceof SpringRestTemplate and
197197
this.hasName([
198198
"doExecute", "postForEntity", "postForLocation", "postForObject", "put", "exchange",
@@ -305,7 +305,7 @@ private class HostnameSanitizedExpr extends Expr {
305305
|
306306
formatString = unique(FormatString fs | fs = formatCall.getAFormatString()) and
307307
(
308-
// An argument that sanitizes will be come before this:
308+
// A sanitizing argument comes before this:
309309
exists(int argIdx |
310310
formatCall.getArgumentToBeFormatted(argIdx) = prefix and
311311
sanitizedFromOffset = formatString.getAnArgUsageOffset(argIdx)

0 commit comments

Comments
 (0)