mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "Merge pull request #16434 from strzalek/cookies-digest-config-option"
This reverts commit7059776205
, reversing changes made todde91e9bf5
. IT BROKE THE BUILD!!!
This commit is contained in:
parent
7059776205
commit
d70ba48c4d
5 changed files with 3 additions and 38 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue