aws-sigv4 1.6.0 → 1.6.1

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: ed95d4ec56e15f5b06d202643cebf73e89d69efbe461d03035dc309f0aa32b11
4
- data.tar.gz: f235824f3bf7ea35aa4fb7e666250f72be1d8592709f522c8fae42fb36e40a9a
3
+ metadata.gz: 49a7649934cc31b07d019d328bc33748f9829bb439f8bb942b89c0b2dd749998
4
+ data.tar.gz: 6e94e2e59cf30b1d1e3492b2d0225ea835478fc9d4fd9e8102cfc171aa904aa1
5
5
  SHA512:
6
- metadata.gz: 62ddb59e6cf4fd5ca5a704db3a7f8f8707329cd8b66fec124de5bc56bc5cc2fac20622987e5a6cbeaec1ce55941ee66ab36ed25178ee82e287515622a33bc314
7
- data.tar.gz: e05f2a2ada39d28681df35b7365e7c71e6eda34b250cd2259312d9b6cc0e810fceb0dffeddd785a4b5e08cea1989eb5e2e4e27303d1cf4ce51ad251952d7047d
6
+ metadata.gz: 2fb86ba1eae65d9433d81e015063e896caba8d5b702f7adc7138398cf7787ad304ba32bea01b145c646b4a7e2c58b32e981e95ea36ebf5ff1adca67d91d45b0b
7
+ data.tar.gz: 4613f7fa628a0019aeb954f6b5913077232fb6535a5e8ebceeef532ad107d20fb7587d4ea4b96aadf1628dad6dd226ab0e50e52bfcdbfec6eab08284992a5b9d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.6.1 (2023-10-25)
5
+ ------------------
6
+
7
+ * Issue - (Static Stability) use provided `expires_in` in presigned url when credentials are expired.
8
+
4
9
  1.6.0 (2023-06-28)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.0
1
+ 1.6.1
@@ -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 - Time.now).to_i
730
- [expires_in, expiration_seconds].min
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.0
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-06-28 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-eventstream