diff --git a/core/lib/Drupal/Component/Utility/Xss.php b/core/lib/Drupal/Component/Utility/Xss.php index 03bdadb..d425b59 100644 --- a/core/lib/Drupal/Component/Utility/Xss.php +++ b/core/lib/Drupal/Component/Utility/Xss.php @@ -79,8 +79,10 @@ public static function filter($string, $html_tags = array('a', 'em', 'strong', ' $splitter = function ($matches) use ($html_tags, $class) { return $class::split($matches[1], $html_tags, $class); }; - // Calling SafeMarkup::set() is acceptable here because all known XSS - // vectors will have been filtered out by now. + // All other known XSS vectors have been filtered out by this point (or will + // be with the regular expression below) and any HTML tags remaining will + // have been deliberately allowed, so it is acceptable to call + // SafeMarkup::set() on the resultant string. return SafeMarkup::set(preg_replace_callback('% ( <(?=[^a-zA-Z!/]) # a lone <