Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2018-06-25 19:15:41 +0300
committerAlessio Caiazza <acaiazza@gitlab.com>2018-06-25 19:15:41 +0300
commit9d6499a57812cd27014afe9663339f89927c3b82 (patch)
tree128416ece33448de935a1f4f43746906aa716adb /spec/lib/banzai
parent70c02bf3bce18d39a4fae85bb927334391cd2a5e (diff)
parent00c68e1b03ed92eef6aa6ab3fb84b827b14b9daa (diff)
Merge branch 'security-2682-fix-xss-for-markdown-toc' into 'master'
[master] Fix xss for Markdown elements where [[_TOC_]] is enabled See merge request gitlab/gitlabhq!2400
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r--spec/lib/banzai/filter/table_of_contents_filter_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/table_of_contents_filter_spec.rb b/spec/lib/banzai/filter/table_of_contents_filter_spec.rb
index 0cfef4ff5bf..7213cd58ea7 100644
--- a/spec/lib/banzai/filter/table_of_contents_filter_spec.rb
+++ b/spec/lib/banzai/filter/table_of_contents_filter_spec.rb
@@ -139,5 +139,14 @@ describe Banzai::Filter::TableOfContentsFilter do
expect(items[5].ancestors).to include(items[4])
end
end
+
+ context 'header text contains escaped content' do
+ let(:content) { '&lt;img src="x" onerror="alert(42)"&gt;' }
+ let(:results) { result(header(1, content)) }
+
+ it 'outputs escaped content' do
+ expect(doc.inner_html).to include(content)
+ end
+ end
end
end