configure-aws-credentials: Could not load credentials from any providers
I have already checked related issues #202 #188 , but in my case I am not using Dependabot.
This is my pipeline.yaml
truncated till this action:
name: My Deployment
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ap-southeast-1
role-to-assume:arn:aws:iam::000000000000:role/github-actions-matteogioioso-saml-proxy
role-session-name: GitHubActions
....
This is my trust relationship for that role:
{
"Version": "2008-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::000000000:oidc-provider/vstoken.actions.githubusercontent.com"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringLike": {
"vstoken.actions.githubusercontent.com:sub": "repo:MatteoGioioso/saml-proxy:*"
}
}
}
]
}
This is my OICD provider setup in IAM
And this is the error:
Run aws-actions/configure-aws-credentials@v1
with:
aws-region: ap-southeast-1
role-to-assume: arn:aws:iam::000000000000:role/github-actions-matteogioioso-saml-proxy
role-session-name: GitHubActions
Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers
I am not using a self-hosted runner
What am I doing wrong? Maybe the audience?
Thanks
UPDATE:
it seems like this method return false, because you do not validate credentials in the assumeRole
method:
const useGitHubOIDCProvider = () => {
// The assumption here is that self-hosted runners won't be populating the `ACTIONS_ID_TOKEN_REQUEST_TOKEN`
// environment variable and they won't be providing a web idenity token file or access key either.
// V2 of the action might relax this a bit and create an explicit precedence for these so that customers
// can provide as much info as they want and we will follow the established credential loading precedence.
return roleToAssume && process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN && !accessKeyId && !webIdentityTokenFile
}
honestly I cannot find a way to echo this variable ACTIONS_ID_TOKEN_REQUEST_TOKEN
UPDATE 2:
ok, this variable ACTIONS_ID_TOKEN_REQUEST_TOKEN
is not set, I am not sure why is not there and also I cannot find much information about it.
I am willing to submit a PR if needed.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 19
- Comments: 66 (8 by maintainers)
Commits related to this issue
- fixes as per https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to askulkarni2/cdk-gh-aws-oidc-connect by askulkarni2 3 years ago
- Testing to see if aws-actions/configure-aws-credentials/issues/271 has been resolved by pinning to v1 release — committed to arbitraryrw/cdk-github-actions-demo by arbitraryrw 3 years ago
- Removing issue comment from pipeline now that aws-actions/configure-aws-credentials/issues/271 has been resolved — committed to arbitraryrw/cdk-github-actions-demo by arbitraryrw 3 years ago
- v1 -> master https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to YAPP-19th/Web-Team-1-Backend by ayoung0073 3 years ago
- https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-1007938887 — committed to kaihendry/go-web-dynamo-starter by kaihendry 2 years ago
- With thanks to https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-1012450577 — committed to kaihendry/go-web-dynamo-starter by kaihendry 2 years ago
- fix: add undocumented permission (https://github.com/aws-actions/configure-aws-credentials/issues/271) — committed to a-h/arm-test by a-h 2 years ago
- Added permissions on deploy job to fix error. Reference: https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to jklmjklmjklmjklm/opa-lambda-authorizer by deleted user 2 years ago
- add permissions from issue 271 https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to stark-tech-space/eccms by skylinezum 2 years ago
- fix external party PR GH Actions workflow Our GitHub action aws-actions/configure-aws-credentials is failing when 3rd parties PR. Known issue: https://github.com/aws-actions/configure-aws-credent... — committed to awslabs/amazon-qldb-driver-nodejs by bwinchester 2 years ago
- Add permissions As suggested here: https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-931012696 — committed to cardstack/boxel by backspace a year ago
- AST-22341 Add permissions to workflow https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to Checkmarx/ast-cli by diogopcx a year ago
- fix(credential issure): commit [issue](https://github.com/aws-actions/configure-aws-credentials/issues/271) — committed to 42projectPeople/backend by koreanddinghwan a year ago
- Update publish-docs.yml add the missing permission: https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-931012696 — committed to noqdev/iambic by smoy a year ago
- add permissions section https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to osiris43/reunion by brett-bim a year ago
- Add required token permissions https://github.com/VerticalRelevance/cabana/issues/7 Looks like this permissions object is required. https://github.com/aws-actions/configure-aws-credentials/issues/2... — committed to VerticalRelevance/cabana by douglasnaphas a year ago
- tweak action based on https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to zr3/rust-roguelike by zr3 6 months ago
- AST-22341 Add permissions to workflow https://github.com/aws-actions/configure-aws-credentials/issues/271 — committed to thtri/ast-cli by diogopcx a year ago
so i think there is an undocumented permissions thing you need to use in your workflow to get it
try that
seems to be true about defining the permissions for the configuration step.
if you follow https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services it will help
I was having the same issue after pushing 20 commits to try different things it worked š
The steps:
@richardhboyd ok, I saw your last commit yesterday so I have tried using
aws-actions/configure-aws-credentials@master
,sigstore
as audience and add the permissions suggested by @androidwiltron and it is working.I think we should implement the (2)
EDIT: minor correction in the permissions since I am using semantic-release:
GitHub have now formally released OpenID Connect
So it would be good to have a new release version now, saves having to use @master or @shaXYZ.
If anyone needs it I wrote up a blog post on how to get it all working.
https://blog.tedivm.com/guides/2021/10/github-actions-push-to-aws-ecr-without-credentials-oidc/
I just got it running by having your setup, using
aws-actions/configure-aws-credentials@b8c74de
instead of v1/master and by addingsigstore
to the list of audiences.Iāve been able to reproduce this. Iām working with the GitHub team to root cause it. Our plan was to use the audience
sts.amazonaws.com
since that indicates who you intend to hand the JWT to. It appears that the ability to set an arbitrary audience hasnāt reached everywhere yet. Iām suggesting that we:(1) roll this repo back to the version where the audience was hardcoded with
sigstore
for now(2) I document in the repoās readme the additional permissions that are needed
(3) I add a note to teh readme that this feature is still undergoing changes by GitHub
Thoughts?
One thing that is not obvious that I will leave here for anyone googling to resolve their problem is that job permissions do not individually overwrite workflow permissions, the new permissions block replaces the old permissions block. They are not merged.
This means that in this configuration:
The
build
job will not haveid-token: write
norcontents: read
as the effective permissions block for the job only grantspull-requests: write
.Personally I think that this perhaps might be a confusing design choice and that the job permissions should be deep merged into the workflow permissions, but this is how it works at the moment.
If your jobs have their own permissions applied, make sure to repeat id-token and contents.
I solved the problem by doing the following. Thank you.
https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-931012696 https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-931272443
I blogged in Japanese.
https://dev.classmethod.jp/articles/github-actions-configure-aws-credentials-oidc/
I donāt think a new release has been made since Jul 19 while OICD changes where merged two days ago. https://github.com/aws-actions/configure-aws-credentials/commit/b8c74de753fbcb4868bf2011fb2e15826ce973af
What happens if you change the version to master?
uses: aws-actions/configure-aws-credentials@v1
->uses: aws-actions/configure-aws-credentials@master
Iām experiencing the exact same error too.
Saved my day. Thanks manā¦
When will this feature be released (as it is implemented now on
master
branch)? Are you waiting for github to go GA with their workload OIDC?Hi followed all the instructions provided by GitHub and in this thread by Iām still unable to load credentials.
Action YAML
Provider configuration:
IAM Role trust configuration:
What am I doing wrong?
EDIT: the pipeline is failing on PR from an external fork
thank you so much @idelfonsog2, that fixed my issue, I was using the wrong role in my configuration step of my yaml!
@ohad-griiip the issues is because of the AWS provider configuration. Make sure you have this at the audience:
sts.amazonaws.com
IAM > Identity providers > Github_provider > Audiences > Add audience > sts.amazonaws.com
Hi guys,
Still getting this error, my trust relationship:
And my github action:
And the identity provider audiences is:
Getting the error:
Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers
EDIT: Never mind - I got it working using
aws-actions/configure-aws-credentials@master
@androidwiltron re: āso i think there is an undocumented permissions thing you need to use in your workflow to get itā
itās documented here https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services#updating-your-github-actions-workflow
Thank you ! that fixed it, and then Iām onto https://github.com/aws-actions/configure-aws-credentials/issues/357 haha
It looks like this was just released yesterday in v1.6.0: https://github.com/aws-actions/configure-aws-credentials/blob/v1.6.0/CHANGELOG.md#160-2021-11-23
@ahawkins change
client_id_list = [ "sigstore" ]
=> to =>client_id_list = [ "sts.amazonaws.com" ]
a codecommit repository? the ecr-public registries are reachable from any region but you have to use the us-east-1 endpoint to retrieve your token to authenticate.
https://stackoverflow.com/questions/69274998/could-not-connect-to-the-endpoint-url-https-api-ecr-public-xxxxxxxxx-amazona
Was getting this error until I set the environment value to match the Github environment that had all the secrets
I encountered the same issue, but @androidwiltron 's suggestion resolved it. Thanks. https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-931012696
@kaihendry A lack of this may be the cause.
https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-931012696
Here is the official announcement: https://github.blog/2021-11-23-secure-deployments-openid-connect-github-actions-generally-available/
Yep great itās working š thanks a lot @tedivm !
@bryantbiggs Thank you! ā¤ļø That fixed it. Probably a good thing to call out in the docs related to #284 in a migration from v2 to v3.
Seems there are more issues with
master
. Iām using a token like:And an IAM provider like:
This was working a few days ago. Now it errors with
Incorrect token audience
.Has something changed in Github Actions itself?
EDIT: Fixed with https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-947983135
Thanks a ton, @dyoshikawa You blog saves my day.
@chris3ware Just checked and the web editor does this to mine as well which works - GitHub just hasnāt updated their validation in the editor it looks like.
ecr-public is only available in us-east-1