aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorEugene Kenny <elkenny@gmail.com>2018-01-08 20:45:46 +0000
committerEugene Kenny <elkenny@gmail.com>2018-01-08 20:45:46 +0000
commitd034f488f9c2d694bcad9950df0310ca869956e0 (patch)
treedd42d7b15b986f25e6e8039b37f71ba6dc9b20cd /activesupport/lib
parent93e6a0ec55a93fbb20d301763b69029b71d49fe9 (diff)
downloadrails-d034f488f9c2d694bcad9950df0310ca869956e0.tar.gz
rails-d034f488f9c2d694bcad9950df0310ca869956e0.tar.bz2
rails-d034f488f9c2d694bcad9950df0310ca869956e0.zip
Use SHA-1 for non-sensitive digests by default
Instead of providing a configuration option to set the hash function, switch to SHA-1 for new apps and allow upgrading apps to opt in later via `new_framework_defaults_5_2.rb`.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/railtie.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb
index 6b8fa676a9..605b50d346 100644
--- a/activesupport/lib/active_support/railtie.rb
+++ b/activesupport/lib/active_support/railtie.rb
@@ -70,9 +70,10 @@ module ActiveSupport
end
initializer "active_support.set_hash_digest_class" do |app|
- if app.config.active_support.hash_digest_class
- ActiveSupport::Digest.hash_digest_class =
- app.config.active_support.hash_digest_class
+ config.after_initialize do
+ if app.config.active_support.use_sha1_digests
+ ActiveSupport::Digest.hash_digest_class = ::Digest::SHA1
+ end
end
end
end