OIDC: Can't assume role containing "github"
bbergeron0 opened this issue · 5 comments
Describe the bug
Just like #953, OIDC seems to break down when the IAM role contains "GitHub." The runner couldn't assume the role of "github-action-deploy-to-staging" or "test-github-cicd," but assumed the role of "deploy-to-staging" without a hic, with the only difference between these roles being their name. After finding the aforementioned issue, I gave the solution a try and it worked.
Expected Behavior
I expect it to work even if the role contains "github".
Current Behavior
In GH action logs:
Assuming role with OIDC
Assuming role with OIDC
Assuming role with OIDC
...
Assuming role with OIDC
Error: Could not assume role with OIDC: Not authorized to perform sts:AssumeRoleWithWebIdentity
Reproduction Steps
As I said, the role must contains "github" to fail. Here's the failing step in question; (Also, permissions.id-token = write)
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::[redacted]:role/github-said-hi
role-session-name: samplerolesession
aws-region: ${{ env.AWS_REGION }}
Possible Solution
#954 suggested to "either highlighting this restricted role name in the documentation, or fixing the issue preventing use of this role name." I'd like to vote for the second option this time around ;)
Additional Information/Context
No response
Mine doesn't seem to work even without github
in the role name 😢
Github action: https://github.com/gyfchong/rumblr/blob/f66285185f64529004668a8d14878bcbac4d16a6/.github/workflows/deployment.yml#L28
Failed action:
https://github.com/gyfchong/rumblr/actions/runs/9625696385/job/26550841968#step:4:24