I'm using this patch to turn off Smarty security:
--- a/php/example-app/routes/web.php
+++ b/php/example-app/routes/web.php
@@ -160,7 +160,7 @@ function getParam(Request $request, string $paramName) {
try {
$smarty = new Smarty();
- $smarty->enableSecurity();
+ //$smarty->enableSecurity();
return $smarty->fetch('eval:'.$template);
} catch (Exception $e) {
if ($hideError == "1") {
Might be good to expose Smarty both with and without security...?
Similarly, Thymeleaf's text mode has different security characteristics than its html mode, might want to expose both of them with something like
+ @RequestMapping("/ThymeleafText") // TEXT mode enables RESTRICTED sandbox; for CVE-2026-40478 tab bypass testing
+ String thymeleafText(@RequestParam(required = false) String name, @RequestParam(required = false) String hideError) {
+ if (name == null) {
+ name = "";
+ }
+ if (hideError == null) {
+ hideError = "";
+ }
+ String templateString = "ThymeleafText: " + name;
+
+ try {
+ SpringTemplateEngine templateEngine = new SpringTemplateEngine();
+ StringTemplateResolver resolver = new StringTemplateResolver();
+ resolver.setTemplateMode(TemplateMode.TEXT);
+ templateEngine.setTemplateResolver(resolver);
+ return templateEngine.process(templateString, new org.thymeleaf.context.Context());
+ } catch (Exception e) {
+ if (hideError == "1") {
+ return templateString;
+ } else {
+ return e.toString();
+ }
+ }
+ }
(or possibly some other way to turn on the stricter security; this is just what Claude came up with)
I'm using this patch to turn off Smarty security:
Might be good to expose Smarty both with and without security...?
Similarly, Thymeleaf's text mode has different security characteristics than its html mode, might want to expose both of them with something like
(or possibly some other way to turn on the stricter security; this is just what Claude came up with)