-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat: Refined session handling #40543
Conversation
* Remove secondary persistent remember me tokens * Decouple session ID and session token Signed-off-by: Christoph Wurst <[email protected]>
Nice one 👍 |
} catch (SessionNotAvailableException $ex) { | ||
return; | ||
} | ||
$token = \OCP\Server::get(IRequest::class)->getCookie(self::COOKIE_SESSION_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit scared ;)
Isn't that a cyclic dependency?
Would you have an overview of how this is stored in database? |
I have two questions on it:
|
Yes, replay attacks are possible with the current implementation. |
Closing due to #40543 (comment). This need more time and thought. |
Summary
Before
Remember me is handled with persisted tokens stored in preferences. At cookie login (session expired, cookie is still alive), the token is compared with the database values, token is replaced on success. The session id is also the password/token of the session token in the password. This process is falling apart with concurrency. First, only one process can win the token race. Rarely there are two, because tokens are not read and replaced in a transaction. But then there are also two new PHP sessions and the database can only be updated once.
After
Remember me is still handled by a persisted token, but the token is a random one and it doesn't change throughout the session.
Transition
The session id can be used as the "random" token at migration. The logic will keep that session alive as well. New sessions will use a real random token.
TODO
Checklist