diff --git a/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/core/lib/Drupal/Core/Render/Element/HtmlTag.php index f0c78bb..5526246 100644 --- a/core/lib/Drupal/Core/Render/Element/HtmlTag.php +++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Xss; +use Drupal\Core\Render\SafeString; use Drupal\Core\Template\Attribute; /** @@ -46,13 +47,8 @@ public function getInfo() { /** * Pre-render callback: Renders a generic HTML tag with attributes into #markup. * - * Note: It is the caller's responsibility to sanitize any input parameters. - * This callback does not perform sanitization. Despite the result of this - * pre-render callback being a #markup element, it is not passed through - * \Drupal\Component\Utility\Xss::filterAdmin(). This is because it is marked - * safe here, which causes - * \Drupal\Core\Render\Renderer::xssFilterAdminIfUnsafe() to regard it as safe - * and bypass the call to \Drupal\Component\Utility\Xss::filterAdmin(). + * Note: It is the caller's responsibility to sanitize #value_prefix and + * #value_suffix. They are not filtered by this function. * * @param array $element * An associative array containing: @@ -60,16 +56,17 @@ public function getInfo() { * - meta: To provide meta information, such as a page refresh. * - link: To refer to stylesheets and other contextual information. * - script: To load JavaScript. - * The value of #tag is not escaped or sanitized, so do not pass in user - * input. + * The value of #tag is escaped. * - #attributes: (optional) An array of HTML attributes to apply to the * tag. * - #value: (optional) A string containing tag content, such as inline - * CSS. + * CSS. The value of #value will be XSS admin filtered if it is not safe. * - #value_prefix: (optional) A string to prepend to #value, e.g. a CDATA - * wrapper prefix. + * wrapper prefix. The value of #value_prefix cannot be filtered and is + * assumed to be safe. * - #value_suffix: (optional) A string to append to #value, e.g. a CDATA - * wrapper suffix. + * wrapper suffix. The value of #value_suffix cannot be filtered and is + * assumed to be safe. * - #noscript: (optional) If TRUE, the markup (including any prefix or * suffix) will be wrapped in a