Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
00c68e1b
Commit
00c68e1b
authored
Jun 15, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix xss for Markdown elements where [[_TOC_]] is enabled
parent
fb08183e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
changelogs/unreleased/security-2682-fix-xss-for-markdown-toc.yml
...ogs/unreleased/security-2682-fix-xss-for-markdown-toc.yml
+5
-0
lib/banzai/filter/table_of_contents_filter.rb
lib/banzai/filter/table_of_contents_filter.rb
+1
-1
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
+9
-0
No files found.
changelogs/unreleased/security-2682-fix-xss-for-markdown-toc.yml
0 → 100644
View file @
00c68e1b
---
title
:
Fix XSS vulnerability for table of content generation
merge_request
:
author
:
type
:
security
lib/banzai/filter/table_of_contents_filter.rb
View file @
00c68e1b
...
...
@@ -92,7 +92,7 @@ module Banzai
def
text
return
''
unless
node
@text
||=
node
.
text
@text
||=
EscapeUtils
.
escape_html
(
node
.
text
)
end
private
...
...
spec/lib/banzai/filter/table_of_contents_filter_spec.rb
View file @
00c68e1b
...
...
@@ -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
)
{
'<img src="x" onerror="alert(42)">'
}
let
(
:results
)
{
result
(
header
(
1
,
content
))
}
it
'outputs escaped content'
do
expect
(
doc
.
inner_html
).
to
include
(
content
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment