aws-sdk-core 3.263.0 → 3.264.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e12759793414117f403e7057cb739735502fdb49b051ff038d55c745852b593
4
- data.tar.gz: d39be33db7594287f3eba7dab5dee03a0cbd0742189a7808d70b496703754c0c
3
+ metadata.gz: 0c0e562777b1e5fdc50edc2441fb40908175d08e94fdc0f74bf2d615a1b3586d
4
+ data.tar.gz: 42ae671ab8a8384b8a254258a9706297f29035cb97d039f6e69d37ca2a078a99
5
5
  SHA512:
6
- metadata.gz: 50573d7d9dd51663613b353a63fd648f8e481d43ea6c04d8831fa79830e8372aca0f26f69dd62f129a5e7acb6e64aae747a62a844c3be85b649754cd70e9c053
7
- data.tar.gz: 4ff98b02a41384117b0c6beb0d231e6b5151a3c54c01dda97482e79d26d4ab1ce4322519b4b64e4ee9522ebf9ce424a661ae7d944da1f9da67fd24e1540047ec
6
+ metadata.gz: 9a0c773c066180a85a9e1a4d1a05cfe0ef5f7d04244719e3e1daa7887ac36177c30bf00bca21b74946a7ef4db5e3d7fea8a4185a4723c26beee9df76de351ac6
7
+ data.tar.gz: 0e3b4e4f29d1b814c35842e62f2b812984f3ce4454e27e074cd63f38aefc713355dd35659ff6336b30b5ce7daaf7d81be157c9b6e3117ece4c92d4c8e492f79c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.264.0 (2026-11-04)
5
+ ------------------
6
+
7
+ * Feature - Support refreshing login credentials in the cached sign-in region, falling back to the configured region when missing or empty.
8
+
9
+ * Issue - Fix clock skew correction for long-running requests and slow response downloads by using the time response headers are received.
10
+
4
11
  3.263.0 (2026-10-29)
5
12
  ------------------
6
13
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.263.0
1
+ 3.264.0
@@ -12,7 +12,9 @@ module Aws
12
12
  # ec2 = Aws::EC2::Client.new(credentials: login_credentials)
13
13
  #
14
14
  # If you omit the `:client` option, a new {Aws::Signin::Client} object will
15
- # be constructed with additional options that were provided.
15
+ # be constructed with additional options that were provided. When the cached
16
+ # token records a different `signInRegion`, a client for that region is
17
+ # constructed the same way and used to refresh.
16
18
  class LoginCredentials
17
19
  include CredentialProvider
18
20
  include RefreshingCredentials
@@ -23,22 +25,26 @@ module Aws
23
25
  # PowerShell automatically.
24
26
  #
25
27
  # @option options [Signin::Client] :client Optional `Signin::Client`.
26
- # If not provided, a client will be constructed.
28
+ # If not provided, a client will be constructed. A provided client is
29
+ # used for every refresh, so it must be configured for the region the
30
+ # login token was issued in.
27
31
  def initialize(options = {})
28
32
  raise ArgumentError, 'Missing login_session' unless options[:login_session]
29
33
 
30
34
  @login_session = options.delete(:login_session)
31
35
  @client = options[:client]
32
36
  unless @client
33
- client_opts = options.reject { |key, _| CLIENT_EXCLUDE_OPTIONS.include?(key) }
34
- @client = Signin::Client.new(client_opts.merge(credentials: nil))
37
+ @client_opts = options.reject { |key, _| CLIENT_EXCLUDE_OPTIONS.include?(key) }.merge(credentials: nil)
38
+ @client = Signin::Client.new(@client_opts)
35
39
  end
36
40
  @metrics = ['CREDENTIALS_LOGIN']
37
41
  @async_refresh = true
38
42
  super
39
43
  end
40
44
 
41
- # @return [Signin::Client]
45
+ # @return [Signin::Client] The client built from the given options. A refresh
46
+ # uses a client for another region when the cached token records a different
47
+ # `signInRegion`.
42
48
  attr_reader :client
43
49
 
44
50
  private
@@ -138,7 +144,7 @@ module Aws
138
144
  refresh_token: token_json['refreshToken']
139
145
  }
140
146
  }
141
- req = @client.build_request(:create_o_auth_2_token, options)
147
+ req = signin_client(token_json['signInRegion']).build_request(:create_o_auth_2_token, options)
142
148
  endpoint_params = Aws::Signin::EndpointParameters.create(req.context.config)
143
149
  endpoint = req.context.config.endpoint_provider.resolve_endpoint(endpoint_params)
144
150
  endpoint = URI.join(endpoint.url, @client.config.api.operation(:create_o_auth_2_token).http_request_uri).to_s
@@ -146,6 +152,15 @@ module Aws
146
152
  req.send_request
147
153
  end
148
154
 
155
+ # Refresh tokens can only be redeemed in the region they were issued in,
156
+ # which the login tool records in the cached token as `signInRegion`.
157
+ def signin_client(signin_region)
158
+ return @client if @client_opts.nil? || signin_region.to_s.empty? || signin_region == @client.config.region
159
+
160
+ @signin_region_clients ||= {}
161
+ @signin_region_clients[signin_region] ||= Signin::Client.new(@client_opts.merge(region: signin_region))
162
+ end
163
+
149
164
  def dpop_proof(dpop_key, endpoint)
150
165
  # Load private key from cached token file
151
166
  private_key = OpenSSL::PKey.read(dpop_key)
@@ -39,7 +39,7 @@ module Aws
39
39
 
40
40
  # Whether a response indicates skew large enough to warrant a retry; records nothing.
41
41
  # @param context [Seahorse::Client::RequestContext]
42
- # @param sent_at [Time, nil] raw (pre-skew) send time, for the midpoint calculation
42
+ # @param sent_at [Time, nil] raw (pre-skew) send time, to discard slow requests
43
43
  def clock_skewed?(context, sent_at = nil)
44
44
  candidate = candidate_skew(context, sent_at)
45
45
  !!candidate && candidate.abs > CLOCK_SKEW_THRESHOLD
@@ -47,7 +47,7 @@ module Aws
47
47
 
48
48
  # Called on every response; records the skew candidate when one can be computed.
49
49
  # @param context [Seahorse::Client::RequestContext]
50
- # @param sent_at [Time, nil] raw (pre-skew) send time, for the midpoint calculation
50
+ # @param sent_at [Time, nil] raw (pre-skew) send time, to discard slow requests
51
51
  def update_clock_correction(context, sent_at = nil)
52
52
  candidate = candidate_skew(context, sent_at)
53
53
  return if candidate.nil?
@@ -74,23 +74,22 @@ module Aws
74
74
  private
75
75
 
76
76
  # Single source of truth for skew computation; returns a Float skew or nil.
77
+ # The candidate is the server Date minus the time the response headers were
78
+ # received (the current time if that was not recorded).
77
79
  # @param context [Seahorse::Client::RequestContext]
78
- # @param sent_at [Time, nil] raw (pre-skew) send time; midpoint when present, else server - now
80
+ # @param sent_at [Time, nil] raw (pre-skew) send time; used only to discard slow requests
79
81
  # @return [Float, nil]
80
82
  def candidate_skew(context, sent_at = nil)
81
83
  response = context.http_response
82
84
  server_time = server_time(response)
83
85
  # No candidate if the Date header is absent/unparseable or the response was cached.
84
86
  return nil if server_time.nil? || response.headers['age']
85
- return server_time - Time.now.utc unless sent_at
86
87
 
87
- received_at = Time.now.utc
88
- elapsed = received_at - sent_at
88
+ received_at = context.metadata[:response_received_at] || Time.now.utc
89
89
  # Discard if the request was too slow for the measurement to be trusted.
90
- return nil if elapsed > MAX_TRUSTED_REQUEST_DURATION
90
+ return nil if sent_at && received_at - sent_at > MAX_TRUSTED_REQUEST_DURATION
91
91
 
92
- # Midpoint formula (NTP clock offset, RFC 5905 section 8).
93
- server_time - (sent_at + (elapsed / 2.0))
92
+ server_time - received_at
94
93
  end
95
94
 
96
95
  ##
@@ -177,6 +177,16 @@ module Aws
177
177
  DYNAMODB_SERVICES = Set['DynamoDB', 'DynamoDB Streams'].freeze
178
178
 
179
179
  class << self
180
+ # @api private
181
+ # HTTP retries preserve the listener, so register it only once.
182
+ def track_response_time(context)
183
+ return unless context.retries.zero?
184
+
185
+ context.http_response.on_headers do
186
+ context.metadata[:response_received_at] = Time.now.utc
187
+ end
188
+ end
189
+
180
190
  # TODO: Remove this gate and hardcode new retry behavior once
181
191
  # AWS_NEW_RETRIES_2026 is enabled by default, which includes:
182
192
  # - Default retry_mode to 'standard'
@@ -294,6 +304,7 @@ module Aws
294
304
  def call(context)
295
305
  context.metadata[:retries] ||= {}
296
306
  config = context.config
307
+ RetryErrors.track_response_time(context)
297
308
 
298
309
  get_send_token(config)
299
310
  add_retry_headers(context)
@@ -451,6 +462,7 @@ module Aws
451
462
  context.config.credentials.refresh! if refresh_credentials?(context, error)
452
463
  context.http_request.body.rewind
453
464
  context.http_response.reset
465
+ context.metadata.delete(:response_received_at)
454
466
  call(context)
455
467
  end
456
468
 
@@ -492,6 +504,7 @@ module Aws
492
504
  class LegacyHandler < Seahorse::Client::Handler
493
505
 
494
506
  def call(context)
507
+ RetryErrors.track_response_time(context)
495
508
  response = with_metric { @handler.call(context) }
496
509
  if response.error
497
510
  error_inspector = Retries::ErrorInspector.new(
@@ -530,6 +543,7 @@ module Aws
530
543
  context.config.credentials.refresh! if refresh_credentials?(context, error)
531
544
  context.http_request.body.rewind
532
545
  context.http_response.reset
546
+ context.metadata.delete(:response_received_at)
533
547
  call(context)
534
548
  end
535
549
 
@@ -991,7 +991,7 @@ module Aws::Signin
991
991
  tracer: tracer
992
992
  )
993
993
  context[:gem_name] = 'aws-sdk-core'
994
- context[:gem_version] = '3.263.0'
994
+ context[:gem_version] = '3.264.0'
995
995
  Seahorse::Client::Request.new(handlers, context)
996
996
  end
997
997
 
@@ -56,7 +56,7 @@ module Aws::Signin
56
56
  autoload :EndpointProvider, 'aws-sdk-signin/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-signin/endpoints'
58
58
 
59
- GEM_VERSION = '3.263.0'
59
+ GEM_VERSION = '3.264.0'
60
60
 
61
61
  end
62
62
 
@@ -703,7 +703,7 @@ module Aws::SSO
703
703
  tracer: tracer
704
704
  )
705
705
  context[:gem_name] = 'aws-sdk-core'
706
- context[:gem_version] = '3.263.0'
706
+ context[:gem_version] = '3.264.0'
707
707
  Seahorse::Client::Request.new(handlers, context)
708
708
  end
709
709
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::SSO
56
56
  autoload :EndpointProvider, 'aws-sdk-sso/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sso/endpoints'
58
58
 
59
- GEM_VERSION = '3.263.0'
59
+ GEM_VERSION = '3.264.0'
60
60
 
61
61
  end
62
62
 
@@ -1086,7 +1086,7 @@ module Aws::SSOOIDC
1086
1086
  tracer: tracer
1087
1087
  )
1088
1088
  context[:gem_name] = 'aws-sdk-core'
1089
- context[:gem_version] = '3.263.0'
1089
+ context[:gem_version] = '3.264.0'
1090
1090
  Seahorse::Client::Request.new(handlers, context)
1091
1091
  end
1092
1092
 
@@ -56,7 +56,7 @@ module Aws::SSOOIDC
56
56
  autoload :EndpointProvider, 'aws-sdk-ssooidc/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-ssooidc/endpoints'
58
58
 
59
- GEM_VERSION = '3.263.0'
59
+ GEM_VERSION = '3.264.0'
60
60
 
61
61
  end
62
62
 
@@ -2807,7 +2807,7 @@ module Aws::STS
2807
2807
  tracer: tracer
2808
2808
  )
2809
2809
  context[:gem_name] = 'aws-sdk-core'
2810
- context[:gem_version] = '3.263.0'
2810
+ context[:gem_version] = '3.264.0'
2811
2811
  Seahorse::Client::Request.new(handlers, context)
2812
2812
  end
2813
2813
 
data/lib/aws-sdk-sts.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::STS
56
56
  autoload :EndpointProvider, 'aws-sdk-sts/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sts/endpoints'
58
58
 
59
- GEM_VERSION = '3.263.0'
59
+ GEM_VERSION = '3.264.0'
60
60
 
61
61
  end
62
62
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.263.0
4
+ version: 3.264.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services