Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-03-26 18:45:34 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-03-26 18:45:34 +0300
commit47459cab5a61fd1fb255de13a933e5efce5a9290 (patch)
treef249cb8ec2caff7bb13bfdfde7469b48689f130b /lib/gitlab/config/entry/legacy_validation_helpers.rb
parent7b1f1cb0fe42fcb0c67090616b1bd58f9e2530b5 (diff)
parent7c9160d3ee358f1b6676c1bf4373f8e27aec2d73 (diff)
Merge branch 'security-use-untrusted-regexp-11-8' into '11-8-stable'
Use UntrustedRegexp for CI refs matching See merge request gitlab/gitlabhq!3007
Diffstat (limited to 'lib/gitlab/config/entry/legacy_validation_helpers.rb')
-rw-r--r--lib/gitlab/config/entry/legacy_validation_helpers.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/gitlab/config/entry/legacy_validation_helpers.rb b/lib/gitlab/config/entry/legacy_validation_helpers.rb
index d3ab5625743..0a629075302 100644
--- a/lib/gitlab/config/entry/legacy_validation_helpers.rb
+++ b/lib/gitlab/config/entry/legacy_validation_helpers.rb
@@ -45,17 +45,15 @@ module Gitlab
end
def validate_regexp(value)
- !value.nil? && Regexp.new(value.to_s) && true
- rescue RegexpError, TypeError
- false
+ Gitlab::UntrustedRegexp::RubySyntax.valid?(value)
end
def validate_string_or_regexp(value)
return true if value.is_a?(Symbol)
return false unless value.is_a?(String)
- if value.first == '/' && value.last == '/'
- validate_regexp(value[1...-1])
+ if Gitlab::UntrustedRegexp::RubySyntax.matches_syntax?(value)
+ validate_regexp(value)
else
true
end