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
53834c18
Commit
53834c18
authored
Nov 22, 2019
by
Patrick Derichs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix invalid byte sequence
parent
8e75748a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
changelogs/unreleased/security-dos-issue-and-commit-comments-master.yml
...eleased/security-dos-issue-and-commit-comments-master.yml
+5
-0
lib/banzai/filter/relative_link_filter.rb
lib/banzai/filter/relative_link_filter.rb
+1
-1
spec/lib/banzai/filter/relative_link_filter_spec.rb
spec/lib/banzai/filter/relative_link_filter_spec.rb
+5
-0
No files found.
changelogs/unreleased/security-dos-issue-and-commit-comments-master.yml
0 → 100644
View file @
53834c18
---
title
:
Fix 500 error caused by invalid byte sequences in links
merge_request
:
author
:
type
:
security
lib/banzai/filter/relative_link_filter.rb
View file @
53834c18
...
@@ -172,7 +172,7 @@ module Banzai
...
@@ -172,7 +172,7 @@ module Banzai
end
end
def
cleaned_file_path
(
uri
)
def
cleaned_file_path
(
uri
)
Addressable
::
URI
.
unescape
(
uri
.
path
).
delete
(
"
\0
"
).
chomp
(
"/"
)
Addressable
::
URI
.
unescape
(
uri
.
path
).
scrub
.
delete
(
"
\0
"
).
chomp
(
"/"
)
end
end
def
relative_file_path
(
uri
)
def
relative_file_path
(
uri
)
...
...
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
53834c18
...
@@ -119,6 +119,11 @@ describe Banzai::Filter::RelativeLinkFilter do
...
@@ -119,6 +119,11 @@ describe Banzai::Filter::RelativeLinkFilter do
expect
{
filter
(
act
)
}.
not_to
raise_error
expect
{
filter
(
act
)
}.
not_to
raise_error
end
end
it
'does not raise an exception on URIs containing invalid utf-8 byte sequences'
do
act
=
link
(
"%FF"
)
expect
{
filter
(
act
)
}.
not_to
raise_error
end
it
'does not raise an exception with a garbled path'
do
it
'does not raise an exception with a garbled path'
do
act
=
link
(
"open(/var/tmp/):%20/location%0Afrom:%20/test"
)
act
=
link
(
"open(/var/tmp/):%20/location%0Afrom:%20/test"
)
expect
{
filter
(
act
)
}.
not_to
raise_error
expect
{
filter
(
act
)
}.
not_to
raise_error
...
...
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