credentials static web identity credentials not picked up without an explicit profile option
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- aws, ruby
- 領域
- authentication, cloud
調査の方向性
gems/aws-sdk-core/lib/aws-sdk-core/credential_provider_chain.rb と gems/aws-sdk-core/lib/aws-sdk-core/plugins/credentials_configuration.rb から始め、その後、再現手順で説明されている共有設定の動作を確認します。Web Identity 設定を使用した 2 つの Aws::SQS::Client.new 呼び出しで、現在の STS リクエストを検証します。明示的なプロファイルなしでデフォルトの共有設定が使用され、繰り返し作成したクライアントがそれぞれ個別にリフレッシュしなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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時間
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/aws-sdk-ruby のほかの issue
-
service-api
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
aws/aws-sdk-ruby#3395 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
BedrockAgentCore: invoke_agent_runtime buffers entire response instead of streaming in real-timeオープンdocumentation p3 queued
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
aws/aws-sdk-ruby#3348 · コメント 6 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
investigating service-api
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
aws/aws-sdk-ruby#3217 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
service-api
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
aws/aws-sdk-ruby#3191 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
aws/aws-sdk-ruby#3190 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
aws/aws-sdk-ruby の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
wolfi-dev/os#78773 · リアクション 2 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
TheOdinProject/curriculum#31487 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信