Skip to content

Commit df47eac

Browse files
authored
Merge commit from fork
Fix GHSA-8qqw-rjh4-5gp2
1 parent d3c6f5d commit df47eac

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: main/inc/lib/formvalidator/FormValidator.class.php

+13
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,7 @@ public function addHtmlEditor(
11061106

11071107
$this->addElement('html_editor', $name, $label, $attributes, $config);
11081108
$this->applyFilter($name, 'trim');
1109+
$this->applyFilter($name, 'attr_on_filter');
11091110
if ($required) {
11101111
$this->addRule($name, get_lang('ThisFieldIsRequired'), 'required');
11111112
}
@@ -2097,3 +2098,15 @@ function plain_url_filter($html, $mode = NO_HTML)
20972098

20982099
return kses_split($html, $allowed_html_fixed, ['http', 'https']);
20992100
}
2101+
2102+
/**
2103+
* Prevent execution of event handlers in HTML elements.
2104+
*
2105+
* @param string $html
2106+
* @return string
2107+
*/
2108+
function attr_on_filter($html) {
2109+
$prefix = uniqid('data-cke-').'-';
2110+
2111+
return preg_replace('/(\s)(on)/i', '$1'.$prefix.'$2', $html);
2112+
}

0 commit comments

Comments
 (0)