Skip to content

s3: send SSE-C headers on UploadPart and CompleteMultipartUpload in putFileMultipartCRC32 - #1700

Open
vshuraeff wants to merge 1 commit into
Altinity:masterfrom
vshuraeff:fix-ssec-multipart-crc32
Open

vshuraeff wants to merge 1 commit into
Altinity:masterfrom
vshuraeff:fix-ssec-multipart-crc32

Conversation

@vshuraeff

Copy link
Copy Markdown

With s3.check_sum_algorithm: CRC32, PutFileAbsolute uploads every file larger than the part size through putFileMultipartCRC32 (the #829 fallback). That path passes the SSE-C fields to CreateMultipartUpload through enrichCreateMultipartUploadParams, but not to UploadPart or CompleteMultipartUpload.

A store that enforces SSE-C rejects every part. Backblaze B2 answers:

api error InvalidArgument: The multipart upload initiate requested encryption. Subsequent part requests must include the appropriate encryption parameters.

After the retries CompleteMultipartUpload fails with You must specify at least one part and the upload of the backup fails. Files below the part size (5 MiB with the default chunk_size) take a single PutObject and are not affected, so a diff backup of small files can still pass while a full backup fails.

Configuration that hits it:

s3:
  check_sum_algorithm: CRC32
  sse_customer_algorithm: AES256
  sse_customer_key: <base64 key>
  sse_customer_key_md5: <base64 md5 of the key>

Seen on v2.8.3; v2.7.4 through v2.8.2 and master have the same code.

Change

  • Copy SSECustomerAlgorithm, SSECustomerKey and SSECustomerKeyMD5 from the PutObjectInput into each UploadPartInput and into the CompleteMultipartUploadInput. S3 requires the SSE-C headers on CompleteMultipartUpload when the object was created with a checksum algorithm.
  • Add TestPutFileMultipartCRC32SSECustomerKey, which records the SSE-C fields the fake multipart client receives. It fails without the change.

Testing

  • go test ./pkg/storage/ -run TestPutFileMultipartCRC32 passes.
  • A v2.8.3 build with this change uploaded a backup with a single 1.5 GiB column file to an S3-compatible endpoint over TLS, with SSE-C and CRC32 on. The backup then downloaded and restored with matching count() and sum(cityHash64(*)). The unpatched v2.8.3 binary fails the same test.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T09:46:01.151268Z b02c5b9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Slach

Slach commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

nice catch thanks for contribution

@Slach Slach added this to the 2.8.4 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants