Skip to content

Commit bbe888c

Browse files
authored
Update SpringCsrfProtection.qll
1 parent e2479a7 commit bbe888c

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

java/ql/lib/semmle/code/java/security/SpringCsrfProtection.qll

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ import java
55
/** Holds if `call` disables CSRF protection in Spring. */
66
predicate disablesSpringCsrfProtection(MethodCall call) {
77
call.getMethod().hasName("disable") and
8-
(
9-
call.getReceiverType()
10-
.hasQualifiedName("org.springframework.security.config.annotation.web.configurers",
11-
"CsrfConfigurer<HttpSecurity>")
12-
or
13-
call.getReceiverType()
14-
.hasQualifiedName("org.springframework.security.config.web.server",
15-
"ServerHttpSecurity$CsrfSpec")
16-
)
8+
call.getReceiverType()
9+
.hasQualifiedName("org.springframework.security.config.annotation.web.configurers",
10+
"CsrfConfigurer<HttpSecurity>")
1711
or
1812
call.getMethod()
1913
.hasQualifiedName("org.springframework.security.config.annotation.web.builders",
@@ -23,4 +17,18 @@ predicate disablesSpringCsrfProtection(MethodCall call) {
2317
.getReferencedCallable()
2418
.hasQualifiedName("org.springframework.security.config.annotation.web.configurers",
2519
"AbstractHttpConfigurer", "disable")
20+
or
21+
call.getMethod().hasName("disable") and
22+
call.getReceiverType()
23+
.hasQualifiedName("org.springframework.security.config.web.server",
24+
"ServerHttpSecurity$CsrfSpec")
25+
or
26+
call.getMethod()
27+
.hasQualifiedName("org.springframework.security.config.web.server", "ServerHttpSecurity",
28+
"csrf") and
29+
call.getArgument(0)
30+
.(MemberRefExpr)
31+
.getReferencedCallable()
32+
.hasQualifiedName("org.springframework.security.config.web.server",
33+
"ServerHttpSecurity$CsrfSpec", "disable")
2634
}

0 commit comments

Comments
 (0)