From 184eada9ec9c9d3a212608671dc41b7a753795c0 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sat, 7 Nov 2026 03:32:47 +0100 Subject: [PATCH] fix: require a groups claim on token exchange when group management is on (#33846) Token exchange now refuses the sign-in with a 403 when group management is on, the user is in at least one group and no groups claim can be read from the provider response or the token, the same way the roles check on that path already does. --- backend/open_webui/utils/oauth.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 94a74dc86b..bc62dab637 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -1753,6 +1753,9 @@ class OAuthManager: user_oauth_groups = [] user_current_groups: list[GroupModel] = await Groups.get_groups_by_member_id(user.id, db=db) + if oauth_claim and claim_data is None and token_claims is not None and user_current_groups: + log.warning('Token exchange denied: no readable groups claim in userinfo or the token') + raise HTTPException(status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED) all_available_groups: list[GroupModel] = await Groups.get_all_groups(db=db) # Create groups if they don't exist and creation is enabled