Skip to content
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

Stop the auto-logout loop after redirecting to the logout page #43701

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

julien-nc
Copy link
Member

Linked with nextcloud/user_oidc#743

If redirecting to the logout page leads to a long series of redirect, the current page's scripts are still active until a new page is actually loaded. So session-heartbeat.js will continue redirecting again and again to the logout page.

Solution: Clear the interval that triggers the redirect right after having redirected to /logout.

One problematic scenario:
When auto-logout is triggered in the frontend, it is possible that the session has already expired so the requesttoken GET param in the logout URL is not valid anymore. In this case, we get redirected to the login page. If user_oidc is configured to provide SSO login, the login flow will immediately starts. This flow can take long enough before a new page is actually loaded so session-heartbeat.js has time to redirect again to /logout which will start the login flow again. So we enter a weird loop in which the login flow never has time to load any page before the next redirection to /logout.

@juliushaertl As far as I could see, logging in when the login page is accessed via /login?redirect_url=/logout?requesttoken%3DfO5%252FSJDIa873djX6f is not problematic, there is no redirection to /logout after logging in. So I don't think there is no need for a backend fix to avoid a redirection to /logout right after logging in.

If this goes in, let's backport it to stable28, stable27 and stable26.

@julien-nc julien-nc added bug 3. to review Waiting for reviews labels Feb 20, 2024
@julien-nc julien-nc added this to the Nextcloud 29 milestone Feb 20, 2024
@julien-nc julien-nc requested review from juliushaertl, a team, Fenn-CS, szaimen and sorbaugh and removed request for a team February 20, 2024 16:52
@julien-nc julien-nc changed the title Stop the auto-logout loop after redirecting to the logout Stop the auto-logout loop after redirecting to the logout page Feb 20, 2024
@julien-nc
Copy link
Member Author

/compile amend

Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
@skjnldsv
Copy link
Member

backports?

@juliushaertl juliushaertl merged commit 2189baa into master Feb 20, 2024
97 checks passed
@juliushaertl juliushaertl deleted the fix/noid/logout-loop branch February 20, 2024 20:53
@juliushaertl
Copy link
Member

/backport to stable28

@juliushaertl
Copy link
Member

/backport to stable27

@julien-nc
Copy link
Member Author

/backport to stable26

@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants