Skip to content

fix: store raw SSE-C replicas verbatim on the destination - #122

Merged
Vonng merged 2 commits into
mainfrom
fix/issue-109-raw-ssec-replica
Sep 6, 2026
Merged

Vonng merged 2 commits into
mainfrom
fix/issue-109-raw-ssec-replica

Conversation

@Vonng

@Vonng Vonng commented Sep 5, 2026

Copy link
Copy Markdown
Member

Contribution Licensing (no CLA, inbound=outbound, DCO required)

This project does not use a CLA; contributions are accepted inbound=outbound.
By submitting this pull request I represent that I have the right to contribute
the changes, which are licensed under this repository's
GNU Affero General Public License v3.0 or later
and remain my copyright. Every commit carries a DCO Signed-off-by trailer.

Description

A raw SSE-C replica write carries the source ciphertext and the source seal in the internal X-Minio-Replication-Server-Side-Encryption-* headers but no public SSE-C request headers, so the destination treated it as a plain upload and applied its own bucket default encryption and compression to bytes that were already ciphertext. With destination default SSE-S3 the replica's IV and seal were overwritten and GET returned 400; with destination compression the replica stored compress(ciphertext) and GET failed with XMinioObjectTampered, while the source reported the object as COMPLETED.

The destination now recognises a validated raw SSE-C replica (replicaTrusted from the signature-verified trust evaluation plus a seal header; shared helper isRawSSECReplica) and stores it verbatim: single PUT skips bucket default encryption, compression and the encryption branch; multipart initiation skips default encryption and compression (it already skipped key generation). On the sender, an object that is both compressed and SSE-C is rejected by putReplicationOpts and reported as Failed instead of Completed, because the wire carries no compression state and the destination would otherwise store an undetectable S2 stream (tracked as #118).

Fixes #109. Fix plan agreed with the Codex reviewer: #109 (comment). Adversarial Codex review of this implementation: PASS in round 1 with one optional finding (compare the three seal fields with the source in the multipart-init cases instead of checking presence), which is applied.

Motivation and Context

Replication status COMPLETED must mean a replica readable with the original customer key, on ordinary reads and on site failover. Upstream 468a9fae8 (Enable replication of SSE-C objects, minio#19107) added the raw-ciphertext path without exempting it from the destination's existing PUT transforms; the behaviour is inherited and present on upstream master. AWS documents that an SSE-C replica is retrieved with the same customer key the source used, so the destination cannot decrypt or re-frame the object.

How to test this PR?

GOWORK=off go test -tags kqueue,dev ./cmd -count=1 -v -run '^(TestAPISSECReplicaSkipsDestinationTransforms|TestAPISSECMultipartReplicaRoundTripWithCompression|TestPutReplicationOptsRejectsCompressedSSEC)$'

With the product hunks reverted, the default-sse-s3, compression, explicit-sse-header and mpu-compression subtests fail on ErasureSD and Erasure (mpu-default-sse-s3 and the untrusted control pass on main, which pins the multipart split), and the other two tests fail; with the fix all pass, together with every test in cmd/replication-trust_test.go, the replication tests in cmd/handler-utils_test.go, TestObjectAPIPutObjectPart, TestAPIPutObjectHandler, TestAPINewMultipartHandler and TestAPICompleteMultipartFullObjectVariants. go vet clean, gofmt -l cmd empty, golangci-lint 0 issues on ./cmd/....

Before release, the plan's bounded live check should be run once: two TLS sites, destination default SSE-S3 and destination compression, SSE-C objects of 0, 1 and 131072 bytes by single PUT and multipart, GET on the destination with the correct key byte-compared, wrong key refused. The 2026-09-05 review lab scripts cover the single-PUT legs.

Compatibility impact

No wire, API or metadata-format change: the same headers are sent and the same metadata keys are written; the destination change only removes transforms it should never have applied to trusted replica writes carrying a source seal, and ordinary client uploads (with or without real SSE-C headers) are untouched. Guarantees by endpoint: upgrading the destination protects it from transforms whatever the source runs; upgrading the source adds the compressed-SSE-C rejection whatever the destination runs; upgrading only the source does not protect an old destination. Replication failure accounting changes for compressed SSE-C sources (now Failed with an error instead of Completed). Replicas already transformed are not repaired by this change; a resync does not retransmit SSE-C data today (#120), so no recovery instruction is published until that is fixed and verified.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • All commits are signed off (git commit -s) per the DCO
  • Fixes a regression (inherited from upstream 468a9fae8, not a SILO regression)
  • Unit tests added/updated
  • make verifiers equivalent: gofmt clean, go vet clean, golangci-lint 0 issues on ./cmd/...
  • Relevant package tests pass
  • Compatibility and rollback impact documented
  • Internal documentation updated (code comments)
  • Public documentation update opened in pgsty/silo.pgsty.com (release fix note; replication docs must not publish a recovery recipe until [P1] Existing SSE-C replicas cannot always be updated or repaired #120 lands)

🤖 Generated with Claude Code

https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe

A raw SSE-C replica write carries the source ciphertext and the source seal
in X-Minio-Replication-Server-Side-Encryption-* headers but no public SSE-C
request headers, so crypto.Requested() was false and PutObjectHandler and
NewMultipartUploadHandler applied the destination's default encryption and
compression to bytes that were already ciphertext (upstream 468a9fa,
"Enable replication of SSE-C objects", never exempted the raw path). With
destination default SSE-S3 the replica's IV and seal were overwritten and
GET returned 400; with destination compression the replica stored
compress(ciphertext) and GET failed, while the source reported COMPLETED.

Recognize a validated raw SSE-C replica (replicaTrusted plus a seal header,
shared helper isRawSSECReplica) and skip bucket default encryption,
compression and the encryption branch on the single PUT path, and default
encryption plus compression on the multipart initiation path, which already
skipped key generation. On the sender, reject replication of an object that
is both compressed and SSE-C, since the wire carries no compression state
and the destination would otherwise store an undetectable S2 stream, and
make replicateObject/replicateAll report a putReplicationOpts failure as
Failed instead of Completed.

Tests: TestAPISSECReplicaSkipsDestinationTransforms (single PUT and
multipart under destination default SSE-S3, compression and an explicit SSE
header, plus an untrusted control), TestAPISSECMultipartReplicaRoundTripWith
Compression, and TestPutReplicationOptsRejectsCompressedSSEC fail on main
and pass with the fix on ErasureSD and Erasure; the replication-trust,
multipart and PutObject suites stay green. Compatibility: no wire, API or
metadata change; the destination change applies only to trusted replica
writes carrying a source seal; replicas already transformed must be
rewritten from an intact source (see #120 for why a resync does
not do that yet).

Fixes #109

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe
Signed-off-by: Feng Ruohang <[email protected]>
…elper

The raw SSE-C seal headers moved from an inline slice in
cmd/object-multipart-handlers.go to the shared isRawSSECReplica helper
in cmd/replication-trust.go (already recorded), so regenerate the
compat-baseline allowlist to drop the three stale object-multipart
entries. No behaviour change; make rebrand-guard is green.

Refs #109

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L7qJqWwy8oFA6aCXWRzXQe
Signed-off-by: Feng Ruohang <[email protected]>
@Vonng
Vonng merged commit 32e75c2 into main Sep 6, 2026
9 checks passed
@Vonng
Vonng deleted the fix/issue-109-raw-ssec-replica branch September 9, 2026 11:42
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.

[P1] SSE-C replicas become unreadable with destination default encryption or compression

1 participant