mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Java: Improve java/spring-disabled-csrf-protection
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/** Provides predicates to reason about disabling CSRF protection in Spring. */
|
||||
|
||||
import java
|
||||
|
||||
/** Holds if `call` disables CSRF protection in Spring. */
|
||||
predicate disablesSpringCsrfProtection(MethodAccess call) {
|
||||
call.getMethod().hasName("disable") and
|
||||
call.getReceiverType()
|
||||
.hasQualifiedName("org.springframework.security.config.annotation.web.configurers",
|
||||
"CsrfConfigurer<HttpSecurity>")
|
||||
or
|
||||
call.getMethod()
|
||||
.hasQualifiedName("org.springframework.security.config.annotation.web.builders",
|
||||
"HttpSecurity", "csrf") and
|
||||
call.getArgument(0)
|
||||
.(MemberRefExpr)
|
||||
.getReferencedCallable()
|
||||
.hasQualifiedName("org.springframework.security.config.annotation.web.configurers",
|
||||
"AbstractHttpConfigurer", "disable")
|
||||
}
|
||||
Reference in New Issue
Block a user