From 6969d8e0b70328d3cf6cc34cfba15da54e880fbb Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Fri, 22 Sep 2023 11:38:17 -0600 Subject: [PATCH] Add user provided SSE-C arguments to CompleteMultipartUpload call --- .changes/next-release/bugfix-SSEC-19962.json | 5 +++++ s3transfer/copies.py | 7 ++++++- s3transfer/upload.py | 7 ++++++- tests/unit/test_s3transfer.py | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .changes/next-release/bugfix-SSEC-19962.json diff --git a/.changes/next-release/bugfix-SSEC-19962.json b/.changes/next-release/bugfix-SSEC-19962.json new file mode 100644 index 00000000..fb9d8e16 --- /dev/null +++ b/.changes/next-release/bugfix-SSEC-19962.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "``SSE-C``", + "description": "Pass SSECustomer* arguements to CompleteMultipartUpload for upload operations\"" +} diff --git a/s3transfer/copies.py b/s3transfer/copies.py index a42b848f..7af09baa 100644 --- a/s3transfer/copies.py +++ b/s3transfer/copies.py @@ -69,7 +69,12 @@ class CopySubmissionTask(SubmissionTask): 'TaggingDirective', ] - COMPLETE_MULTIPART_ARGS = ['RequestPayer', 'ExpectedBucketOwner'] + COMPLETE_MULTIPART_ARGS = [ + 'RequestPayer', + 'ExpectedBucketOwner', + 'SSECustomerKey', + 'SSECustomerAlgorithm', + ] def _submit( self, client, config, osutil, request_executor, transfer_future diff --git a/s3transfer/upload.py b/s3transfer/upload.py index 0c99bd7b..e86a8a84 100644 --- a/s3transfer/upload.py +++ b/s3transfer/upload.py @@ -521,7 +521,12 @@ class UploadSubmissionTask(SubmissionTask): 'ExpectedBucketOwner', ] - COMPLETE_MULTIPART_ARGS = ['RequestPayer', 'ExpectedBucketOwner'] + COMPLETE_MULTIPART_ARGS = [ + 'RequestPayer', + 'ExpectedBucketOwner', + 'SSECustomerKey', + 'SSECustomerAlgorithm', + ] def _get_upload_input_manager_cls(self, transfer_future): """Retrieves a class for managing input for an upload based on file type diff --git a/tests/unit/test_s3transfer.py b/tests/unit/test_s3transfer.py index a2f46a13..bb0bbc1a 100644 --- a/tests/unit/test_s3transfer.py +++ b/tests/unit/test_s3transfer.py @@ -351,6 +351,8 @@ def test_multipart_upload_injects_proper_kwargs(self): Bucket='bucket', UploadId='upload_id', Key='key', + SSECustomerKey='fakekey', + SSECustomerAlgorithm='AES256', ) def test_multipart_upload_is_aborted_on_error(self):