-
Notifications
You must be signed in to change notification settings - Fork 9
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
Regenerate session identifier #12
Comments
Since the middleware is entirely cookie-based, fixation should not be possible. Additionally, not every wai-session backend uses session ids (for example, https://hackage.haskell.org/package/wai-session-clientsession) Though it would be |
It is possible for cookies: https://www.owasp.org/index.php/Session_fixation |
With XSS, sure
Yes, definitely. If you look at https://github.com/singpolyma/wai-session/blob/master/Network/Wai/Session/Map.hs#L31 for example, you will see it does |
ok. I'll leave it as feature request for Map backend then :) |
So the backend can create a new cookie; however, there is no way for the application to signal the backend a new cookie is required. I've created a workaround for this in the wai-session-postgresql backend, but it is not too pretty. (See https://hackage.haskell.org/package/wai-session-postgresql-0.1.1.0/docs/Network-Wai-Session-PostgreSQL.html#v:clearSession) IMHO a solution to this would be to extend wai-session to allow an arbitrary number of functions to be passed from the session backend to the application. |
@hce I guess generating a new id every time would be expensive for your backend, since you would need a db query to update it every time? What if we add a new, future-extensible action along with the get and set actions that is |
I've tried generating a new ID for each request. This unfortunately fails when multiple AJAX requests are sent in parallel. IMHO it'd be nicer if the "management actions" depended on the used session backend. For example, "GenerateNewSessionID" does not make sense for a client side session store, and would generate a runtime error or be silently ignored (possibly resulting in a security problem, depending on how the session store is used). |
I assumed silently ignored, yes. Ideally apps using a wai-session should be as backend-agnostic as possible (since that is the point of wai-session). Perhaps instead of low-lever "management actions" it should be a way to notify the backend of a possibly-relevant state change (such as "priviledges changed") so the backend can decide how to act appripriately |
That sounds good to me. ATM I can only think of two state change notifications:
|
To avoid session fixation attacks it is good practice to generate new session identifier when privileges changed.
It'd be nice to have this feature in wai-session. basically it should assign new identifier and copy all session data.
The text was updated successfully, but these errors were encountered: