aws-sigv4 1.6.0 → 1.6.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-sigv4/signer.rb +13 -6
- 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: 49a7649934cc31b07d019d328bc33748f9829bb439f8bb942b89c0b2dd749998
|
4
|
+
data.tar.gz: 6e94e2e59cf30b1d1e3492b2d0225ea835478fc9d4fd9e8102cfc171aa904aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb86ba1eae65d9433d81e015063e896caba8d5b702f7adc7138398cf7787ad304ba32bea01b145c646b4a7e2c58b32e981e95ea36ebf5ff1adca67d91d45b0b
|
7
|
+
data.tar.gz: 4613f7fa628a0019aeb954f6b5913077232fb6535a5e8ebceeef532ad107d20fb7587d4ea4b96aadf1628dad6dd226ab0e50e52bfcdbfec6eab08284992a5b9d
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.1
|
data/lib/aws-sigv4/signer.rb
CHANGED
@@ -423,7 +423,7 @@ module Aws
|
|
423
423
|
params['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256'
|
424
424
|
params['X-Amz-Credential'] = credential(creds, date)
|
425
425
|
params['X-Amz-Date'] = datetime
|
426
|
-
params['X-Amz-Expires'] = presigned_url_expiration(options, expiration).to_s
|
426
|
+
params['X-Amz-Expires'] = presigned_url_expiration(options, expiration, Time.strptime(datetime, "%Y%m%dT%H%M%S%Z")).to_s
|
427
427
|
params['X-Amz-Security-Token'] = creds.session_token if creds.session_token
|
428
428
|
params['X-Amz-SignedHeaders'] = signed_headers(headers)
|
429
429
|
|
@@ -722,12 +722,19 @@ module Aws
|
|
722
722
|
!credentials.secret_access_key.empty?
|
723
723
|
end
|
724
724
|
|
725
|
-
def presigned_url_expiration(options, expiration)
|
725
|
+
def presigned_url_expiration(options, expiration, datetime)
|
726
726
|
expires_in = extract_expires_in(options)
|
727
727
|
return expires_in unless expiration
|
728
728
|
|
729
|
-
expiration_seconds = (expiration -
|
730
|
-
|
729
|
+
expiration_seconds = (expiration - datetime).to_i
|
730
|
+
# In the static stability case, credentials may expire in the past
|
731
|
+
# but still be valid. For those cases, use the user configured
|
732
|
+
# expires_in and ingore expiration.
|
733
|
+
if expiration_seconds <= 0
|
734
|
+
expires_in
|
735
|
+
else
|
736
|
+
[expires_in, expiration_seconds].min
|
737
|
+
end
|
731
738
|
end
|
732
739
|
|
733
740
|
### CRT Code
|
@@ -811,7 +818,7 @@ module Aws
|
|
811
818
|
headers = downcase_headers(options[:headers])
|
812
819
|
headers['host'] ||= host(url)
|
813
820
|
|
814
|
-
datetime = headers.delete('x-amz-date')
|
821
|
+
datetime = Time.strptime(headers.delete('x-amz-date'), "%Y%m%dT%H%M%S%Z") if headers['x-amz-date']
|
815
822
|
datetime ||= (options[:time] || Time.now)
|
816
823
|
|
817
824
|
content_sha256 = headers.delete('x-amz-content-sha256')
|
@@ -832,7 +839,7 @@ module Aws
|
|
832
839
|
use_double_uri_encode: @uri_escape_path,
|
833
840
|
should_normalize_uri_path: @normalize_path,
|
834
841
|
omit_session_token: @omit_session_token,
|
835
|
-
expiration_in_seconds: presigned_url_expiration(options, expiration)
|
842
|
+
expiration_in_seconds: presigned_url_expiration(options, expiration, datetime)
|
836
843
|
)
|
837
844
|
http_request = Aws::Crt::Http::Message.new(
|
838
845
|
http_method, url.to_s, headers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sigv4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.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: 2023-
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-eventstream
|