-
-
Notifications
You must be signed in to change notification settings - Fork 964
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
Recovery link doesn't log out existing users #1077
Comments
Thank you! Added to the 0.6 milestone. |
So, when we use the recovery token, we issue a new session by calling CreateAndIssueCookie. Looking at the code for CreateAndIssueCookie here, it would seem that we should be overwriting any old session cookie: kratos/session/manager_http.go Lines 63 to 96 in 83aedcb
We could explicitly purge the cookie from the request here, but it strikes me as strange that this would be necessary. Can you share your configuration file, @andrewbanchich? |
I think another good approach would be to try and recreate the issue and see if we encounter it - from there the debugging can start :) |
|
I'm having a similar issue when logging in, if a user is logged in and another user logs in, the profile/settings page shows the original user data, i expect its the same cause? |
I believe the main problem here is that recovery is carried out only for unauthenticated callers:
ory_kratos_session cookie attached (as is the case when using samesite=lax), it just gets redirected to default_browser_return_url .
Using samesite=strict solves the problem, but causes another one. While the initial request with the recovery token does not include the current @aeneasr It would seem that the fix would be to run |
Reading through the code more, I see now that the same endpoint that takes the recovery token, also handles recovery form submissions (when you want to get an email with the recovery link). In this case, we should ignore the existing session only when the request has a recovery token 🤔. |
One workaround for this issue is to strip request cookies on your reverse proxy. For example, with nginx, you can add this to your configuration:
|
You can now use the `revoke_active_sessions` hook in the recovery flow. It invalidates all of an identity's sessions on successful account recovery. Closes #1077
done (not released yet) |
You can now use the `revoke_active_sessions` hook in the recovery flow. It invalidates all of an identity's sessions on successful account recovery. Closes #1077
You can now use the `revoke_active_sessions` hook in the recovery flow. It invalidates all of an identity's sessions on successful account recovery. Closes #1077
You can now use the `revoke_active_sessions` hook in the recovery flow. It invalidates all of an identity's sessions on successful account recovery. Closes #1077
@aeneasr I wanted to test your fix locally (running f96e48f), but I can't get the configuration to validate:
The relevant part of the config is: recovery:
enabled: true
ui_url: http://127.0.0.1:4455/recovery
after:
hooks:
- hook: revoke_active_sessions |
@aeneasr I managed to test |
I can confirm it's fixed in v0.9.0-alpha.3. |
You can now use the `revoke_active_sessions` hook in the recovery flow. It invalidates all of an identity's sessions on successful account recovery. Closes ory#1077
To reproduce:
[email protected]
.[email protected]
.[email protected]
.[email protected]
.The text was updated successfully, but these errors were encountered: