Skip to content
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

Existing cookies are still valid for a while after logout when using Mojolicious::Sessions #25

Open
richardleach opened this issue Oct 31, 2018 · 0 comments

Comments

@richardleach
Copy link

It might be worth mentioning in Sessions.md or Logout.md that:
$self->session(expires => 1);
expires the cookie on the client side but does not invalidate any existing cookies.
(At least, not according to my 2 mins of testing just now; but that behaviour is consistent with session storage not being tracked server-side.)

A cookie obtained prior to logout could be stuffed back into the browser and used to access the application as the authenticated user, as long as the cookie hadn't expired in the meantime. This behaviour runs contrary to the expectation of the user, who has explicitly logged-out, and may not be acceptable to the security requirements of some organisations. (See OWASP Session Management Cheat Sheet.)

In comparison, because MojoX::Session has a server-side component to session management, it should be possible to clear the server-stored session upon logout as well as clearing the client-side cookie. (Disclaimer: I haven't stepped through this.) Having done so, even if a non-expired valid cookie is presented to the application after logout, there's no server-side session state for the cookie to match and so the application should treat the request as being unauthenticated/unauthorized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant