From 4810f401c4fd63985fb194d068717853599d0ba9 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Mon, 26 Oct 2015 16:28:09 +0100 Subject: raise `ArgumentError` when `SECRET_KEY_BASE` is an integer If `SECRET_KEY_BASE` or other `secret` gets passed as other then string we need to raise `ArgumentError` to know that it's a wrong argument. Closes #22072 --- railties/lib/rails/application.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'railties/lib/rails/application.rb') diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 7916e24af1..e81ec62a1d 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -167,6 +167,9 @@ module Rails # team. Details at https://github.com/rails/rails/pull/6952#issuecomment-7661220 @caching_key_generator ||= if secrets.secret_key_base + unless secrets.secret_key_base.kind_of?(String) + raise ArgumentError, "`secret_key_base` for #{Rails.env} environment must be a type of String, change this value in `config/secrets.yml`" + end key_generator = ActiveSupport::KeyGenerator.new(secrets.secret_key_base, iterations: 1000) ActiveSupport::CachingKeyGenerator.new(key_generator) else -- cgit v1.2.3