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 get aws creds from environment #3617

Merged
merged 2 commits into from
Nov 28, 2024
Merged

Conversation

famarting
Copy link
Contributor

Description

fixes a bug introduced here https://github.com/dapr/components-contrib/pull/3591/files#diff-017233cbc5865ed02ab3eacc4bc99b36ced96fcaf3420176e41d414444e41bc9

previously it was possible to get an aws session without providing access key and secret key, and we would pick the credentials from the environment. But since that PR, specifically because of this

func newStaticIAM(_ context.Context, opts Options, cfg *aws.Config) (*StaticAuth, error) {
	auth := &StaticAuth{
		logger:        opts.Logger,
		region:        &opts.Region,
		endpoint:      &opts.Endpoint,
		accessKey:     &opts.AccessKey,
		secretKey:     &opts.SecretKey,
		sessionToken:  &opts.SessionToken,
		assumeRoleARN: &opts.AssumeRoleARN,
		sessionName:   &opts.SessionName,

and the later check

if a.accessKey != nil && a.secretKey != nil {
		// session token is an option field
		awsConfig = awsConfig.WithCredentials(credentials.NewStaticCredentials(*a.accessKey, *a.secretKey, *a.sessionToken))
	}

that would always think that access key and secret key are available, despite of them having a value or not

this can cause this error from aws

EmptyStaticCreds: static credentials are empty 0xc0003f8600

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

Signed-off-by: Fabian Martinez <[email protected]>
@famarting famarting requested review from a team as code owners November 28, 2024 12:57
elena-kolevska
elena-kolevska previously approved these changes Nov 28, 2024
Signed-off-by: Fabian Martinez <[email protected]>
@famarting
Copy link
Contributor Author

ready again @elena-kolevska

@yaron2 yaron2 merged commit 1e095ed into dapr:main Nov 28, 2024
90 checks passed
@famarting famarting deleted the fix-aws-creds-from-env branch November 28, 2024 15:58
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

Successfully merging this pull request may close these issues.

4 participants