Skip to content

Commit 8c4e643

Browse files
committed
Security: Fix pattern to remove on* attributes from HTML tags - refs BT#22421
See advisory GHSA-gw58-89f7-4xgj
1 parent 1d4c60b commit 8c4e643

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/RemoveOnAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function preFilter($html, $config, $context)
1717

1818
public static function filter($html)
1919
{
20-
$pattern = '/\s*on\w+=(?:"[^"]*"|\'[^\']*\'|[^\s>]+)/i';
20+
$pattern = '/\s+on\w+\s*=\s*(?:"[^"]*"|\'[^\']*\'|[^\s>]+)/i';
2121

2222
return preg_replace($pattern, '', $html);
2323
}

0 commit comments

Comments
 (0)