aws-sdk-core 3.233.0 → 3.234.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-core/assume_role_credentials.rb +8 -8
- data/lib/aws-sdk-core/assume_role_web_identity_credentials.rb +2 -2
- data/lib/aws-sdk-core/credential_provider_chain.rb +44 -22
- data/lib/aws-sdk-core/ecs_credentials.rb +13 -13
- data/lib/aws-sdk-core/plugins/checksum_algorithm.rb +28 -14
- data/lib/aws-sdk-core/refreshing_credentials.rb +8 -11
- data/lib/aws-sdk-core/sso_credentials.rb +1 -1
- data/lib/aws-sdk-sso/client.rb +1 -1
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-ssooidc/client.rb +1 -1
- data/lib/aws-sdk-ssooidc.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/aws-sdk-sts.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1e5a2e83ce7eed6192c024a73528481a7dc42684ad06ddede22f2fd4e30899
|
4
|
+
data.tar.gz: edf282bf751d428d5ef47c2784712b02e2cd6697068a0d31d2030a7eb994f6ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d497dfce0f982be21901e8273bb9ed40cdf87c291fa7f094f2a593890d4262dc1e3d51db8fd9a0eb5e65681fe6fad4b1bd30f84b4df1c5694d6f2f3f723ca46
|
7
|
+
data.tar.gz: '0739213884f5ae50f264cb0a8e94ed7b231397736936c28fa2ac46506f1b2b5204721d0433c8ade2586cb39e3e108c685876f5ff01ae13821f58b014e95d350b'
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
3.234.0 (2025-10-21)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Issue - Fix `request_checksum_calculation` `when_required` mode to only calculate checksums when explicitly provided by user.
|
8
|
+
|
9
|
+
* Feature - Add `CREDENTIALS_CODE` metric for `static_profile_` prefixed methods in default credential chain.
|
10
|
+
|
4
11
|
3.233.0 (2025-09-23)
|
5
12
|
------------------
|
6
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.234.0
|
@@ -7,7 +7,7 @@ module Aws
|
|
7
7
|
# {Aws::STS::Client#assume_role}.
|
8
8
|
#
|
9
9
|
# role_credentials = Aws::AssumeRoleCredentials.new(
|
10
|
-
# client: Aws::STS::Client.new(
|
10
|
+
# client: Aws::STS::Client.new(sts_options),
|
11
11
|
# role_arn: "linked::account::arn",
|
12
12
|
# role_session_name: "session-name"
|
13
13
|
# )
|
@@ -28,15 +28,15 @@ module Aws
|
|
28
28
|
# @option options [Integer] :duration_seconds
|
29
29
|
# @option options [String] :external_id
|
30
30
|
# @option options [STS::Client] :client
|
31
|
-
# @option options [
|
31
|
+
# @option options [Proc] :before_refresh A Proc called before
|
32
32
|
# credentials are refreshed. Useful for updating tokens.
|
33
|
-
#
|
34
|
-
# required and need to be refreshed.
|
35
|
-
# the following example:
|
33
|
+
# `:before_refresh` is called when AWS credentials are
|
34
|
+
# required and need to be refreshed. See the example in this doc.
|
36
35
|
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
36
|
+
# @example Tokens can be refreshed using a Proc.
|
37
|
+
# before_refresh = Proc.new do |assume_role_credentials|
|
38
|
+
# assume_role_credentials.assume_role_params['token_code'] = update_token
|
39
|
+
# end
|
40
40
|
#
|
41
41
|
def initialize(options = {})
|
42
42
|
client_opts = {}
|
@@ -9,11 +9,11 @@ module Aws
|
|
9
9
|
# {Aws::STS::Client#assume_role_with_web_identity}.
|
10
10
|
#
|
11
11
|
# role_credentials = Aws::AssumeRoleWebIdentityCredentials.new(
|
12
|
-
# client: Aws::STS::Client.new(
|
12
|
+
# client: Aws::STS::Client.new(sts_options),
|
13
13
|
# role_arn: "linked::account::arn",
|
14
14
|
# web_identity_token_file: "/path/to/token/file",
|
15
15
|
# role_session_name: "session-name"
|
16
|
-
# ...
|
16
|
+
# # ...
|
17
17
|
# )
|
18
18
|
# ec2 = Aws::EC2::Client.new(credentials: role_credentials)
|
19
19
|
#
|
@@ -11,7 +11,7 @@ module Aws
|
|
11
11
|
def resolve
|
12
12
|
providers.each do |method_name, options|
|
13
13
|
provider = send(method_name, options.merge(config: @config))
|
14
|
-
return provider if provider
|
14
|
+
return provider if provider&.set?
|
15
15
|
end
|
16
16
|
nil
|
17
17
|
end
|
@@ -54,47 +54,65 @@ module Aws
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def static_profile_assume_role_web_identity_credentials(options)
|
57
|
-
|
58
|
-
|
57
|
+
return unless Aws.shared_config.config_enabled? && options[:config]&.profile
|
58
|
+
|
59
|
+
with_metrics('CREDENTIALS_CODE') do
|
60
|
+
creds = Aws.shared_config.assume_role_web_identity_credentials_from_config(
|
59
61
|
profile: options[:config].profile,
|
60
62
|
region: options[:config].region
|
61
63
|
)
|
64
|
+
return unless creds
|
65
|
+
|
66
|
+
creds.metrics << 'CREDENTIALS_CODE'
|
67
|
+
creds
|
62
68
|
end
|
63
69
|
end
|
64
70
|
|
65
71
|
def static_profile_sso_credentials(options)
|
66
|
-
|
67
|
-
|
72
|
+
return unless Aws.shared_config.config_enabled? && options[:config]&.profile
|
73
|
+
|
74
|
+
with_metrics('CREDENTIALS_CODE') do
|
75
|
+
creds = Aws.shared_config.sso_credentials_from_config(
|
68
76
|
profile: options[:config].profile
|
69
77
|
)
|
78
|
+
return unless creds
|
79
|
+
|
80
|
+
creds.metrics << 'CREDENTIALS_CODE'
|
81
|
+
creds
|
70
82
|
end
|
71
83
|
end
|
72
84
|
|
73
85
|
def static_profile_assume_role_credentials(options)
|
74
|
-
|
75
|
-
|
86
|
+
return unless Aws.shared_config.config_enabled? && options[:config]&.profile
|
87
|
+
|
88
|
+
with_metrics('CREDENTIALS_CODE') do
|
89
|
+
creds = assume_role_with_profile(options, options[:config].profile)
|
90
|
+
return unless creds
|
91
|
+
|
92
|
+
creds.metrics << 'CREDENTIALS_CODE'
|
93
|
+
creds
|
76
94
|
end
|
77
95
|
end
|
78
96
|
|
79
97
|
def static_profile_credentials(options)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
98
|
+
return unless options[:config]&.profile
|
99
|
+
|
100
|
+
creds = SharedCredentials.new(profile_name: options[:config].profile)
|
101
|
+
creds.metrics << 'CREDENTIALS_PROFILE'
|
102
|
+
creds
|
85
103
|
rescue Errors::NoSuchProfileError
|
86
104
|
nil
|
87
105
|
end
|
88
106
|
|
89
107
|
def static_profile_process_credentials(options)
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
108
|
+
return unless Aws.shared_config.config_enabled? && options[:config]&.profile
|
109
|
+
|
110
|
+
process_provider = Aws.shared_config.credential_process(profile: options[:config].profile)
|
111
|
+
return unless process_provider
|
112
|
+
|
113
|
+
creds = ProcessCredentials.new([process_provider])
|
114
|
+
creds.metrics.concat(%w[CREDENTIALS_PROFILE_PROCESS CREDENTIALS_CODE])
|
115
|
+
creds
|
98
116
|
rescue Errors::NoSuchProfileError
|
99
117
|
nil
|
100
118
|
end
|
@@ -122,7 +140,7 @@ module Aws
|
|
122
140
|
end
|
123
141
|
|
124
142
|
def determine_profile_name(options)
|
125
|
-
(options[:config]
|
143
|
+
(options[:config]&.profile) || ENV['AWS_PROFILE'] || ENV['AWS_DEFAULT_PROFILE'] || 'default'
|
126
144
|
end
|
127
145
|
|
128
146
|
def shared_credentials(options)
|
@@ -201,10 +219,14 @@ module Aws
|
|
201
219
|
profile: profile_name,
|
202
220
|
chain_config: @config
|
203
221
|
}
|
204
|
-
if options[:config]
|
222
|
+
if options[:config]&.region
|
205
223
|
assume_opts[:region] = options[:config].region
|
206
224
|
end
|
207
225
|
Aws.shared_config.assume_role_credentials_from_config(assume_opts)
|
208
226
|
end
|
227
|
+
|
228
|
+
def with_metrics(metrics, &block)
|
229
|
+
Aws::Plugins::UserAgent.metric(*metrics, &block)
|
230
|
+
end
|
209
231
|
end
|
210
232
|
end
|
@@ -42,26 +42,26 @@ module Aws
|
|
42
42
|
# @option options [Integer] :retries (5) Number of times to retry
|
43
43
|
# when retrieving credentials.
|
44
44
|
# @option options [String] :ip_address ('169.254.170.2') This value is
|
45
|
-
# ignored if
|
46
|
-
# @option options [Integer] :port (80) This value is ignored if
|
47
|
-
# is set and
|
45
|
+
# ignored if `:endpoint` is set and `:credential_path` is not set.
|
46
|
+
# @option options [Integer] :port (80) This value is ignored if `:endpoint`
|
47
|
+
# is set and `:credential_path` is not set.
|
48
48
|
# @option options [String] :credential_path By default, the value of the
|
49
|
-
# AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable.
|
49
|
+
# `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` environment variable.
|
50
50
|
# @option options [String] :endpoint The container credential endpoint.
|
51
|
-
# By default, this is the value of the AWS_CONTAINER_CREDENTIALS_FULL_URI
|
52
|
-
# environment variable. This value is ignored if
|
53
|
-
# ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] is set.
|
51
|
+
# By default, this is the value of the `AWS_CONTAINER_CREDENTIALS_FULL_URI`
|
52
|
+
# environment variable. This value is ignored if `:credential_path` or
|
53
|
+
# `ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']` is set.
|
54
54
|
# @option options [Float] :http_open_timeout (5)
|
55
55
|
# @option options [Float] :http_read_timeout (5)
|
56
|
-
# @option options [
|
56
|
+
# @option options [IO] :http_debug_output (nil) HTTP wire
|
57
|
+
# traces are sent to this object. You can specify something
|
58
|
+
# like `$stdout`.
|
59
|
+
# @option options [Numeric, Proc] :backoff By default, failures are retried
|
57
60
|
# with exponential back-off, i.e. `sleep(1.2 ** num_failures)`. You can
|
58
61
|
# pass a number of seconds to sleep between failed attempts, or
|
59
62
|
# a Proc that accepts the number of failures.
|
60
|
-
# @option options [
|
61
|
-
#
|
62
|
-
# like $stdout.
|
63
|
-
# @option options [Callable] before_refresh Proc called before
|
64
|
-
# credentials are refreshed. `before_refresh` is called
|
63
|
+
# @option options [Proc] :before_refresh A Proc called before
|
64
|
+
# credentials are refreshed. `:before_refresh` is called
|
65
65
|
# with an instance of this object when
|
66
66
|
# AWS credentials are required and need to be refreshed.
|
67
67
|
def initialize(options = {})
|
@@ -190,7 +190,6 @@ module Aws
|
|
190
190
|
name: "x-amz-checksum-#{algorithm.downcase}",
|
191
191
|
request_algorithm_header: request_algorithm_header(context)
|
192
192
|
}
|
193
|
-
|
194
193
|
context[:http_checksum][:request_algorithm] = request_algorithm
|
195
194
|
calculate_request_checksum(context, request_algorithm)
|
196
195
|
end
|
@@ -249,6 +248,7 @@ module Aws
|
|
249
248
|
return unless context.operation.http_checksum
|
250
249
|
|
251
250
|
input_member = context.operation.http_checksum['requestAlgorithmMember']
|
251
|
+
|
252
252
|
context.params[input_member.to_sym] ||= DEFAULT_CHECKSUM if input_member
|
253
253
|
end
|
254
254
|
|
@@ -271,25 +271,39 @@ module Aws
|
|
271
271
|
context.operation.http_checksum['responseAlgorithms']
|
272
272
|
end
|
273
273
|
|
274
|
-
def checksum_required?(context)
|
275
|
-
(http_checksum = context.operation.http_checksum) &&
|
276
|
-
(checksum_required = http_checksum['requestChecksumRequired']) &&
|
277
|
-
(checksum_required && context.config.request_checksum_calculation == 'when_required')
|
278
|
-
end
|
279
|
-
|
280
|
-
def checksum_optional?(context)
|
281
|
-
context.operation.http_checksum &&
|
282
|
-
context.config.request_checksum_calculation != 'when_required'
|
283
|
-
end
|
284
|
-
|
285
274
|
def checksum_provided_as_header?(headers)
|
286
275
|
headers.any? { |k, _| k.start_with?('x-amz-checksum-') }
|
287
276
|
end
|
288
277
|
|
278
|
+
# Determines whether a request checksum should be calculated.
|
279
|
+
# 1. **No existing checksum in header**: Skips if checksum header already present
|
280
|
+
# 2. **Operation support**: Considers model, client configuration and user input.
|
289
281
|
def should_calculate_request_checksum?(context)
|
290
282
|
!checksum_provided_as_header?(context.http_request.headers) &&
|
291
|
-
|
292
|
-
|
283
|
+
checksum_applicable?(context)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Checks if checksum calculation should proceed based on operation requirements and client settings.
|
287
|
+
# Returns true when any of these conditions are met:
|
288
|
+
# 1. http checksum's requestChecksumRequired is true
|
289
|
+
# 2. Config for request_checksum_calculation is "when_supported"
|
290
|
+
# 3. Config for request_checksum_calculation is "when_required" AND user provided checksum algorithm
|
291
|
+
def checksum_applicable?(context)
|
292
|
+
http_checksum = context.operation.http_checksum
|
293
|
+
return false unless http_checksum
|
294
|
+
|
295
|
+
return true if http_checksum['requestChecksumRequired']
|
296
|
+
|
297
|
+
return false unless (algorithm_member = http_checksum['requestAlgorithmMember'])
|
298
|
+
|
299
|
+
case context.config.request_checksum_calculation
|
300
|
+
when 'when_supported'
|
301
|
+
true
|
302
|
+
when 'when_required'
|
303
|
+
!context.params[algorithm_member.to_sym].nil?
|
304
|
+
else
|
305
|
+
false
|
306
|
+
end
|
293
307
|
end
|
294
308
|
|
295
309
|
def choose_request_algorithm!(context)
|
@@ -1,28 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Aws
|
4
|
-
|
5
4
|
# Base class used credential classes that can be refreshed. This
|
6
5
|
# provides basic refresh logic in a thread-safe manner. Classes mixing in
|
7
|
-
# this module are expected to implement a
|
6
|
+
# this module are expected to implement a `#refresh` method that populates
|
8
7
|
# the following instance variables:
|
9
8
|
#
|
10
|
-
# * `@
|
11
|
-
# * `@
|
12
|
-
# * `@session_token`
|
13
|
-
# * `@expiration`
|
9
|
+
# * `@credentials` ({Credentials})
|
10
|
+
# * `@expiration` (Time)
|
14
11
|
#
|
15
|
-
# @api private
|
16
12
|
module RefreshingCredentials
|
17
|
-
|
18
13
|
SYNC_EXPIRATION_LENGTH = 300 # 5 minutes
|
19
14
|
ASYNC_EXPIRATION_LENGTH = 600 # 10 minutes
|
20
15
|
|
21
16
|
CLIENT_EXCLUDE_OPTIONS = Set.new([:before_refresh]).freeze
|
22
17
|
|
18
|
+
# @param [Hash] options
|
19
|
+
# @option options [Proc] :before_refresh A Proc called before credentials are refreshed.
|
20
|
+
# It accepts `self` as the only argument.
|
23
21
|
def initialize(options = {})
|
24
22
|
@mutex = Mutex.new
|
25
|
-
@before_refresh = options.delete(:before_refresh) if Hash
|
23
|
+
@before_refresh = options.delete(:before_refresh) if options.is_a?(Hash)
|
26
24
|
|
27
25
|
@before_refresh.call(self) if @before_refresh
|
28
26
|
refresh
|
@@ -59,7 +57,7 @@ module Aws
|
|
59
57
|
# Otherwise, if we're approaching expiration, use the existing credentials
|
60
58
|
# but attempt a refresh in the background.
|
61
59
|
def refresh_if_near_expiration!
|
62
|
-
#
|
60
|
+
# NOTE: This check is an optimization. Rather than acquire the mutex on every #refresh_if_near_expiration
|
63
61
|
# call, we check before doing so, and then we check within the mutex to avoid a race condition.
|
64
62
|
# See issue: https://github.com/aws/aws-sdk-ruby/issues/2641 for more info.
|
65
63
|
if near_expiration?(sync_expiration_length)
|
@@ -91,6 +89,5 @@ module Aws
|
|
91
89
|
true
|
92
90
|
end
|
93
91
|
end
|
94
|
-
|
95
92
|
end
|
96
93
|
end
|
@@ -7,7 +7,7 @@ module Aws
|
|
7
7
|
# {Aws::SSOTokenProvider} will be used to refresh the token if possible.
|
8
8
|
# This class does NOT implement the SSO login token flow - tokens
|
9
9
|
# must generated separately by running `aws login` from the
|
10
|
-
# AWS CLI with the correct profile. The
|
10
|
+
# AWS CLI with the correct profile. The {SSOCredentials} will
|
11
11
|
# auto-refresh the AWS credentials from SSO.
|
12
12
|
#
|
13
13
|
# # You must first run aws sso login --profile your-sso-profile
|
data/lib/aws-sdk-sso/client.rb
CHANGED
data/lib/aws-sdk-sso.rb
CHANGED
data/lib/aws-sdk-ssooidc.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
data/lib/aws-sdk-sts.rb
CHANGED