A short-lived OIDC token removes the need for a stored cloud access key, but it still grants authority according to a trust policy. A broad subject match can let a different branch, workflow, repository, or event assume the same role. The cloud role must verify the token's issuer and intended audience and bind the accepted identity to the deployment boundary actually protected by review.
CI OIDC claims: bind cloud access to the exact deployment job
Operational decision
A payment API has separate preview and production jobs. Give the preview role no production permissions. For production, match the provider's verified subject format for the protected repository and environment, check the intended audience, and limit the role's cloud actions and resources. The policy block is a claim checklist, not a provider-specific trust document; exact claim syntax must be taken from the token format used by the organization's identity provider. Deny a pull-request job, a feature branch, a different repository, and a job with the wrong audience in a disposable account. Then prove the protected production job can assume the role and perform only its required deployment action. Record role session identity with the release, not the bearer token itself. Recheck the trust policy after repository transfer, environment rename, or reusable-workflow changes because these may alter the accepted identity shape. A short token lifetime limits exposure time but cannot repair a wildcard trust rule.
Payment deployment trust contract
Issuer: approved CI identity provider
Audience: exact cloud token-exchange audience
Subject: protected repository and production environment
Allowed event: protected deployment workflow only
Role actions: release resources required by payment API
Negative checks: pull request, feature branch, other repositoryCost and verification
Narrow trust adds setup and migration work when workflows or repository identifiers change. Broad trust is cheaper to configure but increases the number of jobs able to deploy. Log successful and denied role assumptions with nonsecret claims and compare them with approved releases. Avoid placing token contents in build logs or test fixtures. A successful role assumption is only the identity gate; artifact digest and deployment target still need separate checks.
Common Mistakes
- Do not trust any job from a repository when only one protected environment should deploy.
- Do not omit audience validation because the subject looks specific.
- Do not log the bearer token while debugging denied claims.
Connected lessons
- DevOps: delivery, infrastructure, and reliable operations
- GitHub Actions: narrow tokens and cloud trust
- Federated workload identity: replace standing cloud keys with scoped trust
- Release evidence: tie one deployed digest to one approval decision
- Untrusted CI artifacts: separate a pull-request test from promotion
