diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2014-08-08 18:20:17 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2014-08-08 18:20:33 -0300 |
commit | d70ba48c4dd6b57d8f38612ea95a3842337c1419 (patch) | |
tree | 7dd4e40be314eab0e55072714c3454a88110b7ca | |
parent | 705977620539e2be6548027042f33175ebdc2505 (diff) | |
download | rails-d70ba48c4dd6b57d8f38612ea95a3842337c1419.tar.gz rails-d70ba48c4dd6b57d8f38612ea95a3842337c1419.tar.bz2 rails-d70ba48c4dd6b57d8f38612ea95a3842337c1419.zip |
Revert "Merge pull request #16434 from strzalek/cookies-digest-config-option"
This reverts commit 705977620539e2be6548027042f33175ebdc2505, reversing
changes made to dde91e9bf5ab246f0f684b40288b272f4ba9a699.
IT BROKE THE BUILD!!!
-rw-r--r-- | actionpack/CHANGELOG.md | 5 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 10 | ||||
-rw-r--r-- | actionpack/test/dispatch/cookies_test.rb | 17 | ||||
-rw-r--r-- | railties/CHANGELOG.md | 6 | ||||
-rw-r--r-- | railties/lib/rails/application.rb | 3 |
5 files changed, 3 insertions, 38 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 253b647aca..44b8fa843d 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,8 +1,3 @@ -* Add `config.action_dispatch.cookies_digest` option for setting custom - digest. The default remains the same - 'SHA1'. - - *Łukasz Strzałkowski* - * Extract source code for the entire exception stack trace for better debugging and diagnosis. diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 55bb9de173..ac9e5effe2 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -90,7 +90,6 @@ module ActionDispatch SECRET_TOKEN = "action_dispatch.secret_token".freeze SECRET_KEY_BASE = "action_dispatch.secret_key_base".freeze COOKIES_SERIALIZER = "action_dispatch.cookies_serializer".freeze - COOKIES_DIGEST = "action_dispatch.cookies_digest".freeze # Cookies can typically store 4096 bytes. MAX_COOKIE_SIZE = 4096 @@ -213,8 +212,7 @@ module ActionDispatch secret_token: env[SECRET_TOKEN], secret_key_base: env[SECRET_KEY_BASE], upgrade_legacy_signed_cookies: env[SECRET_TOKEN].present? && env[SECRET_KEY_BASE].present?, - serializer: env[COOKIES_SERIALIZER], - digest: env[COOKIES_DIGEST] + serializer: env[COOKIES_SERIALIZER] } end @@ -443,10 +441,6 @@ module ActionDispatch serializer end end - - def digest - @options[:digest] || 'SHA1' - end end class SignedCookieJar #:nodoc: @@ -457,7 +451,7 @@ module ActionDispatch @parent_jar = parent_jar @options = options secret = key_generator.generate_key(@options[:signed_cookie_salt]) - @verifier = ActiveSupport::MessageVerifier.new(secret, digest: digest, serializer: NullSerializer) + @verifier = ActiveSupport::MessageVerifier.new(secret, serializer: NullSerializer) end def [](name) diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb index 744143fc2c..0f145666d1 100644 --- a/actionpack/test/dispatch/cookies_test.rb +++ b/actionpack/test/dispatch/cookies_test.rb @@ -369,23 +369,6 @@ class CookiesTest < ActionController::TestCase assert_equal 'Jamie', @controller.send(:cookies).permanent[:user_name] end - def test_signed_cookie_using_default_digest - get :set_signed_cookie - cookies = @controller.send :cookies - assert_not_equal 45, cookies[:user_id] - assert_equal 45, cookies.signed[:user_id] - assert_equal 'SHA1', cookies.signed.instance_variable_get(:"@verifier").instance_variable_get(:"@digest") - end - - def test_signed_cookie_using_custom_digest - @request.env["action_dispatch.cookies_digest"] = 'SHA256' - get :set_signed_cookie - cookies = @controller.send :cookies - assert_not_equal 45, cookies[:user_id] - assert_equal 45, cookies.signed[:user_id] - assert_equal 'SHA256', cookies.signed.instance_variable_get(:"@verifier").instance_variable_get(:"@digest") - end - def test_signed_cookie_using_default_serializer get :set_signed_cookie cookies = @controller.send :cookies diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 95693f958b..1ccdfb6589 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,9 +1,3 @@ -* The `Rails.application.message_verifier` now returns ActiveSupport::MessageVerifier - preconfigured with `:digest` and `:serializer` values set to `config.action_dispatch.cookies_digest` - and `config.action_dispatch.cookies_serializer` accordingly. - - *Łukasz Strzałkowski* - * Add `after_bundle` callbacks in Rails templates. Useful for allowing the generated binstubs to be added to version control. diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 16bea413b5..61639be7c6 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -200,7 +200,7 @@ module Rails def message_verifier(verifier_name) @message_verifiers[verifier_name] ||= begin secret = key_generator.generate_key(verifier_name.to_s) - ActiveSupport::MessageVerifier.new(secret, digest: config.action_dispatch.cookies_digest, serializer: config.action_dispatch.cookies_serializer) + ActiveSupport::MessageVerifier.new(secret) end end @@ -257,7 +257,6 @@ module Rails "action_dispatch.encrypted_cookie_salt" => config.action_dispatch.encrypted_cookie_salt, "action_dispatch.encrypted_signed_cookie_salt" => config.action_dispatch.encrypted_signed_cookie_salt, "action_dispatch.cookies_serializer" => config.action_dispatch.cookies_serializer - "action_dispatch.cookies_digest" => config.action_dispatch.cookies_digest }) end end |