Interview Prep/DevSecOps/Cloud identity: IRSA, Workload Identity and CI OIDC

`google-github-actions/auth` fails with `The given credential is rejected by the attribute condition`

IntermediateTroubleshootingCloud identity: IRSA, Workload Identity and CI OIDC
Answer

Likely causes → The Workload Identity Pool provider has an attribute-condition (as it should) that this workflow's claims do not satisfy, such as a different repository owner, a fork, or a non-main ref.

Diagnose →

gcloud iam workload-identity-pools providers describe github \
  --location=global --workload-identity-pool=ci --format='value(attributeCondition,attributeMapping)'

Fix → If the run is legitimate, adjust the condition, for example assertion.repository_owner == 'acme' && assertion.ref == 'refs/heads/main'. Then grant roles/iam.workloadIdentityUser (or direct resource roles) to principalSet://.../attribute.repository/acme/api.

Prevent → Always keep an attribute condition, because a provider without one trusts every GitHub repo. Scope bindings to specific repositories.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Cloud identity: IRSA, Workload Identity and CI OIDC