Skip to content

Instantly share code, notes, and snippets.

@trueheart78
Created December 12, 2017 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trueheart78/784c8d003ed84ebccb3f6bb3e6f81e74 to your computer and use it in GitHub Desktop.
Save trueheart78/784c8d003ed84ebccb3f6bb3e6f81e74 to your computer and use it in GitHub Desktop.
64 Digit Session ID for Rails
# config/initializers/01_session_security.rb
module SessionSecurity
def generate_sid
sid = SecureRandom.hex(32)
sid.encode!(Encoding::UTF_8)
sid
end
end
ActionDispatch::Session::AbstractStore.include SessionSecurity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment