Skip to content
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

Restricted types no longer usable with th:with in 3.1.2 #977

Closed
wimdeblauwe opened this issue Sep 9, 2023 · 2 comments
Closed

Restricted types no longer usable with th:with in 3.1.2 #977

wimdeblauwe opened this issue Sep 9, 2023 · 2 comments

Comments

@wimdeblauwe
Copy link

In my book Taming Thymeleaf, I use th:with like this:

th:with="urlBuilder=${T(org.springframework.web.servlet.support.ServletUriComponentsBuilder)}"

This worked until the upgrade of Spring Boot 3.0.10 that uses Thymeleaf 3.1.2. I could not find something in the release notes that describes this change. There is #966 but that is about org.springframework.util, but this class is not in that package.

Is the behaviour of 3.1.2 intentional? Can I no longer use th:with like this?

@danielfernandez
Copy link
Member

Unfortunately that's correct. Classes in org.springframework.web and several other packages were forbidden as a part of general security-strengthening measures in 3.1.2.

Note however that there is a #mvc expression utility object precisely related to URL building in Spring MVC applications and which might fit your needs: https://www.thymeleaf.org/doc/tutorials/3.1/thymeleafspring.html#building-uris-to-controllers

@wimdeblauwe
Copy link
Author

I was not able to use #mvc for my use case. See https://www.wimdeblauwe.com/blog/2023/10/19/taming-thymeleaf-update-for-thymeleaf-3.1.2/ for details on how it fixed it if you are interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants