fog-aws 3.16.0 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d49d93b5a31789230c04265427a1f030d971e30bc7e0fffa32b0396ee4beb899
4
- data.tar.gz: 70083f86f427d17a92f39044e7a5d6cb06c8591e2b9913e760a0fff839672b9f
3
+ metadata.gz: bd719ef24c69a6ef93d8b15e4c8304b32a4b762cd6054c4506233c4184197ba9
4
+ data.tar.gz: 556c9dfb1b9cc3f56e5d5fdac16db6484261f56417357de67468f1e7e7c7e5fe
5
5
  SHA512:
6
- metadata.gz: 957f2207642f1d2336233f0a5d892c0873274b3069c5a92835e0b8ba727ac93387520ee5ea1b676bb7872f061b640b5f9c95cd04e44cdd429b49c4b4a828b011
7
- data.tar.gz: b62d8eb328fcd947ad5221646912ff8c9473baeb12b3b8a638292ac025e35bed68acf5efc01800aeaae49f828980719ff755b29cada556a9dd0ebe398bfe8723
6
+ metadata.gz: 2e1b1a7646803fea71d698b0bdca79bae49bdac336536e56fca0ca06a0a9f33dda197e72fde65c4871da40c440618521c66edf91b0aa114444e60badeef39708
7
+ data.tar.gz: 2cc2a96a966d3eff885333fbcd53502505ab64091cc477a0e13a7a0d166749843bdd7afd6a3b67a45c6cdfa9e9ebc09c3e09c84c0e9003d473d8046c5a204423
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.18.0](https://github.com/fog/fog-aws/tree/v3.18.0) (2023-02-16)
4
+
5
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v3.17.0...v3.18.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Only compute SSE-C headers when needed in multipart upload [\#669](https://github.com/fog/fog-aws/pull/669) ([stanhu](https://github.com/stanhu))
10
+
11
+ ## [v3.17.0](https://github.com/fog/fog-aws/tree/v3.17.0) (2023-02-09)
12
+
13
+ [Full Changelog](https://github.com/fog/fog-aws/compare/v3.16.0...v3.17.0)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Support disabling of Content-MD5 for FIPS [\#668](https://github.com/fog/fog-aws/pull/668) ([stanhu](https://github.com/stanhu))
18
+
3
19
  ## [v3.16.0](https://github.com/fog/fog-aws/tree/v3.16.0) (2023-01-26)
4
20
 
5
21
  [Full Changelog](https://github.com/fog/fog-aws/compare/v3.15.0...v3.16.0)
@@ -335,12 +335,12 @@ module Fog
335
335
  body.rewind rescue nil
336
336
  end
337
337
  while (chunk = body.read(multipart_chunk_size)) do
338
- part_upload = service.upload_part(directory.key, key, upload_id, part_tags.size + 1, chunk, part_headers(chunk, options))
338
+ part_upload = service.upload_part(directory.key, key, upload_id, part_tags.size + 1, chunk, part_headers(chunk))
339
339
  part_tags << part_upload.headers["ETag"]
340
340
  end
341
341
 
342
342
  if part_tags.empty? #it is an error to have a multipart upload with no parts
343
- part_upload = service.upload_part(directory.key, key, upload_id, 1, '', part_headers('', options))
343
+ part_upload = service.upload_part(directory.key, key, upload_id, 1, '', part_headers(''))
344
344
  part_tags << part_upload.headers["ETag"]
345
345
  end
346
346
 
@@ -387,11 +387,18 @@ module Fog
387
387
  end
388
388
  end
389
389
 
390
- def part_headers(chunk, options)
391
- md5 = Base64.encode64(OpenSSL::Digest::MD5.digest(chunk)).strip
392
- encryption_keys = encryption_customer_key_headers.keys
393
- encryption_headers = options.select { |key| encryption_keys.include?(key) }
394
- { 'Content-MD5' => md5 }.merge(encryption_headers)
390
+ def part_headers(chunk)
391
+ base_headers = part_checksum_headers(chunk)
392
+
393
+ # Only SSE-C headers needed in the UploadPart request. [1]
394
+ # x-amz-server-side-encryption and
395
+ # x-amz-server-side-encryption-aws-kms-key-id are only needed
396
+ # in the CreateMultipartUpload request. [2]
397
+ # [1] https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html
398
+ # [2] https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html
399
+ base_headers.merge!(encryption_customer_key_headers) if encryption && encryption_key
400
+
401
+ base_headers
395
402
  end
396
403
 
397
404
  def encryption_customer_key_headers
@@ -402,6 +409,14 @@ module Fog
402
409
  }
403
410
  end
404
411
 
412
+ def part_checksum_headers(chunk)
413
+ if service.disable_content_md5_validation
414
+ {}
415
+ else
416
+ { 'Content-MD5' => Base64.encode64(OpenSSL::Digest::MD5.digest(chunk)).strip }
417
+ end
418
+ end
419
+
405
420
  def create_part_list(upload_part_options)
406
421
  current_pos = 0
407
422
  count = 0
@@ -46,7 +46,7 @@ module Fog
46
46
  ]
47
47
 
48
48
  requires :aws_access_key_id, :aws_secret_access_key
49
- recognizes :endpoint, :region, :host, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :path_style, :acceleration, :instrumentor, :instrumentor_name, :aws_signature_version, :enable_signature_v4_streaming, :virtual_host, :cname, :max_put_chunk_size, :max_copy_chunk_size, :aws_credentials_refresh_threshold_seconds
49
+ recognizes :endpoint, :region, :host, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :path_style, :acceleration, :instrumentor, :instrumentor_name, :aws_signature_version, :enable_signature_v4_streaming, :virtual_host, :cname, :max_put_chunk_size, :max_copy_chunk_size, :aws_credentials_refresh_threshold_seconds, :disable_content_md5_validation
50
50
 
51
51
  secrets :aws_secret_access_key, :hmac
52
52
 
@@ -119,6 +119,7 @@ module Fog
119
119
 
120
120
  module Utils
121
121
  attr_accessor :region
122
+ attr_accessor :disable_content_md5_validation
122
123
 
123
124
  # Amazon S3 limits max chunk size that can be uploaded/copied in a single request to 5GB.
124
125
  # Other S3-compatible storages (like, Ceph) do not have such limit.
@@ -486,6 +487,8 @@ module Fog
486
487
  init_max_put_chunk_size!(options)
487
488
  init_max_copy_chunk_size!(options)
488
489
 
490
+ @disable_content_md5_validation = options[:disable_content_md5_validation] || false
491
+
489
492
  @signature_version = options.fetch(:aws_signature_version, 4)
490
493
  validate_signature_version!
491
494
  setup_credentials(options)
@@ -554,6 +557,8 @@ module Fog
554
557
  init_max_put_chunk_size!(options)
555
558
  init_max_copy_chunk_size!(options)
556
559
 
560
+ @disable_content_md5_validation = options[:disable_content_md5_validation] || false
561
+
557
562
  @region = options[:region] || DEFAULT_REGION
558
563
 
559
564
  if @endpoint = options[:endpoint]
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AWS
3
- VERSION = "3.16.0"
3
+ VERSION = "3.18.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.0
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-26 00:00:00.000000000 Z
12
+ date: 2023-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler