-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Description
Describe the bug
The parameter of function CsrfTokenRequestAttributeHandler#setCsrfRequestAttributeName(String csrfRequestAttributeName) should be @Nullable. null as a parameter is a valid value and documented here: https://docs.spring.io/spring-security/reference/servlet/exploits/csrf.html#deferred-csrf-token
To Reproduce
Use Kotlin 2.3.0 with Spring Boot 4.0.2 (& Spring Security) and try to call the function with setCsrfRequestAttributeName(null). Kotlin will fail to build the project because Kotlin says the parameter should be non null.
Expected behavior
The parameter String csrfRequestAttributeName should be @Nullable and follow the documentation.
Further details
As I see this, the introduction of the JSpecify annotation in this line
spring-security/web/src/main/java/org/springframework/security/web/csrf/package-info.java
Line 20 in b591a0a
| @NullMarked |
org.springframework.security.web.csrf as non nullable.