Skip to content

Commit dedf765

Browse files
haby0smowton
andauthored
Update java/ql/src/experimental/Security/CWE/CWE-352/JsonpInjectionLib.qll
Co-authored-by: Chris Smowton <[email protected]>
1 parent 0e183ab commit dedf765

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

java/ql/src/experimental/Security/CWE/CWE-352/JsonpInjectionLib.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import semmle.code.java.frameworks.spring.SpringController
1313
abstract class RequestGetMethod extends Method {
1414
RequestGetMethod() {
1515
not exists(MethodAccess ma |
16-
// Exclude apparent GET handlers that read a request entity, because this is the principle of JSONP.
16+
// Exclude apparent GET handlers that read a request entity, because this likely indicates this is not in fact a GET handler.
17+
// This is particularly a problem with Spring handlers, which can sometimes neglect to specify a request method.
18+
// Even if it is in fact a GET handler, such a request method will be unusable in the context `<script src="...">`,
19+
// which is the typical use-case for JSONP but cannot supply a request body.
1720
ma.getMethod() instanceof ServletRequestGetBodyMethod and
1821
this.polyCalls*(ma.getEnclosingCallable())
1922
)

0 commit comments

Comments
 (0)