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
0
Merge Requests
0
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
Boxiang Sun
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
lib/gitlab/markdown/sanitization_filter.rb
lib/gitlab/markdown/sanitization_filter.rb
+1
-0
spec/lib/gitlab/markdown/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