Skip to content

Commit adfbba0

Browse files
authored
[Credential Chain] fix default STS client credential sourcing i… (aws#2093)
* fix default client credential sourcing * update min core version
1 parent 0fb715a commit adfbba0

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

build_tools/services.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ServiceEnumerator
88
MANIFEST_PATH = File.expand_path('../../services.json', __FILE__)
99

1010
# Minimum `aws-sdk-core` version for new gem builds
11-
MINIMUM_CORE_VERSION = "3.58.0"
11+
MINIMUM_CORE_VERSION = "3.61.1"
1212
EVENTSTREAM_PLUGIN = "Aws::Plugins::EventStreamConfiguration"
1313

1414
# @option options [String] :manifest_path (MANIFEST_PATH)

gems/aws-sdk-core/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Fix default STS Client credential sourcing in Aws::AssumeRoleWebIdentityCredentialsProvider
5+
46
3.61.0 (2019-07-24)
57
------------------
68

gems/aws-sdk-core/lib/aws-sdk-core/assume_role_web_identity_credentials.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def initialize(options = {})
5252
# not provided, generate encoded UUID as session name
5353
@assume_role_web_identity_params[:role_session_name] = _session_name
5454
end
55-
@client = client_opts[:client] || STS::Client.new(client_opts)
55+
@client = client_opts[:client] || STS::Client.new(client_opts.merge(credentials: false))
5656
super
5757
end
5858

gems/aws-sdk-core/lib/aws-sdk-core/credential_provider_chain.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def assume_role_credentials(options)
100100
end
101101

102102
def assume_role_web_identity_credentials(options)
103-
if role_arn = ENV['AWS_ROLE_ARN'] &&
104-
token_file = ENV['AWS_WEB_IDENTITY_TOKEN_FILE']
103+
if (role_arn = ENV['AWS_ROLE_ARN']) &&
104+
(token_file = ENV['AWS_WEB_IDENTITY_TOKEN_FILE'])
105105
AssumeRoleWebIdentityCredentials.new(
106106
role_arn: role_arn,
107107
web_identity_token_file: token_file,

gems/aws-sdk-core/spec/aws/assume_role_web_identity_credentials_spec.rb

+5-4
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,17 @@ module Aws
107107
end
108108

109109
it 'accepts client options' do
110-
client = STS::Client.new(stub_responses: true)
110+
expected_client = STS::Client.new(
111+
credentials: false, stub_responses: true)
111112
expect(STS::Client).to receive(:new).
112-
with(region: 'region-name').
113-
and_return(client)
113+
with(region: 'region-name', credentials: false).
114+
and_return(expected_client)
114115
creds = AssumeRoleWebIdentityCredentials.new(
115116
region: 'region-name',
116117
role_arn: 'arn',
117118
web_identity_token_file: token_file_path,
118119
)
119-
expect(creds.client).to be(client)
120+
expect(creds.client).to be(expected_client)
120121
end
121122

122123
it 'assumes role with web identity using the client' do

0 commit comments

Comments
 (0)