diff options
author | John Jarvis <jarv@gitlab.com> | 2019-04-02 11:12:32 +0300 |
---|---|---|
committer | John Jarvis <jarv@gitlab.com> | 2019-04-02 11:12:32 +0300 |
commit | 69b65a6b745e74bba290787420a0017395fd7c25 (patch) | |
tree | c328963cbe5b340c58c88230d21f338c77462ebd /lib/gitlab/config/entry/legacy_validation_helpers.rb | |
parent | 1b6fe3ae226e4c6f481c90c886e242fcd96ab11b (diff) | |
parent | 3e81a5baf25d6ecd9ad807a2b8f4238dcc598d5e (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.rb | 8 |
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 |