aws-sdk-cloudfront 1.154.0 → 1.156.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: 954fa182dffe203eea931bf9910d6648ffb3a539694fc89ae1d09d1440964965
4
- data.tar.gz: fef6f98963a4de65fe744d812ac30ed45091d9b41cb1c4abfdb1956b3b03cd78
3
+ metadata.gz: b356540626e44f75082d1ac97586be5d46a097fa791930957f7c39bc31ee2033
4
+ data.tar.gz: 352e9eed509f4407c6e56c3fb765b827d9b8bdfa377e63e6c005ac55bbc13953
5
5
  SHA512:
6
- metadata.gz: 9ea4f808206542ea0c10945ee3fd56205ff1b3333c9265c1096bba34ed9e5b620b5029f73fa2122b8422bf1ffedf849615d3ed1006e3a9e82f72c90907bdd131
7
- data.tar.gz: cb37d3b7ce1f67044044a014636e39964562cebef3a2ff33427c7d62a51f41779de15c3123ebc88686a76721d2707566ce7b96bfa3fa81c961e8482ecaf67886
6
+ metadata.gz: 5d8ca45e758703d00ed160e2f64ae2d35eb2f194d8604b3fbb052aace34245ef5f0e6e20fb10ce049dd84c72b176f53cc0f76eaaa87090bcae87ff238ee81f08
7
+ data.tar.gz: e98d42fbee66e65212600bf0d233844a3c8140700a3826fff77cb2e609e102cf8100233738b67fbfe53fd8787f42fa8a3212cce54422afa0cf6bd504951dcf9e
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.156.0 (2026-10-01)
5
+ ------------------
6
+
7
+ * Feature - Added always-amz-auth as a supported signing behavior for Origin Access Control (OAC), enabling CloudFront to authenticate requests to Lambda-Web origins.
8
+
9
+ 1.155.0 (2026-09-23)
10
+ ------------------
11
+
12
+ * Feature - CloudFront signers now support SHA-256 signatures via the `:hash_algorithm` option (`'SHA1'` or `'SHA256'`, defaults to `'SHA1'`). Signers also validate that the private key is RSA or ECDSA (P-256), and custom policies are now minified before signing.
13
+
4
14
  1.154.0 (2026-09-11)
5
15
  ------------------
6
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.154.0
1
+ 1.156.0
@@ -3213,7 +3213,7 @@ module Aws::CloudFront
3213
3213
  # name: "string", # required
3214
3214
  # description: "string",
3215
3215
  # signing_protocol: "sigv4", # required, accepts sigv4, sigv4a
3216
- # signing_behavior: "never", # required, accepts never, always, no-override
3216
+ # signing_behavior: "never", # required, accepts never, always, no-override, always-amz-auth
3217
3217
  # origin_access_control_origin_type: "s3", # required, accepts s3, mediastore, mediapackagev2, lambda
3218
3218
  # },
3219
3219
  # })
@@ -3224,7 +3224,7 @@ module Aws::CloudFront
3224
3224
  # resp.origin_access_control.origin_access_control_config.name #=> String
3225
3225
  # resp.origin_access_control.origin_access_control_config.description #=> String
3226
3226
  # resp.origin_access_control.origin_access_control_config.signing_protocol #=> String, one of "sigv4", "sigv4a"
3227
- # resp.origin_access_control.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override"
3227
+ # resp.origin_access_control.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override", "always-amz-auth"
3228
3228
  # resp.origin_access_control.origin_access_control_config.origin_access_control_origin_type #=> String, one of "s3", "mediastore", "mediapackagev2", "lambda"
3229
3229
  # resp.location #=> String
3230
3230
  # resp.etag #=> String
@@ -6504,7 +6504,7 @@ module Aws::CloudFront
6504
6504
  # resp.origin_access_control.origin_access_control_config.name #=> String
6505
6505
  # resp.origin_access_control.origin_access_control_config.description #=> String
6506
6506
  # resp.origin_access_control.origin_access_control_config.signing_protocol #=> String, one of "sigv4", "sigv4a"
6507
- # resp.origin_access_control.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override"
6507
+ # resp.origin_access_control.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override", "always-amz-auth"
6508
6508
  # resp.origin_access_control.origin_access_control_config.origin_access_control_origin_type #=> String, one of "s3", "mediastore", "mediapackagev2", "lambda"
6509
6509
  # resp.etag #=> String
6510
6510
  #
@@ -6538,7 +6538,7 @@ module Aws::CloudFront
6538
6538
  # resp.origin_access_control_config.name #=> String
6539
6539
  # resp.origin_access_control_config.description #=> String
6540
6540
  # resp.origin_access_control_config.signing_protocol #=> String, one of "sigv4", "sigv4a"
6541
- # resp.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override"
6541
+ # resp.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override", "always-amz-auth"
6542
6542
  # resp.origin_access_control_config.origin_access_control_origin_type #=> String, one of "s3", "mediastore", "mediapackagev2", "lambda"
6543
6543
  # resp.etag #=> String
6544
6544
  #
@@ -10289,7 +10289,7 @@ module Aws::CloudFront
10289
10289
  # resp.origin_access_control_list.items[0].description #=> String
10290
10290
  # resp.origin_access_control_list.items[0].name #=> String
10291
10291
  # resp.origin_access_control_list.items[0].signing_protocol #=> String, one of "sigv4", "sigv4a"
10292
- # resp.origin_access_control_list.items[0].signing_behavior #=> String, one of "never", "always", "no-override"
10292
+ # resp.origin_access_control_list.items[0].signing_behavior #=> String, one of "never", "always", "no-override", "always-amz-auth"
10293
10293
  # resp.origin_access_control_list.items[0].origin_access_control_origin_type #=> String, one of "s3", "mediastore", "mediapackagev2", "lambda"
10294
10294
  #
10295
10295
  # @see http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/ListOriginAccessControls AWS API Documentation
@@ -13064,7 +13064,7 @@ module Aws::CloudFront
13064
13064
  # name: "string", # required
13065
13065
  # description: "string",
13066
13066
  # signing_protocol: "sigv4", # required, accepts sigv4, sigv4a
13067
- # signing_behavior: "never", # required, accepts never, always, no-override
13067
+ # signing_behavior: "never", # required, accepts never, always, no-override, always-amz-auth
13068
13068
  # origin_access_control_origin_type: "s3", # required, accepts s3, mediastore, mediapackagev2, lambda
13069
13069
  # },
13070
13070
  # id: "string", # required
@@ -13077,7 +13077,7 @@ module Aws::CloudFront
13077
13077
  # resp.origin_access_control.origin_access_control_config.name #=> String
13078
13078
  # resp.origin_access_control.origin_access_control_config.description #=> String
13079
13079
  # resp.origin_access_control.origin_access_control_config.signing_protocol #=> String, one of "sigv4", "sigv4a"
13080
- # resp.origin_access_control.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override"
13080
+ # resp.origin_access_control.origin_access_control_config.signing_behavior #=> String, one of "never", "always", "no-override", "always-amz-auth"
13081
13081
  # resp.origin_access_control.origin_access_control_config.origin_access_control_origin_type #=> String, one of "s3", "mediastore", "mediapackagev2", "lambda"
13082
13082
  # resp.etag #=> String
13083
13083
  #
@@ -13815,7 +13815,7 @@ module Aws::CloudFront
13815
13815
  tracer: tracer
13816
13816
  )
13817
13817
  context[:gem_name] = 'aws-sdk-cloudfront'
13818
- context[:gem_version] = '1.154.0'
13818
+ context[:gem_version] = '1.156.0'
13819
13819
  Seahorse::Client::Request.new(handlers, context)
13820
13820
  end
13821
13821
 
@@ -12,12 +12,20 @@ module Aws
12
12
  #
13
13
  # signer = Aws::CloudFront::CookieSigner.new(
14
14
  # key_pair_id: "cf-keypair-id",
15
- # private_key_path: "./unit_test_dummy_key"
15
+ # private_key_path: "./private_key.pem"
16
16
  # )
17
17
  # cookies = signer.signed_cookie(url,
18
18
  # policy: policy.to_json
19
19
  # )
20
20
  #
21
+ # Pass `hash_algorithm: 'SHA256'` to sign with SHA-256 instead of SHA-1:
22
+ #
23
+ # signer = Aws::CloudFront::CookieSigner.new(
24
+ # key_pair_id: "cf-keypair-id",
25
+ # private_key_path: "./private_key.pem",
26
+ # hash_algorithm: "SHA256"
27
+ # )
28
+ #
21
29
  class CookieSigner
22
30
  include Signer
23
31
 
@@ -8,13 +8,18 @@ require 'openssl'
8
8
  module Aws
9
9
  module CloudFront
10
10
  module Signer
11
+ # @api private
12
+ SUPPORTED_HASH_ALGORITHMS = %w[SHA1 SHA256].freeze
13
+
11
14
  # @option options [String] :key_pair_id
12
15
  # @option options [String] :private_key
13
16
  # @option options [String] :private_key_path
17
+ # @option options [String] :hash_algorithm ('SHA1') 'SHA1' or 'SHA256'
14
18
  def initialize(options = {})
15
19
  @key_pair_id = key_pair_id(options)
16
- @cipher = OpenSSL::Digest.new('SHA1')
17
- @private_key = OpenSSL::PKey.read(private_key(options))
20
+ @hash_algorithm = hash_algorithm(options)
21
+ @cipher = OpenSSL::Digest.new(@hash_algorithm)
22
+ @private_key = load_private_key(private_key(options))
18
23
  end
19
24
 
20
25
  private
@@ -78,7 +83,7 @@ module Aws
78
83
  def signature(params = {})
79
84
  signature_content = {}
80
85
  if params[:policy]
81
- policy = params[:policy].gsub('/\s/s', '')
86
+ policy = params[:policy].gsub(/\s/, '')
82
87
  signature_content['Policy'] = encode(policy)
83
88
  elsif params[:resource] && params[:expires]
84
89
  policy = canned_policy(params[:resource], params[:expires])
@@ -90,12 +95,18 @@ module Aws
90
95
 
91
96
  signature_content['Signature'] = encode(sign_policy(policy))
92
97
  signature_content['Key-Pair-Id'] = @key_pair_id
98
+ # omitted for SHA1 to keep existing signed URLs and cookies unchanged
99
+ signature_content['Hash-Algorithm'] = @hash_algorithm if @hash_algorithm == 'SHA256'
93
100
  signature_content
94
101
  end
95
102
 
96
103
  # create the signature string with policy signed
97
104
  def sign_policy(policy)
98
105
  @private_key.sign(@cipher, policy)
106
+ rescue OpenSSL::PKey::PKeyError => e
107
+ msg = "failed to sign with #{@hash_algorithm}: #{e.message}"
108
+ msg += ", consider `hash_algorithm: 'SHA256'`" if @hash_algorithm == 'SHA1'
109
+ raise ArgumentError, msg
99
110
  end
100
111
 
101
112
  # create canned policy that used for signing
@@ -121,6 +132,16 @@ module Aws
121
132
  options[:key_pair_id]
122
133
  end
123
134
 
135
+ def hash_algorithm(options)
136
+ algorithm = (options[:hash_algorithm] || 'SHA1').to_s.upcase
137
+ unless SUPPORTED_HASH_ALGORITHMS.include?(algorithm)
138
+ msg = ":hash_algorithm must be one of #{SUPPORTED_HASH_ALGORITHMS.join(', ')}"
139
+ raise ArgumentError, msg
140
+ end
141
+
142
+ algorithm
143
+ end
144
+
124
145
  def private_key(options)
125
146
  if options[:private_key]
126
147
  options[:private_key]
@@ -131,6 +152,23 @@ module Aws
131
152
  raise ArgumentError, msg
132
153
  end
133
154
  end
155
+
156
+ def load_private_key(pem)
157
+ key = OpenSSL::PKey.read(pem)
158
+ case key
159
+ when OpenSSL::PKey::RSA
160
+ key
161
+ when OpenSSL::PKey::EC
162
+ curve = key.group.curve_name
163
+ raise ArgumentError, "unsupported ECDSA curve `#{curve}', must be prime256v1" unless curve == 'prime256v1'
164
+
165
+ key
166
+ else
167
+ raise ArgumentError, "unsupported private key type #{key.class}, must be RSA or ECDSA"
168
+ end
169
+ rescue OpenSSL::PKey::PKeyError
170
+ raise ArgumentError, 'invalid private key, must be a PEM-encoded RSA or ECDSA private key'
171
+ end
134
172
  end
135
173
  end
136
174
  end
@@ -11532,6 +11532,15 @@ module Aws::CloudFront
11532
11532
  # [cache policy][2] for all cache behaviors that use origins
11533
11533
  # associated with this origin access control.**
11534
11534
  #
11535
+ # * `always-amz-auth` – CloudFront signs all origin requests with
11536
+ # Amazon authentication headers. If the viewer request contains the
11537
+ # `Authorization` header, then CloudFront also forwards that header
11538
+ # to the origin. This value is only valid with Lambda-Web origins.
11539
+ # **WARNING: To forward the `Authorization` header from the viewer
11540
+ # request, you *must* add the `Authorization` header to a [cache
11541
+ # policy][2] for all cache behaviors that use origins associated
11542
+ # with this origin access control.**
11543
+ #
11535
11544
  #
11536
11545
  #
11537
11546
  # [1]: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html#oac-advanced-settings
@@ -11645,6 +11654,11 @@ module Aws::CloudFront
11645
11654
  # the viewer request contains the `Authorization` header, CloudFront
11646
11655
  # doesn't sign the origin request, but instead passes along the
11647
11656
  # `Authorization` header that it received in the viewer request.
11657
+ #
11658
+ # * `always-amz-auth` – CloudFront signs all origin requests with
11659
+ # Amazon authentication headers, and forwards the viewer's
11660
+ # `Authorization` header to the origin if one is present. This value
11661
+ # is only valid with Lambda-Web origins.
11648
11662
  # @return [String]
11649
11663
  #
11650
11664
  # @!attribute [rw] origin_access_control_origin_type
@@ -12,12 +12,20 @@ module Aws
12
12
  #
13
13
  # signer = Aws::CloudFront::UrlSigner.new(
14
14
  # key_pair_id: "cf-keypair-id",
15
- # private_key_path: "./unit_test_dummy_key"
15
+ # private_key_path: "./private_key.pem"
16
16
  # )
17
17
  # url = signer.signed_url(url,
18
18
  # policy: policy.to_json
19
19
  # )
20
20
  #
21
+ # Pass `hash_algorithm: 'SHA256'` to sign with SHA-256 instead of SHA-1:
22
+ #
23
+ # signer = Aws::CloudFront::UrlSigner.new(
24
+ # key_pair_id: "cf-keypair-id",
25
+ # private_key_path: "./private_key.pem",
26
+ # hash_algorithm: "SHA256"
27
+ # )
28
+ #
21
29
  class UrlSigner
22
30
  include Signer
23
31
 
@@ -55,7 +55,7 @@ module Aws::CloudFront
55
55
  autoload :EndpointProvider, 'aws-sdk-cloudfront/endpoint_provider'
56
56
  autoload :Endpoints, 'aws-sdk-cloudfront/endpoints'
57
57
 
58
- GEM_VERSION = '1.154.0'
58
+ GEM_VERSION = '1.156.0'
59
59
 
60
60
  end
61
61
 
data/sig/client.rbs CHANGED
@@ -464,7 +464,7 @@ module Aws
464
464
  name: ::String,
465
465
  description: ::String?,
466
466
  signing_protocol: ("sigv4" | "sigv4a"),
467
- signing_behavior: ("never" | "always" | "no-override"),
467
+ signing_behavior: ("never" | "always" | "no-override" | "always-amz-auth"),
468
468
  origin_access_control_origin_type: ("s3" | "mediastore" | "mediapackagev2" | "lambda")
469
469
  }
470
470
  ) -> _CreateOriginAccessControlResponseSuccess
@@ -2065,7 +2065,7 @@ module Aws
2065
2065
  name: ::String,
2066
2066
  description: ::String?,
2067
2067
  signing_protocol: ("sigv4" | "sigv4a"),
2068
- signing_behavior: ("never" | "always" | "no-override"),
2068
+ signing_behavior: ("never" | "always" | "no-override" | "always-amz-auth"),
2069
2069
  origin_access_control_origin_type: ("s3" | "mediastore" | "mediapackagev2" | "lambda")
2070
2070
  },
2071
2071
  id: ::String,
data/sig/types.rbs CHANGED
@@ -2852,7 +2852,7 @@ module Aws::CloudFront
2852
2852
  attr_accessor name: ::String
2853
2853
  attr_accessor description: ::String
2854
2854
  attr_accessor signing_protocol: ("sigv4" | "sigv4a")
2855
- attr_accessor signing_behavior: ("never" | "always" | "no-override")
2855
+ attr_accessor signing_behavior: ("never" | "always" | "no-override" | "always-amz-auth")
2856
2856
  attr_accessor origin_access_control_origin_type: ("s3" | "mediastore" | "mediapackagev2" | "lambda")
2857
2857
  SENSITIVE: []
2858
2858
  end
@@ -2877,7 +2877,7 @@ module Aws::CloudFront
2877
2877
  attr_accessor description: ::String
2878
2878
  attr_accessor name: ::String
2879
2879
  attr_accessor signing_protocol: ("sigv4" | "sigv4a")
2880
- attr_accessor signing_behavior: ("never" | "always" | "no-override")
2880
+ attr_accessor signing_behavior: ("never" | "always" | "no-override" | "always-amz-auth")
2881
2881
  attr_accessor origin_access_control_origin_type: ("s3" | "mediastore" | "mediapackagev2" | "lambda")
2882
2882
  SENSITIVE: []
2883
2883
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-cloudfront
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.154.0
4
+ version: 1.156.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services