How to Configure GitLab Well Known Openid Configuration
The gitlab well known openid configuration tells external cloud tools how to trust GitLab tokens. You set it up by matching issuer URLs, public keys, and strict claim rules. This metadata document lives at a standard discovery path on your GitLab server. Cloud providers and target apps read it to check identity tokens from your pipelines. When you set it up well, your build jobs do not need saved passwords. Instead, jobs trade short tokens for temporary cloud roles during a run. How the gitla
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
The gitlab well known openid configuration tells external cloud tools how to trust GitLab tokens. You set it up by matching issuer URLs, public keys, and strict claim rules.
This metadata document lives at a standard discovery path on your GitLab server. Cloud providers and target apps read it to check identity tokens from your pipelines. When you set it up well, your build jobs do not need saved passwords. Instead, jobs trade short tokens for temporary cloud roles during a run.
How the gitlab well known openid configuration works
OpenID Connect lets one service prove a user or job identity to another service. GitLab acts as an identity provider for both human users and automated build jobs. The discovery document lists the exact URLs where external apps can fetch public keys. Those public keys check the digital signature on every token that GitLab signs.
This setup affects two main groups in your daily work. First, build runners use these tokens to assume roles in cloud platforms. Second, developers use single sign-on to log in to third-party dashboards with GitLab credentials. Both patterns rely on the same public metadata endpoint to start the trust check.
Safe defaults matter when you register GitLab as a trusted issuer in external tools. Always scope trust rules to a single project, branch, or job context. If you trust the entire server without claim filters, any repo can assume your role. You should also set a custom audience claim for each target cloud platform. That rule stops an attacker from replaying a valid token against the wrong service.
Self-hosted admins must check that their server URL uses valid TLS certificates. External cloud tools will reject the discovery document if the certificate chain fails. You also need to allow outbound traffic from target apps to the GitLab key endpoint. Without that network path, the target app cannot fetch keys when GitLab rotates them.
Checking and auditing your identity setup
Before you run live workloads, check what claims your tokens actually carry. Inspect a test token in a build job to see the exact subject string. Match that exact string in your cloud role trust policy before granting write rights. Test a pull request from a fork to confirm that untrusted branches fail the check.
OpenID Connect (OIDC) + GitLab CI Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Good audit logs help you track which job used a cloud role and when. Your cloud platform logs the token subject each time a job trades a token. You can match that subject string back to a specific GitLab project and commit. Review these logs often to spot jobs that ask for broad roles they never use.
Static trust rules only check who starts a session at login time. Once a runner or user passes the token check, the cloud role grants broad rights. A valid job with database rights can run any query or drop a production table. Static identity checks also do not mask sensitive data like emails or card numbers.
To close that gap, teams pair identity setup with runtime controls at the query level. Runtime checks inspect each command after login and rewrite matched fields in results. That way, a leaked build job or wide role cannot dump raw customer tables.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Where does the GitLab discovery document live?
GitLab hosts this public JSON document at the standard OpenID discovery path on its domain. Any external tool with network reach can read this URL without logging in first.
Why did my cloud role reject a valid GitLab token?
Most failures happen when the token audience or subject does not match your role rule. Check the exact branch, tag, and project path in the token against your cloud policy.
Do I need to rotate keys for the discovery endpoint?
GitLab manages and rotates the signing keys listed in its public key endpoint for you. External services read the discovery URL to pick up new public keys on their own.
Related guides
In this post