If a user leave's a session open on a machine that is compromised or has the session sniffed in some way they might change their password (its common advice if your account is compromised). To make that password change more effective, we should log out all sessions when that happens.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2294061_paranoia_remove_other_sessions.patch | 1.29 KB | greggles |
Comments
Comment #1
gregglesOK, here's a patch that needs review.
Comment #2
pere orgaI like that idea.
Wouldn't be even better if the current session is logged out as well? For the cases the session id has been stolen.
Comment #3
scor commented@Pere Orga I believe core will regenerate a session ID after you change your password (needs to be verified).
Comment #4
greggles@Pere - I thought about that too. It seems like a ux annoyance to be logged out when you change your password and since you *just* set your password it's clear that this session should be able to login again with the password that was just set, so I didn't try to do that. I think scor is right that regenerating the session but keeping the user logged in achieves the same goal. I just confirmed that's how core works :)
Comment #6
gregglesThanks for the feedback, scor/pere. Now committed :)
Comment #8
znerol commentedComing here from #2508637: Changing password should invalidate all other sessions. This patch seems to replicate behavior which is already implemented in D7, see user.module around line 544. I've tested this on a fresh D7 install (sans Paranoia) and changing the password in one browser kills all sessions for the same user in other browsers.
Comment #9
gregglesWow, I could swear I tested this. Maybe it has to do with Bakery cookies?
@Pere/@Scor - did either of you test it out?
Comment #10
nedjoIn Drupal 8 this appears to be covered in
User::postSave().Comment #11
drummYes, bakery cookies used to over-regenerate sessions on Drupal.org.