Skip to content

docs: add GitLab OAuth setup and provider enrollment guide#6477

Merged
evankanderson merged 3 commits into
mindersec:mainfrom
intelligent-ears:docs/gitlab-provider-setup
May 28, 2026
Merged

docs: add GitLab OAuth setup and provider enrollment guide#6477
evankanderson merged 3 commits into
mindersec:mainfrom
intelligent-ears:docs/gitlab-provider-setup

Conversation

@intelligent-ears

Copy link
Copy Markdown
Member

Summary

Adds documentation for setting up and enrolling the GitLab provider on a self-hosted Minder instance. This is the first deliverable toward closing #6435.

What was tested

The full enrollment flow was tested end-to-end on a local Minder instance:

  • Built Minder from source and started the stack with make run-docker
  • Created a GitLab OAuth application with the correct redirect URIs
  • Enabled the gitlab_provider feature flag via flags-config.yaml
  • Configured server-config.yaml with the GitLab OAuth credentials
  • Successfully enrolled the GitLab provider with minder provider enroll --class gitlab
  • Verified repository discovery — 50 GitLab repositories were found and available to register

Changes

  • docs/docs/run_minder_server/config_gitlab_oauth.md — new guide covering:
    • Creating a GitLab OAuth application with the correct scopes and redirect URIs
    • Enabling the gitlab_provider feature flag
    • Configuring server-config.yaml
    • Enrolling the provider via the CLI
    • Known limitations (hosted instance not supported, webhook URL requirements, token identity verification not yet implemented)

Notes

  • The redirect_uri in server-config.yaml must be the base path (/api/v1/auth/callback/gitlab) without /cli or /web — the server appends the correct suffix. This tripped me up during testing and is now explicitly documented.
  • The GitLab OAuth app needs both /cli and /web redirect URIs registered, not just one.
  • GitLab support is gated behind the gitlab_provider feature flag and is not enabled on api.custcodian.dev. This is documented as a known limitation.

Closes #6435 (partial — this covers the documentation and testing setup portion of the epic)

Tested end-to-end on local Minder instance. Documents the feature flag,
server config, OAuth app setup, and enrollment steps.

Refs mindersec#6435
@intelligent-ears
intelligent-ears requested a review from a team as a code owner May 27, 2026 09:21
@coveralls

coveralls commented May 27, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 60.449% (+0.003%) from 60.446% — intelligent-ears:docs/gitlab-provider-setup into mindersec:main

evankanderson
evankanderson previously approved these changes May 27, 2026

@evankanderson evankanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for documenting this! I was able to create a GitLab provider and register a repository. Interestingly, it only showed up in my minder repo list when I explicitly listed by provider; that seems to be an API behavior which is mirrored by the GitHub App implementation when you have multiple apps installed, so I think it is expected.

The OAuth flow implemented by the GitLab implementation means that Minder is acting as the user who authenticates, rather than as something like a service account in the GitHub model. This means that if the registering user loses access to a repository (e.g. leaves a company / project), Minder will no longer be able to execute policy until the OAuth token is rotated via minder provider enroll.

Also, it appears that creating a service account in a group using using the service account's PAT doesn't work because GitLab PATs contain ".", and our validation pattern doesn't permit "." as a valid character.

http://localhost:8080/api/v1/auth/callback/gitlab/web
```
- **Confidential:** Yes (checked)
- **Scopes:** Check `api`, `read_user`, and `read_repository`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need write_repository to be able to create branches for PR remediations?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about read_registry for artifacts? I'm guessing the GitLab provider doesn't yet support the container / artifact provider facet...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need write_repository to be able to create branches for PR remediations?

Not needed currently — the GitLab provider doesn't yet implement PR remediation or branch creation. I'll leave it out for now and it can be added when that's implemented.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about read_registry for artifacts? I'm guessing the GitLab provider doesn't yet support the container / artifact provider facet...

Correct — artifact/container registry support isn't implemented in the GitLab provider yet. Leaving it out of the minimum required scopes

http://localhost:8080/api/v1/auth/callback/gitlab/web
```
- **Confidential:** Yes (checked)
- **Scopes:** Check `api`, `read_user`, and `read_repository`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should read_user be openid or profile?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

("profile") worked for me for registering a repository using the OAuth flow. As mentioned, the service account flow seems to be broken for GitLab, so we'll need a separate PR for that (which may also want to add user documentation for registering a GitLab repository, with best practices).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — updating to profile as you confirmed it works. read_user gives broader access than needed.

@evankanderson

Copy link
Copy Markdown
Member

I can merge this as-is and we can follow up with adjustments, or you can make changes and I can re-approve -- your choice!

@intelligent-ears

Copy link
Copy Markdown
Member Author

I can merge this as-is and we can follow up with adjustments, or you can make changes and I can re-approve -- your choice!

I'll update the scopes, cleaner to get it right

@evankanderson evankanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two notes for coming back to this PR later, but I think this is good to merge. Thanks for exploring and documenting this!

I think next steps would include:

  • Fixing the service account thing (should be a simple fix, I can PR that today probably)
  • Defining a "pr" provider facet which both GitLab and GitHub can implement, to enable more remediations for GitLab
  • Figure out what's needed for datasource provider auth for GitLab, if anything
  • Look at the OSPS-Baseline rules and figure out what the GitLab coverage fraction is, and how to increase to 100% of level-1.
  • Possibly defining a "gitlab" facet to cover GitLab specific APIs, but I'm not sure what it would contain (so maybe hold off on this)

Comment on lines +80 to +83
## Access model

Minder acts as the authenticated GitLab user when managing repositories. This
means:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we should have per-provider documentation that covers this, but I think this is fine for now.

Comment on lines +104 to +105
- GitLab service account PATs are not currently supported due to a validation
issue with the `.` character in PAT tokens.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PAT is the only mechanism for service accounts, but it should be easy to fix the validation problem.

@evankanderson
evankanderson merged commit 71a061f into mindersec:main May 28, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Roadmap: Expand Source Forge Provider Coverage

3 participants