Skip to content

Commit

Permalink
Do not warn using process credentials in shared config (#3062)
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Jul 3, 2024
1 parent 5d3d278 commit 6f4c71d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 2 additions & 0 deletions gems/aws-sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Fix `Aws::ProcessCredentials` warning in cases where shared config is used.

3.201.0 (2024-07-02)
------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def static_profile_credentials(options)
def static_profile_process_credentials(options)
if Aws.shared_config.config_enabled? && options[:config] && options[:config].profile
process_provider = Aws.shared_config.credential_process(profile: options[:config].profile)
ProcessCredentials.new(process_provider) if process_provider
ProcessCredentials.new([process_provider]) if process_provider
end
rescue Errors::NoSuchProfileError
nil
Expand Down Expand Up @@ -117,9 +117,9 @@ def shared_credentials(options)

def process_credentials(options)
profile_name = determine_profile_name(options)
if Aws.shared_config.config_enabled? &&
(process_provider = Aws.shared_config.credential_process(profile: profile_name))
ProcessCredentials.new(process_provider)
if Aws.shared_config.config_enabled?
process_provider = Aws.shared_config.credential_process(profile: profile_name)
ProcessCredentials.new([process_provider]) if process_provider
end
rescue Errors::NoSuchProfileError
nil
Expand Down
2 changes: 1 addition & 1 deletion gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def assume_role_process_credentials_from_config(profile)
if @parsed_config
credential_process ||= @parsed_config.fetch(profile, {})['credential_process']
end
ProcessCredentials.new(credential_process) if credential_process
ProcessCredentials.new([credential_process]) if credential_process
end

def credentials_from_shared(profile, _opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

module Aws
describe 'Credential Resolution Chain' do
before(:each) do
allow_any_instance_of(ProcessCredentials).to receive(:warn)
end

let(:mock_credential_file) do
File.expand_path(
File.join(
Expand Down Expand Up @@ -35,6 +31,8 @@ module Aws

before(:each) do
allow(InstanceProfileCredentials).to receive(:new).and_return(mock_instance_creds)

expect_any_instance_of(ProcessCredentials).not_to receive(:warn)
end

describe 'default behavior' do
Expand Down

0 comments on commit 6f4c71d

Please sign in to comment.