Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workload identity federation support #381

Closed
lanzelotik opened this issue Mar 15, 2022 · 9 comments
Closed

Add workload identity federation support #381

lanzelotik opened this issue Mar 15, 2022 · 9 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@lanzelotik
Copy link

Add workload identity federation support https://cloud.google.com/iam/docs/using-workload-identity-federation

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Mar 16, 2022
@bshaffer bshaffer added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 23, 2022
@yoshi-automation yoshi-automation removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Mar 23, 2022
@judge2020
Copy link

judge2020 commented Mar 9, 2023

Is this planned? Workload identity federation for accessing GCP services on eg. AWS is a much more secure method than keeping credentials on a machine, and I'd love to use it for my PHP projects.

@dylanenabled
Copy link

Specifically, this library should add support for the "external_account" google application credentials "type" as defined in https://google.aip.dev/auth/4117

This is the format that is generated with the gcloud iam workload-identity-pools create-cred-config command and allows using aws, jwt or saml credentials files to impersonate a serviceaccount.

For example (from CircleCI ), pointing the GOOGLE_APPLICATION_CREDENTIALS environment variable to a file that looks like this should load the credentials source to get the token, then use it to impersonate the service account.

 {
  "type": "external_account",
  "audience": "//iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/providers/PROVIDER_ID",
  "subject_token_type": "urn:ietf:params:oauth:token-type:jwt",
  "token_url": "https://sts.googleapis.com/v1/token",
  "service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/circleci-test@incubator-344312.iam.gserviceaccount.com:generateAccessToken",
  "credential_source": {
    "file": "CIRCLE_OIDC_TOKEN_FILE",
    "format": {
      "type": "text"
    }
  }
}

@ghost
Copy link

ghost commented May 22, 2023

Any updates on this?

@bshaffer
Copy link
Contributor

@arnaubuch this is being worked on now and we will be delivering this auth feature soon

@JurgenLangbroek
Copy link

How is it going with this feature?

@bshaffer
Copy link
Contributor

bshaffer commented Aug 15, 2023

This is being worked on in #462!

@SpencerMalone
Copy link

SpencerMalone commented Sep 13, 2023

Don't forget OIDC / JWT tokens pls!

@bshaffer
Copy link
Contributor

For everyone following this thread, we have a PR for supporting AWS that should be merged soon. It would be great to have your help testing it out and reviewing it!
Here is the pull request: #474

To test it out, it's simple
DO NOT PERFORM THESE STEPS IN A PRODUCTION ENVIRONMENT

  1. install the dev version of the auth library in your application running on AWS with the following command:
    composer require google/auth:dev-aws-for-sts as 1.31.0
    note: this installs a development branch of the auth library, and so is not meant for production use
  2. Follow the instructions in https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds to enable Workload Identity Federation
  3. Download the credentials on your AWS instance and set GOOGLE_APPLICATION_CREDENTIALS to that file
  4. Verify the authentication works as expected.

We expect to have this feature merged and released shortly! If you are willing to test it out beforehand and provide feedback, that would be greatly appreciated. Thank you!

@bshaffer
Copy link
Contributor

bshaffer commented Oct 5, 2023

Workload Identity Federation support has been added! Please update your google/auth dependency to the latest version (v1.31.0)

This should work out of the box when you set the path to your Workload Identity Federation credentials to the GOOGLE_APPLICATION_CREDENTIALS environment variable, after following the setup instructions

Please open new issues if you encounter any problems or have any questions. Thank you!

Note: Workforce Credentials are still not supported, but support is coming soon (see #485)

@bshaffer bshaffer closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

7 participants