Skip to content

Commit a80e663

Browse files
committed
Java: Minor typo fix and autoformat
1 parent 2ce0921 commit a80e663

File tree

1 file changed

+10
-6
lines changed
  • java/ql/src/semmle/code/java/security

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,25 @@ class XssSink extends DataFlow::ExprNode {
3636
exists(SpringRequestMappingMethod requestMappingMethod, ReturnStmt rs |
3737
requestMappingMethod = rs.getEnclosingCallable() and
3838
this.asExpr() = rs.getResult() and
39-
(not exists(requestMappingMethod.getProduces()) or requestMappingMethod.getProduces().matches("text/%"))
40-
|
39+
(
40+
not exists(requestMappingMethod.getProduces()) or
41+
requestMappingMethod.getProduces().matches("text/%")
42+
)
43+
|
4144
// If a Spring request mapping method is either annotated with @ResponseBody (or equivalent),
4245
// or returns a HttpEntity or sub-type, then the return value of the method is converted into
4346
// a HTTP reponse using a HttpMessageConverter implementation. The implementation is chosen
4447
// based on the return type of the method, and the Accept header of the request.
45-
48+
//
4649
// By default, the only message converter which produces a response which is vulnerable to
4750
// XSS is the StringHttpMessageConverter, which "Accept"s all text/* content types, including
4851
// text/html. Therefore, if a browser request includes "text/html" in the "Accept" header,
4952
// any String returned will be converted into a text/html response.
50-
requestMappingMethod.isResponseBody() and requestMappingMethod.getReturnType() instanceof TypeString
53+
requestMappingMethod.isResponseBody() and
54+
requestMappingMethod.getReturnType() instanceof TypeString
5155
or
5256
exists(Type returnType |
53-
// A return type of HttpEntity<T> or ResponseEntity<T> represents a HTTP response with both
57+
// A return type of HttpEntity<T> or ResponseEntity<T> represents an HTTP response with both
5458
// a body and a set of headers. The body is subject to the same HttpMessageConverter
5559
// process as above.
5660
returnType = requestMappingMethod.getReturnType() and
@@ -59,7 +63,7 @@ class XssSink extends DataFlow::ExprNode {
5963
or
6064
returnType instanceof SpringResponseEntity
6165
)
62-
|
66+
|
6367
// The type argument, representing the type of the body, is type String
6468
returnType.(ParameterizedClass).getTypeArgument(0) instanceof TypeString
6569
or

0 commit comments

Comments
 (0)