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
327f179a
Commit
327f179a
authored
Jun 14, 2019
by
Mario de la Ossa
Committed by
Mario de la Ossa
Jun 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DOS when rendering issue/MR comments
parent
e3eeb779
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_comments_banzai.yml
changelogs/unreleased/security-DOS_issue_comments_banzai.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_comments_banzai.yml
0 → 100644
View file @
327f179a
---
title
:
Fix Denial of Service for comments when rendering issues/MR comments
merge_request
:
author
:
type
:
security
lib/banzai/filter/relative_link_filter.rb
View file @
327f179a
...
...
@@ -100,7 +100,7 @@ module Banzai
end
def
relative_file_path
(
uri
)
path
=
Addressable
::
URI
.
unescape
(
uri
.
path
)
path
=
Addressable
::
URI
.
unescape
(
uri
.
path
)
.
delete
(
"
\0
"
)
request_path
=
Addressable
::
URI
.
unescape
(
context
[
:requested_path
])
nested_path
=
build_relative_path
(
path
,
request_path
)
file_exists?
(
nested_path
)
?
nested_path
:
path
...
...
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
327f179a
...
...
@@ -83,6 +83,11 @@ describe Banzai::Filter::RelativeLinkFilter do
expect
{
filter
(
act
)
}.
not_to
raise_error
end
it
'does not explode with an escaped null byte'
do
act
=
link
(
"/%00"
)
expect
{
filter
(
act
)
}.
not_to
raise_error
end
it
'does not raise an exception with a space in the path'
do
act
=
link
(
"/uploads/d18213acd3732630991986120e167e3d/Landscape_8.jpg
\n
But here's some more unexpected text :smile:)"
)
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