Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

credentials static web identity credentials not picked up without an explicit profile option

未关闭
#3,241 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
aws, ruby

调研方向

从 gems/aws-sdk-core/lib/aws-sdk-core/credential_provider_chain.rb 和 gems/aws-sdk-core/lib/aws-sdk-core/plugins/credentials_configuration.rb 开始,然后检查 reproduction 中描述的共享配置行为。使用带有 web identity 配置的两个 Aws::SQS::Client.new 调用来验证当前的 STS 请求。当不指定显式 profile 时使用默认共享配置,并且重复创建的客户端不会分别单独刷新时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

feature-request needs-major-version
Describe the bug

We're using STS web identity token credentials to manage AWS SDK service call authentication via SigV4 (aws-sdk-core (3.211.0), should be the relevant bit). We noticed however, during load testing, some rate limiting happening, which we narrowed down to multiple calls to the STS token refresh endpoint, exacerbated by the scaling up of certain services. After some investigation, we figured out that multiple clients (for SQS, SNS, etc) were instantiated, and the token refresh path was called for each of them. This is not ideal, as there should be a single "refresh" happening, and the token should at best be shared across the multiple clients.

In the process, we found out that the AWS SDKs already support that via "shared config", and we proceeded to change our approach using it, replacing the env var setup using AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN with a AWS_CONFIG_FILE pointing to a file like this:

[default]
web_identity_token_file = $AWS_WEB_IDENTITY_TOKEN_FILE
role_arn = $AWS_ROLE_ARN
Expected Behavior

This should have worked, as in, when instantiating clients multiple times, there should only be one call to STS. This can be observed using this script:

Aws.config[:http_wire_trace] = true

Aws::SQS::Client.new
# one STS request log
Aws::SQS::Client.new
# no STS request log
Current Behavior

when instantiating two client instances, two STS requests are made.

While we noticed that Aws.shared_config was correctly filled up with the expected values, unfortunately calling i.e. Aws::SQS::Client.new was still going through this strategy and generating a token + refresh loop per client, because of this clause, i.e. the routine expects a profile to be set, however it's nil as per the option setup, although the docs say it's "default".

I believe this is a bug, as if "default", this would have worked. I also tried setting the AWS_PROFILE env var, but that doesn't fill it up either.

FWIW, setting Aws.config[:profile] = "default", or explicit option set a la Aws::SQS::Client.new(profile: "default"), work as expected (shared config is picked up). However, I'm looking for a "no config code" setup that can be rolled out across multiple services.

Reproduction Steps
Aws.config[:http_wire_trace] = true

Aws::SQS::Client.new
# one STS request log
Aws::SQS::Client.new
# no STS request log
Possible Solution

Perhaps initializing the profile option to whatever AWS_PROFILE defines?

Additional Information/Context

No response

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

aws-sdk-core 3.211.0

Environment details (Version of Ruby, OS environment)

"ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]"

主要语言
Ruby
星标
3.7k
派生
1.2k
平均合并
1 天 16 小时
30 天内合并 PR
25

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/aws-sdk-ruby 的其他 Issue

查看 aws/aws-sdk-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。