summaryrefslogtreecommitdiff
path: root/app/validators
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-16 14:40:54 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-01-31 22:53:58 +0000
commit63eb415610b151495ac54e98804ce37ba5500be4 (patch)
treec0738ed99d689987e5d25f94a48619c9f6add697 /app/validators
parent8f09ec28379da331fb5bd4a4da950def7b83dd94 (diff)
downloadgitlab-ce-63eb415610b151495ac54e98804ce37ba5500be4.tar.gz
Fix certificate validators
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/certificate_key_validator.rb2
-rw-r--r--app/validators/certificate_validator.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/app/validators/certificate_key_validator.rb b/app/validators/certificate_key_validator.rb
index 7039bd5a621..098b16017d2 100644
--- a/app/validators/certificate_key_validator.rb
+++ b/app/validators/certificate_key_validator.rb
@@ -16,7 +16,7 @@ class CertificateKeyValidator < ActiveModel::EachValidator
private
def valid_private_key_pem?(value)
- return unless value
+ return false unless value
pkey = OpenSSL::PKey::RSA.new(value)
pkey.private?
rescue OpenSSL::PKey::PKeyError
diff --git a/app/validators/certificate_validator.rb b/app/validators/certificate_validator.rb
index 2a04c76d4b9..e3d18097f71 100644
--- a/app/validators/certificate_validator.rb
+++ b/app/validators/certificate_validator.rb
@@ -16,9 +16,9 @@ class CertificateValidator < ActiveModel::EachValidator
private
def valid_certificate_pem?(value)
- return unless value
- OpenSSL::X509::Certificate.new(value)
+ return false unless value
+ OpenSSL::X509::Certificate.new(value).present?
rescue OpenSSL::X509::CertificateError
- nil
+ false
end
end