Replace th:utext with th:text in Thymeleaf templates

Proprietary

Replaces Thymeleaf's unescaped attribute th:utext (and data-th-utext) with its escaped equivalent th:text (data-th-text) in .html / .htm template files. th:utext interpolates raw HTML and is the canonical Thymeleaf XSS sink. The recipe only fires on files that look like Thymeleaf templates (declare the xmlns:th namespace or use a th: / data-th- attribute somewhere). If you have a legitimate raw-HTML interpolation, restore it manually and rely on Thymeleaf's [# th:utext] block syntax or a sanitized model attribute.

org.openrewrite.java.security.xss.ReplaceThymeleafUnescaped
mod run . --recipe=org.openrewrite.java.security.xss.ReplaceThymeleafUnescaped

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.