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
iv
gitlab-ce
Commits
849cc380
Commit
849cc380
authored
May 07, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a case-insensitive comparison in sanitizing URI schemes
Closes #1625
parent
93b4a3a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
1 deletion
+8
-1
CHANGELOG
CHANGELOG
+1
-0
lib/banzai/filter/sanitization_filter.rb
lib/banzai/filter/sanitization_filter.rb
+1
-1
spec/lib/banzai/filter/sanitization_filter_spec.rb
spec/lib/banzai/filter/sanitization_filter_spec.rb
+6
-0
No files found.
CHANGELOG
View file @
849cc380
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
- Assign labels and milestone to target project when moving issue. !3934 (Long Nguyen)
- Use a case-insensitive comparison in sanitizing URI schemes
- Project#open_branches has been cleaned up and no longer loads entire records into memory.
- Escape HTML in commit titles in system note messages
- Improve multiple branch push performance by memoizing permission checking
...
...
lib/banzai/filter/sanitization_filter.rb
View file @
849cc380
...
...
@@ -63,7 +63,7 @@ module Banzai
begin
uri
=
Addressable
::
URI
.
parse
(
node
[
'href'
])
uri
.
scheme
.
strip!
if
uri
.
scheme
uri
.
scheme
=
uri
.
scheme
.
strip
.
downcase
if
uri
.
scheme
node
.
remove_attribute
(
'href'
)
if
UNSAFE_PROTOCOLS
.
include?
(
uri
.
scheme
)
rescue
Addressable
::
URI
::
InvalidURIError
...
...
spec/lib/banzai/filter/sanitization_filter_spec.rb
View file @
849cc380
...
...
@@ -22,6 +22,12 @@ describe Banzai::Filter::SanitizationFilter, lib: true do
expect
(
filter
(
act
).
to_html
).
to
eq
exp
end
it
'sanitizes mixed-cased javascript in attributes'
do
act
=
%q(<a href="javaScript:alert('foo')">Text</a>)
exp
=
'<a>Text</a>'
expect
(
filter
(
act
).
to_html
).
to
eq
exp
end
it
'allows whitelisted HTML tags from the user'
do
exp
=
act
=
"<dl>
\n
<dt>Term</dt>
\n
<dd>Definition</dd>
\n
</dl>"
expect
(
filter
(
act
).
to_html
).
to
eq
exp
...
...
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