-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
The behavior of validateCredentialType is too strict and doesn't align with the AWS CLI or other SDKs #3763
Comments
Hey @benkehoe , |
In this specific case if you have both SSO configured & a credential_process configured for a profile, it hard fails instead of using one or the other based on provider chain precedence. This is fairly impactful, if other SDKs do not support natively pulling SSO credentials out of
hashicorp/terraform-provider-aws#17353 (comment) Also appears to point to a possible bug where if you use SSO configuration variables in any profile, it'll now fail if you are also using credential_process or assume_role in any other profile. |
I am not able to replicate this behavior that you are describing and we would need further details on the profile contents to reproduce this. If you have a configuration file you can provide us for this that would be helpful. With regards the broader ask of this issue, the AWS SDK for Go has always been restrictive regarding the specification of credentials within the shared configuration files. The SDK has always validated that one type of credential be allowed to be provided per profile, and the introduction of SSO maintained that existing behavior expectation.
By modeling a profile to contain multiple credential types in its definition there is a level of entropy introduced in what the expected outcome is, and relies on a consistent level of behavior that has known to differ between the products. From a pure administrative perspective on credentials, it would be better to be explicit about where / what credentials you expect your application to use, or how it will get those credentials. In example number two, this situation could prove catastrophic if a credential is later deactivated or a policy change is introduced because the credential was modeled in a way where it is not explicitly clear the expected outcome. |
@skmcgrail If you think it's problematic to be permissive with multiple credential configs in a single profile, the proper way to approach the problem is to go argue with the other SDK teams and come to a consensus, rather than waging a language-specific campaign that forces inconsistent behavior on customers (who often use more than one language, especially with Go as the CLI is in Python). You also don't raise an error if I specify the environment variables The expectation I have for credential loading is that there is a defined hierarchy, which is searched and as soon as valid credentials are found, no further searching occurs. |
This has propagated a bug to Terraform latest AWS provider, and hence our setup that used SSO AND |
If you're using aws-vault, a possible workaround (solution?) seems to be to split the profile into two: one with SSO credentials and one with
Still, we are operating a bunch of specialised AWS accounts and maintaining an AWS config with multiple profiles per account seems like a nightmare. While the point of ambiguous credentials is a fair one, the Golang SDK should be consistent with other AWS SDKs in this respect. |
@skmcgrail please see my comment here hashicorp/terraform-provider-aws#17353 (comment) for a vanilla config that reproduces the issue. |
I'm surprised a backwards incompatible change like this made it into a release, as AWS is generally well regarded for not breaking past promises. This has completely broken our terraform workflow where we use AWS SSO and aws-sso-util via credential_process. While the AWS SDK Go team mulls this over, is there a workaround that doesn't involve (1) pinning the aws provider version to be less than 3.26.0, (2) adding and maintaining double ~/.aws/config in all our developer and ci machines? |
Hi @skmcgrail, @KaibaLopez, I've done some more testing... previously If i remove credential_process from all profiles I then proceed to get the following: However, I've since updated my awscli version from 2.0.55 to 2.1.24, regenerated credentials and terraform now works after removing all credential_process lines from my config. I personally still think this log should remain open as a task to align across all SDK's, & to also update release notes & docs that AWS CLI v2.1.X (unsure which exactly) is a prerequisite for this feature. Cheers, |
@JoshiiSinfield Terraform is one of the things that broke. But still, this change breaks anything that used aws-go-sdk and its user is using SSO + Having |
Furthermore, building on the "the sdk should be a team player in the ecosystem" theme: we aren't working on a single project where you can update terraform/go-sdk, remove |
just came here to say this issue has impacted me and that between this issue, and #3324 you have made it impossible to upgrade our aws sdk version until they're both addressed. |
Our teams are also being impacted by this issue, primarily for terraform, but also with other Go-based utilities that we either develop or operate. I'm interested in having the issue resolved so that our teams can avoid jumping through hoops specifically when using go clients. Our teams either end up temporarily commenting/uncommenting the |
I am also hitting this issue when using my favorite Go-based tools. My existing config works with the aws cli and other non-Go SDK programs; with a profile that contains both a The offending line is: https://github.com/aws/aws-sdk-go/blob/master/aws/session/shared_config.go#L402
|
Further to my previous comment, I was short sighted (correctly reminded of this by @sherifabdlnaby ty...), and although terraform on it's own works, we have alot of terragrunt, which doesn't work, and now requires a duplicate separate profile for the remote state config that includes credential_process when running locally. So we're still impacted. It's a PITA. @KaibaLopez As this is assigned to yourself have you any updates? Can the tightening of validation be rolled back so that this SDK falls inline with the others?! Cheers, |
Thanks for the additional details and feedback. We are investigating how to solve this issue in the v1 and v2 AWS SDK for Go, as both SDK versions have the same behavior. The v1 SDK added the exclusive credential source check two years ago in #2667 in release v1.21.0. The addition of credentials providers since then (WebIdentityToken and SSO) have built on this behavior under the idea that it was invalid, and indeterminate which credential source would be used, if multiple where configured within a profile. This behavior has the benefit that misconfigured profiles, or clashing profiles with multiple credential sources can be detected instead of waiting for API request failures due to invalid signatures errors. Or even worse, unexpected AWS resource mutation due to an unexpected account or role was used from a competing credential source in the shared config profile. With all of that said, we're investigating what SDK behavior change should be made. If the exclusive credential source check is removed, applications with invalid shared config profile credential sources that failed to load would no longer fail, and would have unexpected behavior using the competing credential sources. While we're investigating this issue, using shared config profiles with only a single credential source configured is the best workaround. |
This sounds like an attempt to protect people without having a --this-is-dangerous flag. It also makes the invalid assumption that having multiple credential providers is invalid. Why is the Go SDK making decisions around how the SDK works independent of the way that the canonical (boto) SDK works? |
|
=== ### Service Client Updates * `service/apprunner`: Updates service API, documentation, paginators, and examples * `service/compute-optimizer`: Updates service API and documentation * `service/iotsitewise`: Updates service documentation * `service/license-manager`: Updates service API and documentation * `service/models.lex.v2`: Updates service API, documentation, and paginators * `service/personalize`: Updates service API and documentation * `service/support`: Updates service documentation * Documentation updates for support ### SDK Enhancements * `aws/session`: Enable SSO provider to be mixed with other credential providers ([#3905](#3905)) * Fixes [#3763](#3763)
Release v1.38.42 (2021-05-18) === ### Service Client Updates * `service/apprunner`: Updates service API, documentation, paginators, and examples * `service/compute-optimizer`: Updates service API and documentation * `service/iotsitewise`: Updates service documentation * `service/license-manager`: Updates service API and documentation * `service/models.lex.v2`: Updates service API, documentation, and paginators * `service/personalize`: Updates service API and documentation * `service/support`: Updates service documentation * Documentation updates for support ### SDK Enhancements * `aws/session`: Enable SSO provider to be mixed with other credential providers ([#3905](#3905)) * Fixes [#3763](#3763)
I want to get the fix for aws/aws-sdk-go#3763 which is in 1.38.42 so I can use an aws profile that has both sso and `credential_process` configuration in a single profile
I want to get the fix for aws/aws-sdk-go#3763 which is in 1.38.42 so I can use an aws profile that has both sso and `credential_process` configuration in a single profile Signed-off-by: Ben Dean <ben.dean@ontariosystems.com>
Describe the bug
validateCredentialType()
does not allow more than one credential provider configuration in a profile. This does not align with the AWS CLI and other SDKs, which have a hierarchy of credential providers and do not continue to check against providers later in the chain if one is satisfied.This is an issue because not all AWS SDKs support AWS SSO configuration, so being able to provide a credential process backup (using a tool like
aws-sso-util
) allows one profile to work both with SDKs that support AWS SSO and those that don't, transparently (because the SSO provider is higher up in the chain).Version of AWS SDK for Go?
v1.37
To Reproduce (observed behavior)
Create a profile in
~/.aws/config
that looks likeExpected behavior
When using the Go SDK with
my-profile
, the AWS SSO configuration should be used and no error should occur.Supposing
aws-sso-util
is installed:When using the appropriate version of the AWS CLI v2, boto3, or Go SDK, the AWS SSO configuration should be used and no error should occur.
When using the JavaScript SDK for Node, or an older version of AWS CLI v1, boto3 or the Go SDK, the AWS SSO configuration will not be recognized, and the credential process will be used, which supports getting AWS SSO credentials using the profile's configuration.
The text was updated successfully, but these errors were encountered: