Skip to content

Escaping Output to Mitigate XSS - spring form tag htmlEscape equivalent? #877

Answered by ultraq
joshua-koehler asked this question in Q&A
Discussion options

You must be logged in to vote

Hey there, so HTML escaping is built into Thymeleaf by default, and you usually have to go out of your way to turn it off (eg: use specific attribute processors that are made for leaving text unescaped). I can't seem to find much mention of this in the docs though, with the closest thing being this section in the general Thymeleaf tutorial about how to emit unescaped text: https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#more-on-texts-and-variables

Just to double check, I looked the code for the th:input="text" processor in the thymeleaf-spring project, which is this file here: https://github.com/thymeleaf/thymeleaf-spring/blob/3.1-master/thymeleaf-spring5/src/main/java/org…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@joshua-koehler
Comment options

@ultraq
Comment options

Answer selected by joshua-koehler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants