浏览代码

LibMarkdown: Wrap code block language string in escape_html_entities()

This would allow HTML injection as the string was inserted into the HTML
output with no sanitation whatsoever.

Fixes #7123.
Linus Groh 4 年之前
父节点
当前提交
9c19e62675
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibMarkdown/CodeBlock.cpp

+ 1 - 1
Userland/Libraries/LibMarkdown/CodeBlock.cpp

@@ -39,7 +39,7 @@ String CodeBlock::render_to_html() const
     if (style_language.is_empty())
         builder.append("<code>");
     else
-        builder.appendff("<code class=\"{}\">", style_language);
+        builder.appendff("<code class=\"{}\">", escape_html_entities(style_language));
 
     if (style_language == "js")
         builder.append(JS::MarkupGenerator::html_from_source(m_code));