avoid mail in twig content trigger security error

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller
2025-12-12 16:20:35 -07:00
parent 7a6b8a90d4
commit d34213232b

View File

@@ -379,7 +379,8 @@ class Security
];
// Build combined patterns (compile once, use many times)
$quotedFunctions = array_map(fn($f) => preg_quote($f, '/'), $bad_twig_functions);
// Use word boundaries to avoid false positives (e.g., 'mail' matching 'email')
$quotedFunctions = array_map(fn($f) => '\b' . preg_quote($f, '/') . '\b', $bad_twig_functions);
$functionsPattern = implode('|', $quotedFunctions);
// Pattern for functions in Twig blocks