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

fix: 'Incorrect token audience' error for GitHubOidcProvider #1350

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Jun 23, 2022

This is an update to the GitHubOidcProvider construct that creates IAM resources for GitHub Actions, first introduced by PR #823 in early October 2021 - apparently the ClientIdList value should no longer be sigstore, as of 19th October 2021!

The new value is sts.amazonaws.com, which I think corresponds to this line in the GitHub docs:

For the "Audience": Use sts.amazonaws.com if you are using the official action.

When using the old value of sigstore in the AWS::IAM::OIDCProvider ClientIdList field, running the aws-actions/configure-aws-credentials GitHub Action will give you an "Error: Incorrect token audience" error:

https://github.com/guardian/facia-scala-client/runs/7025740057?check_suite_focus=true#step:3:6

@rtyley rtyley changed the title Fix 'Incorrect token audience' error for GH OIDC Fix 'Incorrect token audience' error for GitHubOidcProvider Jun 23, 2022
@rtyley rtyley changed the title Fix 'Incorrect token audience' error for GitHubOidcProvider fix: 'Incorrect token audience' error for GitHubOidcProvider Jun 23, 2022
@rtyley rtyley force-pushed the fix-incorrect-token-audience-error-when-using-configure-aws-credentials-github-action branch from 10db93b to cef0bfa Compare June 23, 2022 15:41
Copy link
Member

@akash1810 akash1810 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I think you'll need to update the test too.

This is an update to the construct that creates IAM resources for GitHub
Actions, first introduced with #823
in early October 2021.

Apparently the `ClientIdList` field should no longer be `sigstore`, as
of 19th October 2021:

aws-actions/configure-aws-credentials#291
aws-actions/configure-aws-credentials#280 (comment)
aws-actions/configure-aws-credentials#284

The new value is `sts.amazonaws.com`, which I think corresponds to this
line in the docs:

> For the "Audience": Use sts.amazonaws.com if you are using the official action.
https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services#adding-the-identity-provider-to-aws

With the old value of `sigstore` in the `AWS::IAM::OIDCProvider` `ClientIdList` field,
running the `aws-actions/configure-aws-credentials` GitHub Action will give you
a "Error: Incorrect token audience" error:

https://github.com/guardian/facia-scala-client/runs/7025740057?check_suite_focus=true#step:3:6
@rtyley rtyley force-pushed the fix-incorrect-token-audience-error-when-using-configure-aws-credentials-github-action branch from cef0bfa to 36a4bdf Compare June 23, 2022 15:53
@rtyley
Copy link
Member Author

rtyley commented Jun 23, 2022

I think you'll need to update the test too.

Thanks - done with amended commit 36a4bdf!

@rtyley rtyley marked this pull request as ready for review June 23, 2022 15:54
@rtyley rtyley requested a review from a team as a code owner June 23, 2022 15:54
@akash1810
Copy link
Member

The check-aws-cdk check is failing, however I'm not sure it should block this (or other PRs). The intention of this check is to keep up to date with releases to AWS CDK, which historically received updates very frequently.

Dependabot is the typical solution here, but it wasn't quite working.

I've dropped the requirement to have this check pass, as we should think of ways to automate this.

@rtyley rtyley merged commit bc154ca into main Jun 23, 2022
@rtyley rtyley deleted the fix-incorrect-token-audience-error-when-using-configure-aws-credentials-github-action branch June 23, 2022 16:46
@github-actions
Copy link
Contributor

🎉 This PR is included in version 45.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants