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

IRSA credentials preferred over explicit STS session in environment variables #45

Open
md5 opened this issue Sep 14, 2022 · 0 comments
Open

Comments

@md5
Copy link

md5 commented Sep 14, 2022

Describe the bug
When both AWS_ROLE_ARN/AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN are set, this library is preferring the former. This causes Vault 1.4.0+ to ignore an explicitly set access key in the environment in favor of IRSA. This seems like a bug to me. If someone has gone to the trouble of exporting the access key and session token variables from an STS session, it doesn't make sense to request new credentials with IRSA. Presumably if a user has done this, they have already used the IRSA-based credentials to call sts:AssumeRole.

To Reproduce
Steps to reproduce the behavior:

  1. In a Kubernetes pod with IRSA enabled, run aws sts assume-role to assume an STS role in another account
  2. Export the access key ID, secret, and session token as AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN
  3. Run vault login -method=aws role=some-vault-role
  4. Receive error looking up full ARN of entity error

Having this be a cross-account scenario is key to getting the error looking up full ARN of entity error specifically, but if it isn't a cross-account role you would likely just get a failed login when the role ARN from IRSA does not match the bound ARN wildcards.

Expected behavior
When AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set in the environment (and optionally AWS_SESSION_TOKEN), awsutil should ignore AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE. This is how aws sts get-caller-identity works, for example.

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

No branches or pull requests

1 participant