Cicd OIDC

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up cicd oidc by linking your build platform to your cloud provider. Your build runner then trades a short identity token for a temporary cloud role. Most teams start by storing long-lived keys inside pipeline secret stores. Static keys stay valid for months and create huge risk if they leak. When a pipeline uses a broad role, one bad script can drop production data. How cicd oidc works in build pipelines OpenID Connect lets your pipeline prove who it is without a saved password. First

K8s OIDC Authentication: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up cicd oidc by linking your build platform to your cloud provider. Your build runner then trades a short identity token for a temporary cloud role. Most teams start by storing long-lived keys inside pipeline secret stores. Static keys stay valid for months and create huge risk if they leak. When a pipeline uses a broad role, one bad script can drop production data.

How cicd oidc works in build pipelines

OpenID Connect lets your pipeline prove who it is without a saved password. First, you register your build platform as a trusted identity provider in your cloud account. Next, you create a cloud role with a strict trust policy. This policy checks claims inside the incoming token before granting a session. The claims tell the cloud which repo, branch, and job asked for the role.

When a job starts, the runner asks the build platform for a signed token. The runner sends this token to the cloud security token service. The cloud checks the signature against the public keys of the build platform. It also checks that the repo name and branch match your trust rule. If every check passes, the cloud sends back a temporary credential for that job. The token expires soon after the build step finishes its work.

How to scope trust rules for each pipeline

Good trust rules limit which jobs can assume a given cloud role. Never write a rule that trusts every repo in your group. A wide rule lets a test branch take over a production role. Instead, lock the subject claim to one repo and one release branch. You should also split roles by task and stage. Give your test job a small role that only reads test resources. Give your deploy job a separate role that only runs during main branch merges.

Check the audience claim on every token request as well. The audience string must match the exact target service you set up. If a token lacks a matching claim, the cloud rejects the login right away. Teams also set a short time limit on the cloud role session. Fifteen minutes is enough for most migration or deploy scripts to finish.

K8s OIDC Authentication: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native identity federation solves and what it misses

Moving away from static keys fixes a big problem for platform teams. Nobody has to rotate shared passwords across dozens of repos every ninety days. Leaked build logs no longer contain permanent keys that work from anywhere. Cloud sign-in logs also show which workflow run requested a role session.

Still, federation only checks who logs in at the start of a job. Once the runner gets a role, the cloud trusts every command in that session. Native federation cannot inspect individual SQL statements or shell commands in flight. If a deploy job connects to a database, it can run any allowed query. It can read raw emails, phone numbers, card numbers, or national IDs. Without query-level checks or field masking, one broken script can still delete critical 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 sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why should teams replace static pipeline keys with federated tokens?

Static keys never expire on their own and often sit in many secret stores. Federated tokens last for minutes and only work for one specific workflow run.

What happens if a trust policy claim is too broad?

A broad claim lets any branch or pull request assume a privileged cloud role. Attackers could open a pull request and run code with production permissions.

Does OIDC control what SQL queries a deploy script can run?

No, it only handles the initial login handshake between the runner and the cloud. It does not inspect database queries or rewrite sensitive fields in query results.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.