Skip to content
This repository has been archived by the owner on Jan 7, 2018. It is now read-only.

Commit

Permalink
Set secure and httponly flags on admin session cookie.
Browse files Browse the repository at this point in the history
These help prevent session sidejacking or mitigate the impact of
potential XSS issues.
  • Loading branch information
GUI committed Apr 11, 2015
1 parent f57ac5c commit 5d095bc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/initializers/session_store.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Be sure to restart your server when you modify this file.

ApiUmbrella::Application.config.session_store :cookie_store, :key => '_api_umbrella_session'
ApiUmbrella::Application.config.session_store(:cookie_store, {
:key => "_api_umbrella_session",

# Don't allow cookies to be accessed by javascript.
:httponly => true,

# Use secure cookies to prevent sidejacking.
:secure => !["development", "test"].include?(Rails.env),
})

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
Expand Down

0 comments on commit 5d095bc

Please sign in to comment.