-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix login loop if login CSRF fails and user is not logged in #35419
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
Fix login loop if login CSRF fails and user is not logged in #35419
Conversation
|
I can confirm that this PR solves the issue #33919 ... It redirects only once , then I was able to login again . Hence, it stops the infinite loop. |
|
/backport to stable25 |
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.
LGTM and community confirmed that it fixes the issue
|
However @ChristophWurst nodb tests are failing: https://drone.nextcloud.com/nextcloud/server/26527/9/4 |
|
I only tested it with php8.1 .... the failed tests seems to be with php7.4 if I see it correctly. |
|
|
|
@ChristophWurst I know a way to reproduce the issue:
However with this patch I can confirm it makes it work (you get redirected one time and can log in afterwards again) :) |
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.
tested and works
|
Tested it as well. Had to log in twice, but no infinite loop. Also had only one tab open. |
|
Today this problem also struck me like described in #33919 but manually applying this patch solved the issue. So I'd vote for merging. 👍 |
|
Tests adjusted |
|
Thanks @ChristophWurst ! :) Could you maybe also fix https://github.com/nextcloud/server/actions/runs/3929063051/jobs/6717407444? Otherwise I could take care of rebasing :) |
If CSRF fails but the user is logged in that they probably logged in in another tab. This is fine. We can just redirect. If CSRF fails and the user is also not logged in then something is fishy. E.g. because Nextcloud contantly regenrates the session and the CSRF token and the user is stuck in an endless login loop. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2f3ff02 to
f22101d
Compare
|
/backport to stable24 |
|
/backport to stable23 |
|
The backport to stable24 failed. Please do this backport manually. |
|
The backport to stable23 failed. Please do this backport manually. |
Resolves: #33919
Summary
If CSRF fails but the user is logged in that they probably logged in in another tab. This is fine. We can just redirect.
If CSRF fails and the user is also not logged in then something is fishy. E.g. because Nextcloud contantly regenrates the session and the CSRF token and the user is stuck in an endless login loop.
TODO
Checklist