Bug #79606
closedSSE-C multipart uploads fail at CompleteMultipartUpload - customer-key headers erroneously required
0%
Description
Description¶
On the Tentacle release line (reproduced on v20.2.3), RGW rejectsCompleteMultipartUpload for SSE-C (customer-provided key) multipart uploads
unless the SSE-C customer-key headers are re-sent on the complete request.
The AWS S3 API does not define SSE-C headers on CompleteMultipartUpload - they
belong on CreateMultipartUpload, UploadPart, UploadPartCopy, and on
read/copy operations, but not on complete. Consequently no S3-compliant client
(aws-cli, boto3/botocore, geesefs, …) sends them there, and SSE-C multipart
uploads that worked on Squid (19.2.x) fail deterministically after upgrading to
the Tentacle line.
Environment¶
- Ceph: v20.2.3 (Tentacle); worked previously on 19.2.x (Squid)
- RGW frontend: beast, HTTPS
- Encryption: SSE-C, AES256, customer-provided key
- Clients confirmed affected: boto3/botocore, aws-cli, geesefs (via Yandex CSI-S3)
Steps to reproduce¶
Minimal, self-contained boto3 reproducer. It runs a normal SSE-C multipart upload
(SSE-C headers on create and each part, per spec) and then completes it two ways:
first without SSE-C headers (spec-compliant), then with them injected.
#!/usr/bin/env python3
import base64, hashlib, os, boto3
from botocore.config import Config
ENDPOINT = "https://RGW" # <-- fill in
BUCKET = "BUCKET" # <-- fill in
AK, SK = "AK", "SK" # <-- fill in
KEYNAME = "ssec-mpu-test"
raw = os.urandom(32) # AES256 -> 32-byte key
alg = "AES256"
b64key = base64.b64encode(raw).decode()
b64md5 = base64.b64encode(hashlib.md5(raw).digest()).decode()
ssec = dict(SSECustomerAlgorithm=alg, SSECustomerKey=raw) # boto3 encodes + md5s
s3 = boto3.client("s3", endpoint_url=ENDPOINT, aws_access_key_id=AK,
aws_secret_access_key=SK, region_name="us-east-1",
config=Config(signature_version="s3v4",
s3={"addressing_style": "path"}))
def upload_and_complete(complete_with_ssec):
uid = s3.create_multipart_upload(Bucket=BUCKET, Key=KEYNAME, **ssec)["UploadId"]
parts = []
for i in range(2): # 2 x 5 MiB -> multipart
r = s3.upload_part(Bucket=BUCKET, Key=KEYNAME, UploadId=uid,
PartNumber=i + 1, Body=os.urandom(5 * 1024 * 1024), **ssec)
parts.append({"ETag": r["ETag"], "PartNumber": i + 1})
if complete_with_ssec: # non-spec: inject on complete
def _add_ssec(request, **k): # HTTPHeaders has no .update()
request.headers["x-amz-server-side-encryption-customer-algorithm"] = alg
request.headers["x-amz-server-side-encryption-customer-key"] = b64key
request.headers["x-amz-server-side-encryption-customer-key-md5"] = b64md5
s3.meta.events.register("before-sign.s3.CompleteMultipartUpload", _add_ssec)
s3.complete_multipart_upload(Bucket=BUCKET, Key=KEYNAME,
UploadId=uid, MultipartUpload={"Parts": parts})
print("complete WITHOUT sse-c headers (spec-compliant):")
try: upload_and_complete(False); print(" -> OK")
except Exception as e: print(" ->", e)
print("complete WITH sse-c headers (non-spec):")
try: upload_and_complete(True); print(" -> OK")
except Exception as e: print(" ->", e)@
Expected result¶
CompleteMultipartUpload succeeds without SSE-C headers, matching AWS S3 and
pre-Tentacle behavior. Each part was already encrypted with the customer key
supplied at UploadPart time; assembling the manifest at completion does not
require the key.
Actual result¶
CompleteMultipartUpload sent without SSE-C headers is rejected:
HTTP 400 InvalidArgument Requests specifying Server Side Encryption with Customer provided keys must provide a valid encryption algorithm.
The identical request succeeds only when the full SSE-C triple is added to
the complete request ( x-amz-server-side-encryption-customer-algorithm ,-customer-key , -customer-key-md5 ). Sending only the algorithm header is not
sufficient — the key and key-md5 are also required.
Regression source¶
Introduced by commit “rgw: verify sse-c headers on multipart completion”:
- upstream commit caef812aa6324a16fba9f3bb75d7ce75cee4168f
- Tentacle backport commit d5a6080b04996795100b43d827ea05dcf0f70e39
- backport tracker #74034, parent tracker #23264, milestone v20.2.3
- accompanying s3-tests: ceph/s3-tests#758
Impact¶
- Breaks all SSE-C multipart uploads from spec-compliant clients after
upgrading to the Tentacle line - including the AWS CLI and any SDK-based client.
- Additionally observed with geesefs (Yandex CSI-S3): because the client retries
CompleteMultipartUpload , the failure can surface as
500 InternalError: This multipart completion is already in progress with an
indefinite client retry loop, rather than the clean 400 above. This
lock/retry interaction appears environment-dependent; the 400 is the
deterministic minimal signal and the correct thing to fix.
Suggested fix¶
CompleteMultipartUpload not require the SSE-C customer-key headers. The
encryption context established at CreateMultipartUpload / UploadPart is
sufficient to finalize the object, and requiring the key on complete both
diverges from the S3 API and forces clients to transmit the customer secret on an
additional request that the spec does not associate with SSE-C.
JI Updated by J. Eric Ivancich 3 months ago
- Assignee set to Matthew Heler
MH Updated by Matthew Heler 3 months ago
- Backport set to tentacle, umbrella
MH Updated by Matthew Heler 3 months ago
- Pull request ID set to 71241
CB Updated by Casey Bodley 3 months ago
- Status changed from New to Fix Under Review
CB Updated by Casey Bodley 3 months ago
- Status changed from Fix Under Review to Pending Backport
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80570: umbrella: SSE-C multipart uploads fail at CompleteMultipartUpload - customer-key headers erroneously required added
UB Updated by Upkeep Bot 3 months ago
- Copied to Backport #80571: tentacle: SSE-C multipart uploads fail at CompleteMultipartUpload - customer-key headers erroneously required added
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Backporting
- Merge Commit set to be4927e5fc1fc614b8c4f9fede839dc424592916
- Fixed In set to v21.3.0-3285-gbe4927e5fc
- Upkeep Timestamp set to 2026-09-16T13:50:44+00:00
UB Updated by Upkeep Bot about 2 months ago
- Status changed from Backporting to Resolved
- Upkeep Timestamp changed from 2026-09-16T13:50:44+00:00 to 2026-10-08T01:38:01+00:00