summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-22 15:35:49 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-22 15:35:49 +0100
commit777b6713bb473d2e09c8340ab9a96373fdbaae50 (patch)
tree786e78f65c73daef684150844a9aa6054dfdb2d3 /config
parent8a235c0c05efec1c8ee14c7454982dc2b8ca9464 (diff)
downloadgitlab-ce-777b6713bb473d2e09c8340ab9a96373fdbaae50.tar.gz
Ensure that db encryption keys have proper bytesize
Diffstat (limited to 'config')
-rw-r--r--config/settings.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/config/settings.rb b/config/settings.rb
index 3f3481bb65d..1b94df785a7 100644
--- a/config/settings.rb
+++ b/config/settings.rb
@@ -95,6 +95,14 @@ class Settings < Settingslogic
Gitlab::Application.secrets.db_key_base[0..31]
end
+ def attr_encrypted_db_key_base_32
+ Gitlab::Utils.ensure_utf8_size(attr_encrypted_db_key_base, bytes: 32.bytes)
+ end
+
+ def attr_encrypted_db_key_base_12
+ Gitlab::Utils.ensure_utf8_size(attr_encrypted_db_key_base, bytes: 12.bytes)
+ end
+
# This should be used for :per_attribute_salt_and_iv mode. There is no
# need to truncate the key because the encryptor will use the salt to
# generate a hash of the password: