BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9e7a9c63
Commit
9e7a9c63
authored
Jun 02, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Further limit the limited whitelist for project/group descriptions
parent
79c4e389
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
sanitization_filter.rb
lib/gitlab/markdown/sanitization_filter.rb
+1
-0
sanitization_filter_spec.rb
spec/lib/gitlab/markdown/sanitization_filter_spec.rb
+17
-2
No files found.
lib/gitlab/markdown/sanitization_filter.rb
View file @
9e7a9c63
...
...
@@ -12,6 +12,7 @@ module Gitlab
# See http://git.io/vkuAN
if
pipeline
==
:description
whitelist
=
LIMITED
whitelist
[
:elements
]
-=
%w(pre code img ol ul li)
else
whitelist
=
super
end
...
...
spec/lib/gitlab/markdown/sanitization_filter_spec.rb
View file @
9e7a9c63
...
...
@@ -95,8 +95,23 @@ module Gitlab::Markdown
context
'when pipeline is :description'
do
it
'uses a stricter whitelist'
do
doc
=
filter
(
'<h1>My Project</h1>'
,
pipeline: :description
)
expect
(
doc
.
to_html
.
strip
).
to
eq
'My Project'
doc
=
filter
(
'<h1>Description</h1>'
,
pipeline: :description
)
expect
(
doc
.
to_html
.
strip
).
to
eq
'Description'
end
%w(pre code img ol ul li)
.
each
do
|
elem
|
it
"removes '
#{
elem
}
' elements"
do
act
=
"<
#{
elem
}
>Description</
#{
elem
}
>"
expect
(
filter
(
act
,
pipeline: :description
).
to_html
.
strip
).
to
eq
'Description'
end
end
%w(b i strong em a ins del sup sub p)
.
each
do
|
elem
|
it
"still allows '
#{
elem
}
' elements"
do
exp
=
act
=
"<
#{
elem
}
>Description</
#{
elem
}
>"
expect
(
filter
(
act
,
pipeline: :description
).
to_html
).
to
eq
exp
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