Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user provided SSE-C arguments to CompleteMultipartUpload call #8235

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-SSEC-65150.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "``SSE-C``",
"description": "Pass SSECustomer* arguments to CompleteMultipartUpload for upload operations"
}
1 change: 1 addition & 0 deletions awscli/botocore/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ def customize_endpoint_resolver_builtins(
('before-parameter-build.s3.UploadPart', sse_md5),
('before-parameter-build.s3.UploadPartCopy', sse_md5),
('before-parameter-build.s3.UploadPartCopy', copy_source_sse_md5),
('before-parameter-build.s3.CompleteMultipartUpload', sse_md5),
('before-parameter-build.ec2.RunInstances', base64_encode_user_data),
('before-parameter-build.auto-scaling.CreateLaunchConfiguration',
base64_encode_user_data),
Expand Down
8 changes: 7 additions & 1 deletion awscli/s3transfer/copies.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class CopySubmissionTask(SubmissionTask):
'TaggingDirective',
]

COMPLETE_MULTIPART_ARGS = ['RequestPayer', 'ExpectedBucketOwner']
COMPLETE_MULTIPART_ARGS = [
'SSECustomerKey',
'SSECustomerAlgorithm',
'SSECustomerKeyMD5',
'RequestPayer',
'ExpectedBucketOwner',
]

def _submit(
self, client, config, osutil, request_executor, transfer_future
Expand Down
8 changes: 7 additions & 1 deletion awscli/s3transfer/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,13 @@ class UploadSubmissionTask(SubmissionTask):
'ExpectedBucketOwner',
]

COMPLETE_MULTIPART_ARGS = ['RequestPayer', 'ExpectedBucketOwner']
COMPLETE_MULTIPART_ARGS = [
'SSECustomerKey',
'SSECustomerAlgorithm',
'SSECustomerKeyMD5',
'RequestPayer',
'ExpectedBucketOwner',
]

def _get_upload_input_manager_cls(self, transfer_future):
"""Retrieves a class for managing input for an upload based on file type
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/s3transfer/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ def test_copy_passes_args_to_create_multipart_and_upload_part(self):
self.add_head_object_response(expected_params=head_params)

self._add_params_to_expected_params(
add_copy_kwargs, ['create_mpu', 'copy'], self.extra_args
add_copy_kwargs,
['create_mpu', 'copy', 'complete_mpu'],
self.extra_args,
)
self.add_successful_copy_responses(**add_copy_kwargs)

Expand Down
25 changes: 25 additions & 0 deletions tests/functional/s3transfer/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,3 +599,28 @@ def test_multipart_upload_passes_checksums(self):
)
future.result()
self.assert_expected_client_calls_were_correct()

def test_multipart_upload_with_ssec_args(self):
params = {
'RequestPayer': 'requester',
'SSECustomerKey': 'key',
'SSECustomerAlgorithm': 'AES256',
'SSECustomerKeyMD5': 'key-hash',
}
self.extra_args.update(params)

self.add_create_multipart_response_with_default_expected_params(
extra_expected_params=params
)

self.add_upload_part_responses_with_default_expected_params(
extra_expected_params=params
)
self.add_complete_multipart_response_with_default_expected_params(
extra_expected_params=params
)
future = self.manager.upload(
self.filename, self.bucket, self.key, self.extra_args
)
future.result()
self.assert_expected_client_calls_were_correct()
Loading