fix(gitlab): drop openid scope requirement if there are no groups presented#4810
Merged
Merged
Conversation
Signed-off-by: Ilia Andreev <ilia.andreev.de@gmail.com>
5cfae7d to
928bf85
Compare
nabokihms
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Restore the previous GitLab OAuth scope behavior for logins that do not need group claims.
What this PR does / why we need it
PR #4800 added inherited group support and correctly requires
read_apiwheninheritedGroupsis enabled. However, it also made the GitLab connector requestopenideven when groups are not required.Before #4800, GitLab logins without group requirements requested only
read_user. Keepingopenidout of the no-groups flow preserves compatibility with existing GitLab OAuth applications that were configured only forread_user.This PR changes scope selection so:
read_userread_user,openidread_user,openid,read_apiThe GitLab scope test is updated to cover the restored no-groups behavior.
Special notes for your reviewer
To reproduce this issue I've created GitLab OAuth application with only the
read_userscope enabled, then ran Dex with a GitLab connector that has nogroups, nogetGroupsPermission, and noinheritedGroups, plus the example app onhttp://127.0.0.1:5555.Before this fix, starting the authorization code flow from the example app redirected to GitLab with:
scope=read_user+openidThat fails for an OAuth application configured only with
read_user.With this fix, the same flow redirects to GitLab (if groupsRequired == false) with:
scope=read_user