Skip to content

Unable to authenticate using OIDC workload identity when adding attribute condition #77

@rushminatorr

Description

@rushminatorr

TL;DR

Authentication is successfull when principleSet is set to: //iam.googleapis.com/projects/xxxxxxx/locations/global/workloadIdentityPools/rush3-pool/*

But fails when I limit it to a private repo under an org. //iam.googleapis.com/projects/xxxxxxx/locations/global/workloadIdentityPools/rush3-pool/<GITHUB_ORG>/*

Expected behavior

Authenticate with specific private repository.

Observed behavior

Error: Action failed with error: Error: failed to generate Google Cloud ID token for [email protected]: {
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "status": "PERMISSION_DENIED"
  }
}

Action YAML

- id: auth
      name: Authenticate to Google Cloud
      uses: google-github-actions/[email protected]
      with:
        token_format: id_token
        workload_identity_provider: projects/xxxxx/locations/global/workloadIdentityPools/rush3-pool/providers/rush3-provider
        service_account: [email protected]
        access_token_lifetime: '300s'

Additional information

❯ gcloud iam service-accounts get-iam-policy "[email protected]"
bindings:
- members:
  - principalSet://iam.googleapis.com/projects/xxxxxxx/locations/global/workloadIdentityPools/rush3-pool/<GITHUB_ORG>/*
  role: roles/iam.workloadIdentityUser
etag: xxxxxx
version: 1
❯ gcloud iam workload-identity-pools providers describe rush3-provider --location global --workload-identity-pool rush3-pool
attributeMapping:
  attribute.actor: assertion.actor
  attribute.aud: assertion.aud
  attribute.repository: assertion.repository_owner
  google.subject: assertion.sub
displayName: Rush demo provider
name: projects/xxxxx/locations/global/workloadIdentityPools/rush3-pool/providers/rush3-provider
oidc:
  issuerUri: https://token.actions.githubusercontent.com
state: ACTIVE

I have also followed steps described here: #36

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions