Skip to content

CSRF token not available to FreeMarker templates #29787

Closed
@ardetrick

Description

@ardetrick

Hi Team!

After upgrading to SpringBoot 3 a freemarker form no longer renders because the _csrf attribute is null.

Sample app (technically it's not rendering _csrf in a form, but it's the same problem): https://github.com/ardetrick/springboot3-freemarker-csrf-issue

There is a work-around where setting spring.freemarker.expose-request-attributes=true resolves the issue, however, this does not seem like the correct fix.

I recognize that there have been a few changes to Spring Security and CSRF as part of upgrading Spring Security from 5 to 6, however, the spring security team does not believe this issue is related. spring-projects/spring-security#12462 (comment).

In addition, at least one other person has also noted this issue: spring-projects/spring-security#12462 (comment).

Thanks for the help!

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions