mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #7583] Bug: Signout doesn't terminate SSO sessions #30332
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sreinwald on GitHub (Dec 3, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7583
Bug Report
Installation Method
Docker compose
Environment
Confirmation:
Expected Behavior
When a user clicks on the logout button, it should fully terminate their session both within Open WebUI and with the SSO provider, in our case Keycloak.
The user should have to re-authenticate before being able to access the webui after logging out.
Actual Behavior
Clicking the logout button only deletes the cookie for Open Webui, but does not end the session in Keycloak.
As a result, users can still access the webui (and any other SSO-enabled service) without having to re-authenticate by simply clicking the button to sign in with the IDP again.
Description
Bug Summary:
Logout functionality is incomplete because when using SSO, logging out does not properly terminate the user's SSO session.
Reproduction Details
Steps to Reproduce:
Logs and Screenshots
Screenshots/Screen Recordings (if applicable):
Additional Information
In my opinion, this is potentially a security issue because when a user logs out of an application, they expect all SSO sessions to terminate. The session not being terminated properly means anyone with physical access to the user's device could use the still existing session to access all other SSO-enabled services without having to re-authenticate.
I've taken a brief look at the code, and it seems like the logout function does not attempt to call an end session endpoint at all, which is why I suspect this is not related to Keycloak specifically but likely affects every OAuth2/OIDC deployment.
c4ea31357f/backend/open_webui/apps/webui/routers/auths.py (L500-L503)@tjbck commented on GitHub (Dec 3, 2024):
PR welcome!
@ZaibanAli commented on GitHub (Dec 6, 2024):
Bump, facing the same issue. I will work on it over the weekend and open a pull request.
@ZaibanAli commented on GitHub (Dec 7, 2024):
@tjbck I have opened a pull request 7678, please review. Thanks.
Demonstration Video
@tjbck commented on GitHub (Dec 10, 2024):
@ZaibanAli's PR has been merged, should be fixed in dev. Testing wanted here!
@ZaibanAli commented on GitHub (Dec 10, 2024):
@tjbck will do it today. Thanks for merging the PR.
@ZaibanAli commented on GitHub (Dec 10, 2024):
@tjbck I have tested the functionality. It works!
we can close this issue.
@sreinwald commented on GitHub (Dec 10, 2024):
Just tested the dev branch in our test environment and it worked as expected. Could observe sessions being properly terminated in Keycloak.
Personally, I'd be happy to consider this issue closed, but further testing with other SSO providers would probably be a good idea.
Thanks again, @ZaibanAli
@nagug commented on GitHub (Dec 11, 2024):
Before raising another ticket, I have the similar issue with Authentik integration as well for logout. Is this fix specific to Keycloak?
@ZaibanAli commented on GitHub (Dec 11, 2024):
@nagug I expect it to work with Authentik as well, can you please test?
@nagug commented on GitHub (Dec 11, 2024):
@ZaibanAli let me set up the env and come back. I have been using docker images so far.
@sreinwald commented on GitHub (Dec 11, 2024):
@nagug You can just replace the docker release tag.
Duplicate your docker compose, change volumes to be safe and change the release tag from
maintodevSo change
to
@nagug commented on GitHub (Dec 11, 2024):
Thanks, thats exactly what i tried and looks like its not fixed yet for Aunthetik. the behaviour is same as the orginal keycloak. Is there anything more i can provide to help. what additional context would you prefer?
@sreinwald commented on GitHub (Dec 11, 2024):
@nagug I could be wrong, but I believe you have to do a
docker compose pull- it might still be using the main image.@nagug commented on GitHub (Dec 11, 2024):
I did a system prune and cleanedup everything. Then created a new docker compose file and did a compose up with all env variables. Let me try again
@nagug commented on GitHub (Dec 11, 2024):
Nope. checked again. pretty much clean sheet. the issue exists. double checked my image pulled. here is the docker compose file. Please let me know if i am doing something wrong,
@nagug commented on GitHub (Dec 11, 2024):
Also the .well-known/openid-configuration from authentik looks like below
@nagug commented on GitHub (Dec 11, 2024):
@ZaibanAli - i was trying to see what is the redirect url is. It look like the url looks correct. a 307 redirect. But the browser does not seem to redirect at all.
I tried to see, how the logout is implemented in audiobookshelf (which logs out correctly). Found there is a call made to
/end-session/?post_logout_redirect_uri=Not sure that is of any help
@ZaibanAli commented on GitHub (Dec 12, 2024):
@nagug thank you for the detail information. I will look into this again on weekend. (will push a patch)
@nagug commented on GitHub (Dec 15, 2024):
@ZaibanAli - any luck., feel free to ping, if you need any additional data
@ZaibanAli commented on GitHub (Dec 16, 2024):
@nagug on it, haven't got the time to setup the authentik
@nagug commented on GitHub (Dec 18, 2024):
Thanks for the effort. Look forward to it
@ZaibanAli commented on GitHub (Dec 18, 2024):
@nagug looks like it is Authentik specific issue. When the openwebui redirect the response to the endsession url it actually signout from the Authentik application but not from the authentik instance.
I am not an expert with Authentik but it is something to do with how the authentik handles the flows?
When the end_session url http://<authentik_instance_url>/application/o/openwebui/end-session/?id_token_hint=..... is clicked I get the following https://snipboard.io/vMZ7SP.jpg which actually show that the flow is working on openwebui end.