Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Accessing nonexistant cookies through the signed jar should not raise…

… an exception
  • Loading branch information...
commit 1229ef7bf329cd09ed0a1bbe39530ccc69795995 1 parent 6d1494c
@dhh dhh authored
View
4 actionpack/lib/action_controller/cookies.rb
@@ -168,7 +168,9 @@ def initialize(parent_jar)
end
def [](name)
- @verifier.verify(@parent_jar[name])
+ if value = @parent_jar[name]
+ @verifier.verify(value)
+ end
end
def []=(key, options)
View
5 actionpack/test/controller/cookie_test.rb
@@ -157,6 +157,11 @@ def test_signed_cookie
assert_equal 45, @controller.send(:cookies).signed[:user_id]
end
+ def test_accessing_nonexistant_signed_cookie_should_not_raise_an_invalid_signature
+ get :set_signed_cookie
+ assert_nil @controller.send(:cookies).signed[:non_existant_attribute]
+ end
+
def test_permanent_signed_cookie
get :set_permanent_signed_cookie
assert_match %r(#{20.years.from_now.year}), @response.headers["Set-Cookie"].first
Please sign in to comment.
Something went wrong with that request. Please try again.