Skip to content

Add group memberships to oidc id_token endpoint response

What does this MR do?

Oidc clients which are not able to load the /userinfo endpoint are not be able to manage access based on group membership.
To enable this group memberships have been added to the id_token endpoint. This removes the need to use middleware such as dex for applications like ArgoCD, AKHQ, ... . Further it reduces the need for an extra polling of userinfo and should lead to a reduction of performance needs

Fixes #29053

Screenshots or Screencasts (strongly suggested)

before:

{
        "iss": "http://127.0.0.1:3000",
        "sub": "1",
        "aud": "c51abe1c1e5a32fd44694e7e3feb7f49529fc36a08bc6af403f00e53a61df055",
        "exp": 1629192464,
        "iat": 1629192344,
        "auth_time": 1629182602,
        "sub_legacy": "04345998080ec441c946fb08cc58942bfddaef9fa7c4430c5e03517643ec3432",
        "email": "admin@example.com",
        "email_verified": true
    }

now:

{
        "iss": "http://127.0.0.1:3000",
        "sub": "1",
        "aud": "c51abe1c1e5a32fd44694e7e3feb7f49529fc36a08bc6af403f00e53a61df055",
        "exp": 1629192464,
        "iat": 1629192344,
        "auth_time": 1629182602,
        "sub_legacy": "04345998080ec441c946fb08cc58942bfddaef9fa7c4430c5e03517643ec3432",
        "email": "admin@example.com",
        "email_verified": true,
        "groups": [
            "gitlab-org",
            "gnuwget",
            "Commit451",
            "jashkenas",
            "flightjs",
            "twitter",
            "h5bp",
            "gitlab-instance-bcfa3364"
        ]
    }

How to setup and validate locally (strongly suggested)

  1. Add application with openid scope
  2. Setup OIDC flow using the application with a testing application. I have used https://github.com/BeryJu/oidc-test-client ( If you use this a customization of the requested scopes is necessary )
  3. Do the workflow
  4. Inspecht return values of IDTokenClaims

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

If the user is member of a very large number of groups it could effect performance, but hard to tell if the need to no longer send an individual request to /userinfo mitigate this.

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Hannah Sutor

Merge request reports