Skip to content

Parameter of CsrfTokenRequestAttributeHandler#setCsrfRequestAttributeName should be nullable #18617

@Somebodynull

Description

@Somebodynull

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

marks everything in package org.springframework.security.web.csrf as non nullable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions