-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] REMEMBERME cookie does not get deleted using the "logout_on_user_change" option #26379
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
Comments
We could invalidate the remember-me cookie in the case you mentioned above where the user changes in the middle of an active session. But there is also the case with starting a new session only based on the remember-me cookie: Let's say the user does not have an active session but he only has a remember-me cookie. And somehow since the last active session the user "changed". Now if the user starts a new session and is logged in only based on the remember-me cookie it seems very tricky to support The cookie currently only contains 4 things: And for the "checksum" hash generation it uses the username and the password: So quite impossible to invalidate the token here by checking |
I don't think this is a problematic case. Logging the user in from |
@egonolieux could you please test #31172 and tell me if it's working for you, if it's the case I'm gonna commit tests into it. As far as I tested it seems to not authenticate though rememberme after I added the loginFail call after the token has been refreshed to null. |
This bug is still a thing in 4.4. Anything new here and possible ways to get that fixed? Remember me cookie still doesn't get deleted when using EquatableInterface and the new addition that automatically detects role changes is still doing the same. |
Nevermind |
See #34671 |
…ication (chalasr) This PR was merged into the 3.4 branch. Discussion ---------- [Security] Fix clearing remember-me cookie after deauthentication | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #26379 | License | MIT | Doc PR | - If you are using the `remember_me` listener and the refreshed user is deauthenticated, you are still logged in because the remember-me cookie does not get cleared. This fixes it. Commits ------- d625a73 [Security] Fix clearing remember-me cookie after deauthentication
So this seems to be still a thing here (
After changing the role again and reloading the page it seems to be fine, remember-me cookie is cleared and token populated with an anonymous Token.
Can someone actually confirm this on their application? Works fine with changing username, active/banned flag and so on. Thanks! |
To check if a user has changed in a security context, my
User
entity implements theEquatableInterface
. Because thelogout_on_user_change
is set to true, I expect the user to be logged out if theisEqualTo
method returnsfalse
. This is indeed the case, but only the session cookie seems to be reset and not theREMEMBERME
cookie, causing the user to be logged back in. I consider this to be a security flaw and not consistent with manually logging out (e.g. /logout URL), in which the REMEMBERME cookie does get deleted.It seems like an issue for this already exists, but was closed as fixed in 3.4.0.
This is from my log files:
My security config is pretty basic:
The text was updated successfully, but these errors were encountered: