Skip to content

Commit

Permalink
Merge pull request #492 from nanasess/added-script-escape
Browse files Browse the repository at this point in the history
Smarty の script_escape でサニタイズされる対象の追加
  • Loading branch information
matsuoshi committed Oct 27, 2021
2 parents c592df5 + 868752d commit eb43f49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data/smarty_extends/modifier.script_escape.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function smarty_modifier_script_escape($value)
{
if (is_array($value)) return $value;

$pattern = "/<script.*?>|<\/script>|javascript:|<svg.*(onload|onerror).*?>|<img.*(onload|onerror).*?>|<body.*onload.*?>|<iframe.*?>|<object.*?>|<embed.*?>|<.*onmouse.*?>/i";
$pattern = "/<script.*?>|<\/script>|javascript:|<svg.*(onload|onerror).*?>|<img.*(onload|onerror).*?>|<body.*onload.*?>|<iframe.*?>|<object.*?>|<embed.*?>|<.*onmouse.*?>|(\"|').*(onmouse|onerror|onload|onclick).*=.*(\"|').*/i";
$convert = '#script tag escaped#';

if (preg_match_all($pattern, $value, $matches)) {
Expand Down

0 comments on commit eb43f49

Please sign in to comment.