mirror of
https://github.com/getgrav/grav.git
synced 2025-12-17 05:39:42 +01:00
avoid mail in twig content trigger security error
Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
@@ -379,7 +379,8 @@ class Security
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Build combined patterns (compile once, use many times)
|
// 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);
|
$functionsPattern = implode('|', $quotedFunctions);
|
||||||
|
|
||||||
// Pattern for functions in Twig blocks
|
// Pattern for functions in Twig blocks
|
||||||
|
|||||||
Reference in New Issue
Block a user