Thymeleaf 3.1
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- Java 21124 lines · 3.9K tokens
- Thymeleaf 3.155 lines · 2.6K tokens
Total179 lines · 6.5K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 197
- 201
- 208
- 209
- 295
- 297
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 427
- 470
- 471
- 488
- 489
- 494
- 502
- 524
- 532
- 552
- 601
- 611
- 653
- 674
- 732
- 759
- 770
- 772
- 776
- 807
- 862
- 863
- 915
- 916
- 917
- 918
- 922
- 1333
- 1336
Prompt Preview
Apply the Java 21 prompt first. These rules target Thymeleaf 3.1, including its optional Spring integrations, and were checked against 3.1.5.RELEASE. Core and thymeleaf-spring5 have a Java 8 minimum; thymeleaf-spring6 requires Java 17 or later. Use Java 21 with these rules.
Template and expression trust
- Resolve
org.thymeleaf:thymeleafand the selectedthymeleaf-spring5orthymeleaf-spring6adapter to the same release, the newest 3.1 patch, because Thymeleaf ships timely security fixes only as patches of its latest minor; inspect the resolved dependencies when a host BOM manages them. Match the adapter and Servlet namespace to the host framework. - Render only application-controlled templates. Keep external text in model values; never concatenate it into template source, OGNL/SpEL expressions, message-expression syntax, or fragment specifications, and never evaluate a rendered value again as template code.
- Avoid
__...__preprocessing of externally influenced values, including translations and database content. Compute values in application code and bind them through ordinary expressions instead of generating expression syntax. - Treat expression restrictions as additional protection, never as a sandbox for untrusted template authors. Restricted evaluation covers preprocessing, raw output, fragment expressions, URL bases, generic attributes, event handlers, and
TEXToutput; it is not a universal mode for every expression or URL parameter. - Preserve Thymeleaf's expression restrictions and evaluation contexts. When an upgrade rejects a constructor,