aws-sdk-core 3.126.0 → 3.126.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-core/ec2_metadata.rb +3 -2
- data/lib/aws-sdk-core/instance_profile_credentials.rb +23 -8
- data/lib/aws-sdk-sso/client.rb +1 -1
- data/lib/aws-sdk-sso.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/aws-sdk-sts.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46193e52f3ea24b17d0d2ff28e7abf1ef462586db550c10f0540810da7a45fed
|
4
|
+
data.tar.gz: 3dc8f9629d7d7057632bd639c097747792dd40d6c6c81ca5f91e4366ca9dd6bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f72443886e4e7077c1dc7d1f816b1774ceeae361f13e6f13a5ce532bc77a669e297e5fb3f3582eb772563e315dd0afcef9c5d9acd45d672fea79706537b8868
|
7
|
+
data.tar.gz: 3ed264c5a2ed5cb2dcd3c050224785e62618ded48137d8dd217a75107865f58679a26e5ded1e8498971e8de862e8f91e684eb1a5c64fa9e3db3f53d186d8b351
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Unreleased Changes
|
2
2
|
------------------
|
3
3
|
|
4
|
+
3.126.1 (2022-02-14)
|
5
|
+
------------------
|
6
|
+
|
7
|
+
* Issue - Set `create_time` on IMDS tokens before fetch to reduce chance of using expired tokens and retry failures due to using expired tokens.
|
8
|
+
|
4
9
|
3.126.0 (2022-02-03)
|
5
10
|
------------------
|
6
11
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.126.
|
1
|
+
3.126.1
|
@@ -136,8 +136,9 @@ module Aws
|
|
136
136
|
|
137
137
|
def fetch_token
|
138
138
|
open_connection do |conn|
|
139
|
+
created_time = Time.now
|
139
140
|
token_value, token_ttl = http_put(conn, @token_ttl)
|
140
|
-
@token = Token.new(value: token_value, ttl: token_ttl)
|
141
|
+
@token = Token.new(value: token_value, ttl: token_ttl, created_time: created_time)
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
@@ -222,7 +223,7 @@ module Aws
|
|
222
223
|
def initialize(options = {})
|
223
224
|
@ttl = options[:ttl]
|
224
225
|
@value = options[:value]
|
225
|
-
@created_time = Time.now
|
226
|
+
@created_time = options[:created_time] || Time.now
|
226
227
|
end
|
227
228
|
|
228
229
|
# [String] Returns the token value.
|
@@ -153,10 +153,11 @@ module Aws
|
|
153
153
|
begin
|
154
154
|
retry_errors(NETWORK_ERRORS, max_retries: @retries) do
|
155
155
|
unless token_set?
|
156
|
+
created_time = Time.now
|
156
157
|
token_value, ttl = http_put(
|
157
158
|
conn, METADATA_TOKEN_PATH, @token_ttl
|
158
159
|
)
|
159
|
-
@token = Token.new(token_value, ttl) if token_value && ttl
|
160
|
+
@token = Token.new(token_value, ttl, created_time) if token_value && ttl
|
160
161
|
end
|
161
162
|
end
|
162
163
|
rescue *NETWORK_ERRORS
|
@@ -166,9 +167,17 @@ module Aws
|
|
166
167
|
end
|
167
168
|
|
168
169
|
token = @token.value if token_set?
|
169
|
-
|
170
|
-
|
171
|
-
|
170
|
+
|
171
|
+
begin
|
172
|
+
metadata = http_get(conn, METADATA_PATH_BASE, token)
|
173
|
+
profile_name = metadata.lines.first.strip
|
174
|
+
http_get(conn, METADATA_PATH_BASE + profile_name, token)
|
175
|
+
rescue TokenExpiredError
|
176
|
+
# Token has expired, reset it
|
177
|
+
# The next retry should fetch it
|
178
|
+
@token = nil
|
179
|
+
raise Non200Response
|
180
|
+
end
|
172
181
|
end
|
173
182
|
end
|
174
183
|
rescue
|
@@ -200,9 +209,15 @@ module Aws
|
|
200
209
|
headers = { 'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}" }
|
201
210
|
headers['x-aws-ec2-metadata-token'] = token if token
|
202
211
|
response = connection.request(Net::HTTP::Get.new(path, headers))
|
203
|
-
raise Non200Response unless response.code.to_i == 200
|
204
212
|
|
205
|
-
response.
|
213
|
+
case response.code.to_i
|
214
|
+
when 200
|
215
|
+
response.body
|
216
|
+
when 401
|
217
|
+
raise TokenExpiredError
|
218
|
+
else
|
219
|
+
raise Non200Response
|
220
|
+
end
|
206
221
|
end
|
207
222
|
|
208
223
|
# PUT request fetch token with ttl
|
@@ -244,10 +259,10 @@ module Aws
|
|
244
259
|
# @api private
|
245
260
|
# Token used to fetch IMDS profile and credentials
|
246
261
|
class Token
|
247
|
-
def initialize(value, ttl)
|
262
|
+
def initialize(value, ttl, created_time = Time.now)
|
248
263
|
@ttl = ttl
|
249
264
|
@value = value
|
250
|
-
@created_time =
|
265
|
+
@created_time = created_time
|
251
266
|
end
|
252
267
|
|
253
268
|
# [String] token value
|
data/lib/aws-sdk-sso/client.rb
CHANGED
data/lib/aws-sdk-sso.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -2286,7 +2286,7 @@ module Aws::STS
|
|
2286
2286
|
params: params,
|
2287
2287
|
config: config)
|
2288
2288
|
context[:gem_name] = 'aws-sdk-core'
|
2289
|
-
context[:gem_version] = '3.126.
|
2289
|
+
context[:gem_version] = '3.126.1'
|
2290
2290
|
Seahorse::Client::Request.new(handlers, context)
|
2291
2291
|
end
|
2292
2292
|
|
data/lib/aws-sdk-sts.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.126.
|
4
|
+
version: 3.126.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|