aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2018-01-12 15:03:32 -0700
committerGitHub <noreply@github.com>2018-01-12 15:03:32 -0700
commitf8afb5168aed810a061d081d3941c9dc9bd633c3 (patch)
tree029539470990dd29e272dea53ff6fe1ed8bc1705 /activesupport
parentaa0541e686d5e275315670b374b6c379cc67bc33 (diff)
parentd034f488f9c2d694bcad9950df0310ca869956e0 (diff)
downloadrails-f8afb5168aed810a061d081d3941c9dc9bd633c3.tar.gz
rails-f8afb5168aed810a061d081d3941c9dc9bd633c3.tar.bz2
rails-f8afb5168aed810a061d081d3941c9dc9bd633c3.zip
Merge pull request #31651 from eugeneius/use_sha1_digests
Use SHA-1 for non-sensitive digests by default
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md8
-rw-r--r--activesupport/lib/active_support/railtie.rb7
2 files changed, 8 insertions, 7 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 8378de5061..a21a817fbb 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -7,12 +7,12 @@
*Daniel Ma*
-* Allow the hash function used to generate non-sensitive digests, such as the
- ETag header, to be specified with `config.active_support.hash_digest_class`.
+* Use SHA-1 to generate non-sensitive digests, such as the ETag header.
- The object provided must respond to `#hexdigest`, e.g. `Digest::SHA1`.
+ Enabled by default for new apps; upgrading apps can opt in by setting
+ `config.active_support.use_sha1_digests = true`.
- *Dmitri Dolguikh*
+ *Dmitri Dolguikh*, *Eugene Kenny*
## Rails 5.2.0.beta2 (November 28, 2017) ##
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