Safeguard
Security Guides•

Do you need a condition on a CI OIDC trust policy in AWS, GCP, or Azure?

Yes. GitHub says every cloud OIDC trust needs at least one condition. See how it looks in AWS, Google Cloud, and Azure, and a checklist to verify yours.

Safeguard Security Team
4 min read

Yes. GitHub's guides for AWS, Google Cloud, and Azure all say you must define at least one condition in the cloud trust, so untrusted repositories cannot request access tokens for your resources. Without a condition, the token issuer alone proves nothing about which repository is calling.

Why the issuer is not enough

The GitHub token issuer signs tokens for every repository on GitHub, not just yours. If your cloud role says only "trust tokens from this issuer", then a token minted for someone else's repository satisfies it. The condition is what narrows "any GitHub job" to "this job in my repository".

Think of the issuer as a passport office and the condition as the border officer asking who you are and where you are going.

How each cloud expresses it

ProviderWhere the condition livesTypical fields
AWSRole trust policyThe aud and sub condition keys under token.actions.githubusercontent.com
Google CloudWorkload identity provider attribute condition, plus the service account bindingMapped attributes such as the subject or repository
AzureFederated credential on the Entra applicationIssuer, subject, and audience

For AWS, the recommended audience is sts.amazonaws.com when using the official action, and the sub key is token.actions.githubusercontent.com:sub. GitHub's Google Cloud guide says you create an identity pool, configure the mapping and add conditions, then connect the pool to a service account that holds the roles/iam.workloadIdentityUser role. For Azure, the guide recommends api://AzureADTokenExchange as the audience value.

A cross cloud checklist

  1. Open the trust definition for each role, provider, or application that accepts GitHub tokens.
  2. Confirm an audience condition exists and matches the value the login action uses.
  3. Confirm a subject or repository condition exists and names your repository, not a pattern that includes others.
  4. Check for wildcards. A match on the whole repository allows every branch and pull request.
  5. Check Dependabot. GitHub notes that Dependabot update jobs have the event name set to dynamic, so if your provider supports event name conditions, allow only the event names your workflows expect.
  6. Remove unused providers and roles. Each one is a standing way in.
  7. Run a negative test from a repository you do not own, or from a feature branch, and confirm the login is refused.

GitLab and other issuers

The same principle applies to any CI issuer. GitLab's guidance says third party services can reject tokens that do not match their bound audience, and recommends including stable identifiers such as the project id and namespace id alongside the subject. Names can change; identifiers stay put.

What a condition cannot do

A condition proves where a token came from. It does not limit what the role can do once assumed. Give each role only the permissions the job needs, and split roles so a read only task never holds deploy rights.

Quick check

Is one condition enough?

It is the minimum GitHub requires. A tight setup combines audience, subject, and sometimes the event name, with exact matches.

Does Azure use the same sub formats as AWS?

The GitHub subject claim is the same, but each provider writes the condition differently. Check the provider's own documentation for the exact syntax.

Safeguard asset discovery can help you list repositories and pipelines in scope for a review like this, and compliance and evidence automation can keep the results as evidence. A free scan is at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.