From 1841da16abe864b3dae19636fee9e9bbe9a01b56 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 1 Jun 2018 21:24:32 +0000 Subject: Merge branch 'sh-add-ruby-2.4-comment' into 'master' Add comment about the need for truncating keys in Ruby 2.4 See merge request gitlab-org/gitlab-ce!19330 --- config/settings.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/settings.rb b/config/settings.rb index 4aa903109ea..58f38d103ea 100644 --- a/config/settings.rb +++ b/config/settings.rb @@ -85,7 +85,14 @@ class Settings < Settingslogic File.expand_path(path, Rails.root) end + # Returns a 256-bit key for attr_encrypted def attr_encrypted_db_key_base + # Ruby 2.4+ requires passing in the exact required length for OpenSSL keys + # (https://github.com/ruby/ruby/commit/ce635262f53b760284d56bb1027baebaaec175d1). + # Previous versions quietly truncated the input. + # + # The default mode for the attr_encrypted gem is to use a 256-bit key. + # We truncate the 128-byte string to 32 bytes. Gitlab::Application.secrets.db_key_base[0..31] end -- cgit v1.2.1