-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rack 2.1.1+ breaks session_id #154
Comments
Duplicating my comment from rack/rack#1522 here, with some small updates to include ActiveRecord Session Store versions: Rack 2.1.1, ActiveRecord Session Store 1.1.3
Rack master (rack/rack@0155690), ActiveRecord Session Store 1.1.3
Let me know if I can provide any additional information 😄 |
Running into this issue as well - seems like it would be fairly widespread at this point but odd no on else has chimed in. This is an issue for me in a standard Rails application but not in a Rails API-only application. Update: I was able to resolve my issue by modifying my
It had originally been the following, which had worked for my Rails API-only application.
|
@jskirst I have the same thing as you and it doesn't fix my issue. |
Any update on this issue? |
We are hitting this as well after upgrading to 2.0 of this gem. In our case, we have middleware for fast autocomplete/typeahead functionality. We look up the session with: session = ActiveRecord::SessionStore::Session.find_by_session_id( request.cookies[session_key] )
However, we were able to solve it with: sid = Rack::Session::SessionId.new( request.cookies[session_key] )
sid.public_id # maps to what is stored in the cookie, obvs
sid.private_id # maps to what is stored in the database
session = ActiveRecord::SessionStore::Session.find_by_session_id( sid.private_id ) I don't know if this is the best, most idiomatic way to solve this but it works for us for now. |
The issue on master mentioned by @kaoru probably needs to be fixed in activerecord-session-store. It should now store and lookup the
private_id
of the session_id object in the database. The previous way of looking up the session directly using the session_id is prone to a timing attack, which is the reason rack's API was changed.Originally posted by @jeremyevans in rack/rack#1522 (comment)
The text was updated successfully, but these errors were encountered: