aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/session
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2014-07-09 21:49:37 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2014-08-04 11:33:19 -0300
commit930110b0452bd33e0ee54e9ec6d68e904ba7a0ad (patch)
treefbd53eade3a2767b8a7a89ec9751201686c873b2 /actionpack/test/dispatch/session
parentb2e88043b52a8f83820a0f4e8a65aa42fd40c544 (diff)
downloadrails-930110b0452bd33e0ee54e9ec6d68e904ba7a0ad.tar.gz
rails-930110b0452bd33e0ee54e9ec6d68e904ba7a0ad.tar.bz2
rails-930110b0452bd33e0ee54e9ec6d68e904ba7a0ad.zip
Regenerate sid when sbdy tries to fixate the session
Fixed broken test. Thanks Stephen Richards for reporting.
Diffstat (limited to 'actionpack/test/dispatch/session')
-rw-r--r--actionpack/test/dispatch/session/cache_store_test.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/actionpack/test/dispatch/session/cache_store_test.rb b/actionpack/test/dispatch/session/cache_store_test.rb
index b8479e8836..9f810cad01 100644
--- a/actionpack/test/dispatch/session/cache_store_test.rb
+++ b/actionpack/test/dispatch/session/cache_store_test.rb
@@ -148,16 +148,15 @@ class CacheStoreTest < ActionDispatch::IntegrationTest
def test_prevents_session_fixation
with_test_route_set do
- get '/get_session_value'
- assert_response :success
- assert_equal 'foo: nil', response.body
- session_id = cookies['_session_id']
+ assert_equal nil, @cache.read('_session_id:0xhax')
- reset!
+ cookies['_session_id'] = '0xhax'
+ get '/set_session_value'
- get '/set_session_value', :_session_id => session_id
assert_response :success
- assert_not_equal session_id, cookies['_session_id']
+ assert_not_equal '0xhax', cookies['_session_id']
+ assert_equal nil, @cache.read('_session_id:0xhax')
+ assert_equal({'foo' => 'bar'}, @cache.read("_session_id:#{cookies['_session_id']}"))
end
end
@@ -169,8 +168,8 @@ class CacheStoreTest < ActionDispatch::IntegrationTest
end
@app = self.class.build_app(set) do |middleware|
- cache = ActiveSupport::Cache::MemoryStore.new
- middleware.use ActionDispatch::Session::CacheStore, :key => '_session_id', :cache => cache
+ @cache = ActiveSupport::Cache::MemoryStore.new
+ middleware.use ActionDispatch::Session::CacheStore, :key => '_session_id', :cache => @cache
middleware.delete "ActionDispatch::ShowExceptions"
end