Skip to content
Snippets Groups Projects
Commit 455b50be authored by GitLab Release Tools Bot's avatar GitLab Release Tools Bot
Browse files

Merge branch 'security-DOS_issue_comments_banzai-11-10' into '11-10-stable'

Fix DOS when rendering issue/MR comments

See merge request gitlab/gitlabhq!3159
parents 5ac33f71 1fc624bc
No related branches found
No related tags found
No related merge requests found
---
title: Fix Denial of Service for comments when rendering issues/MR comments
merge_request:
author:
type: security
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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 \nBut here's some more unexpected text :smile:)")
expect { filter(act) }.not_to raise_error
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment