-
Notifications
You must be signed in to change notification settings - Fork 38.5k
CSRF token not available to FreeMarker templates #29787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for raising this @ardetrick. I agree the workaround isn't ideal (and for me it has caused another issue where redirects now attempt to add duplicate attributes to the model) but at least it demonstrates the underlying cause. PS for the benefit of the Spring Boot team, I believe this is the change which caused the regression. |
Thanks, both. I agree, the behavior appears to be due to changes to the In Spring Framework 5.3.x, that model is an |
Revised to expose a custom |
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!
The text was updated successfully, but these errors were encountered: