Commit 21d68d27 authored by Steve Abrams's avatar Steve Abrams Committed by Alessio Caiazza

Update maven file_name regex for full string

Do a full string check on maven file_name rather
than just a single line to prevent malicious
attacks.
parent bd794d6e
---
title: Update maven_file_name_regex for full string match
merge_request:
author:
type: security
......@@ -28,7 +28,7 @@ module EE
end
def maven_file_name_regex
@maven_file_name_regex ||= %r{^[A-Za-z0-9\.\_\-\+]+$}.freeze
@maven_file_name_regex ||= %r{\A[A-Za-z0-9\.\_\-\+]+\z}.freeze
end
def maven_path_regex
......
......@@ -67,6 +67,7 @@ describe Gitlab::Regex do
it { is_expected.not_to match('@@foo/bar') }
it { is_expected.not_to match('my package name') }
it { is_expected.not_to match('!!()()') }
it { is_expected.not_to match("..\n..\foo") }
end
describe '.maven_file_name_regex' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment