Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
849cc380
Commit
849cc380
authored
8 years ago
by
Stan Hu
Browse files
Options
Downloads
Patches
Plain Diff
Use a case-insensitive comparison in sanitizing URI schemes
Closes #1625
parent
93b4a3a1
No related branches found
No related tags found
1 merge request
!389
CE upstream
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG
+1
-0
1 addition, 0 deletions
CHANGELOG
lib/banzai/filter/sanitization_filter.rb
+1
-1
1 addition, 1 deletion
lib/banzai/filter/sanitization_filter.rb
spec/lib/banzai/filter/sanitization_filter_spec.rb
+6
-0
6 additions, 0 deletions
spec/lib/banzai/filter/sanitization_filter_spec.rb
with
8 additions
and
1 deletion
CHANGELOG
+
1
−
0
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
...
...
This diff is collapsed.
Click to expand it.
lib/banzai/filter/sanitization_filter.rb
+
1
−
1
View file @
849cc380
...
...
@@ -63,7 +63,7 @@ def remove_unsafe_links
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
...
...
This diff is collapsed.
Click to expand it.
spec/lib/banzai/filter/sanitization_filter_spec.rb
+
6
−
0
View file @
849cc380
...
...
@@ -22,6 +22,12 @@
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment