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:
authorJohn Jarvis <jarv@gitlab.com>2019-04-02 11:12:32 +0300
committerJohn Jarvis <jarv@gitlab.com>2019-04-02 11:12:32 +0300
commit69b65a6b745e74bba290787420a0017395fd7c25 (patch)
treec328963cbe5b340c58c88230d21f338c77462ebd /lib/gitlab/config/entry/legacy_validation_helpers.rb
parent1b6fe3ae226e4c6f481c90c886e242fcd96ab11b (diff)
parent3e81a5baf25d6ecd9ad807a2b8f4238dcc598d5e (diff)
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into jarv/dev-to-gitlab-2019-04-02
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