Repository navigation
Description
Problem
A normal single-PUT SSE-C object can reach source replication status COMPLETED while the replica cannot be read with the correct customer key. The replica PUT transforms the already encoded source bytes again using destination default encryption or compression. This affects replica usability during ordinary reads or site failover. The source objects remained intact in the tests.
Reproduction and results
- Start two SILO sites with TLS, a working test KMS, and normal site replication (
mcli admin replicate add). Enable compression with the default include list. - Create one bucket with default SSE-S3 and a second bucket with no default encryption. Wait for the bucket configurations to reach the peer.
- On the source, single-PUT
.txtobjects of 0, 1 and 131072 bytes, explicitly using SSE-C. Use the same customer key to verify source GET, then wait forCOMPLETED. - GET and HEAD the same object version from the destination using the correct customer key.
| Destination configuration | Input | Observed replica |
|---|---|---|
| Default SSE-S3 | 0 / 1 / 131072 bytes | GET fails with 400 InvalidRequest |
| No default encryption, compression enabled | 131072 bytes | GET returns an XMinioObjectTampered XML error; HEAD is unusable |
| No default encryption, compression enabled | 0 / 1 byte | Correct 200, matching bytes, REPLICA |
The default-encryption failure occurs with or without a customer key on the read. Real independent 0806 TLS sites reproduce the same matrix, so this is inherited behavior rather than a 0903 regression. The erroneous HTTP success status for the compressed failure is tracked separately from the bad replica write.
On-disk evidence for the 131072-byte no-default-encryption case: source physical size 131136, actual part size 131072, no compression marker; destination physical size 131154, actual part size 131136, with a new compression marker. The target compressed the source ciphertext. A default-SSE-S3 target also contains both SSE-C and SSE-S3 envelope metadata with a replaced shared IV.
Cause and minimal repair
After restoring replication metadata, the PUT path still applies default encryption, compression and encryption. Raw SSE-C replication was introduced by 468a9fae83e965ecefa1c1fdc2fc57b84ece95b0 without bypassing these destination transforms.
Recognize the existing validated raw SSE-C replica-write path and preserve the source byte encoding and envelope metadata, skipping destination default encryption and re-compression. Keep normal PUT behavior unchanged. After the fix, affected replicas need to be resynchronized from intact source versions; changing metadata alone does not repair already transformed bytes.
Acceptance
- Real TLS site-replication round trips retain exact bytes and readable versions for single PUT and multipart.
- Cover empty, small and above-compression-threshold objects, with destination default encryption and compression independently enabled/disabled.
- Preserve source-side compression metadata when the source actually used it.
- Source
COMPLETEDcorresponds to a replica readable with the original SSE-C key.
The incorrect HTTP 206 response for unreadable compressed replicas is tracked separately in #110; this issue fixes the replica bytes and metadata.
Versions and verification
Reproduced in the 2026-09-05 functional review on the published SILO release RELEASE.2026-09-03T13-18-01Z (9b11dc9469e650815b775cb47b039610644f5da4), with RELEASE.2026-08-06T00-00-00Z (3be10fcc1a44f6620ded0bd303461f9d688cca23) as the baseline. The reviewed code remains unchanged on current main f0bd164b92d799c026fb1a31ad8e0df8ecb39388. Product fixes have not been applied.
Activity
Vonng commentedon Sep 5, 2026
Fix plan prepared 2026-09-05 by Claude (Fable 5.1) and reviewed in 2 round(s) of dialogue with the Codex reviewer (gpt-6-astra) that filed this issue. Local paths under
/Users/vonng/pgsty/silo-codex-triage-20260905/silo-109(plan, prototype diff, tests, Codex transcripts) and/private/tmp/silo-mcli-review-20260905.MfP8W9(review evidence) live on the maintainer's machine, not in the repository.Fix plan — silo#109 (Claude ⨯ Codex consensus, 2026-09-05)
1. Verdict
Confirmed.
git diff 9b11dc946..f0bd164b9is empty for every file involved, so main and thereviewed release are identical and the line numbers below are main's. A raw SSE-C replica write
arrives with source ciphertext in the body and the source seal in
X-Minio-Replication-Server-Side-Encryption-{Sealed-Key,Iv,Seal-Algorithm}, but with no publicSSE-C request headers, so
crypto.Requested(r.Header)is false whenPutObjectHandlerconsults itand the destination applies its own default encryption and its own compression to bytes that are
already ciphertext. I wrote the unit reproduction the report says did not exist; it fails on
unpatched main on ErasureSD and Erasure with the reported symptoms. With destination default SSE-S3
the replica's
MetaIVno longer matches the source's,MetaSealedKeyS3andMetaKeyIDappear, thesize grows by a second DARE envelope and GET returns 400 InvalidRequest. With destination
compression the replica gains
X-Minio-Internal-compressionand GET fails onsio: unsupported version. One correction to the issue text: the multipart path is only halfaffected, because
NewMultipartUploadHandleralready exempts raw SSE-C replicas from key generation(
cmd/object-multipart-handlers.go:216-231) andPutObjectPartHandleralready skips re-encryption(line 966). The repro confirms that split: on main
mpu-default-sse-s3passes whilempu-compressionfails.2. Root cause
cmd/object-handlers.go:2091-2094and:2108on mainf0bd164b9.sseConfig.Applyreturns earlyonly when
crypto.Requested(headers)is true (internal/bucket/encryption/bucket-sse-config.go:136);for a raw SSE-C replica it is false, so Apply sets
X-Amz-Server-Side-Encryption, which makes thebranch at
cmd/object-handlers.go:2203runEncryptRequest. That seals a second layer and rewritesMetaIVandMetaAlgorithm(internal/crypto/metadata.go:31,35), which SSE-S3 and SSE-C share, sothe restored SSE-C sealed key can no longer be unsealed. Independently,
excludeForCompressiontests encryption only through
crypto.Requested(header)(cmd/object-api-utils.go:613), so thesame blindness stores
compress(ciphertext)while reads expectdecryptfirst. The same omissionsits at
cmd/object-multipart-handlers.go:292, where the stored compression flag drives every laterpart (line 880). Introduced by upstream
468a9fae83e965ecefa1c1fdc2fc57b84ece95b0(2024-03-28,"Enable replication of SSE-C objects (minio#19107)"), which added the raw-ciphertext replica path without
exempting it from the destination's existing PUT transforms. PR #101's trust model is not the
introducing change.
3. Minimal fix
Prototyped and validated; the diff is in Appendix A.
cmd/replication-trust.go(+25): addssecReplicaSealHeaders(the threeX-Minio-Replication-Server-Side-Encryption-*names, already listed at lines 105-107) andisRawSSECReplica(h http.Header, replicaTrusted bool) bool, which returns false unlessreplicaTrustedand at least one seal header is non-empty. Trust first, headers second: theheaders alone are client controlled, and
replicaTrustedis whatevaluateReplicationTrust(line 78) produced after signature verification.
cmd/object-handlers.goPutObjectHandler(+17/-7): computerawSSECReplica := isRawSSECReplica(r.Header, replicaTrusted)after thereplicaTrustedblock at2077-2088; wrap 2091-2094 in
if !rawSSECReplica { … }; make 2108 readif !rawSSECReplica && isCompressible(r.Header, object) && size > minCompressibleSize; and gatethe encryption branch itself,
if !rawSSECReplica && crypto.Requested(r.Header)at 2203. SkippingApply is not sufficient on its own: a trusted peer that sends an explicit
X-Amz-Server-Side-Encryptionheader alongside a source seal would otherwise still reachEncryptRequest. Codex raised that case and it is real.cmd/object-multipart-handlers.goNewMultipartUploadHandler(+13/-19): compute the sameflag after line 181; wrap 184-187 in
if !rawSSECReplica; make 292 readif !rawSSECReplica && isCompressible(r.Header, object); replace the inlinessecRepHeadersslice and loop at 216-231 with the shared helper.
X-Minio-Internal-Encrypted-Multipartis notlost: it is replicated as
X-Minio-Replication-Encrypted-Multipartand restored at line 253,which runs before
maps.Copy(metadata, encMetadata)at 287.cmd/bucket-replication.goputReplicationOpts(+13): rejectisSSEC && objInfo.IsCompressed()with an error, and make the two callers report that honestly bysetting
rinfo.Errandrinfo.ReplicationStatus = replication.Failedat lines 1301 and 1588.Both currently return a status left at
Completedby lines 1294 and 1535. Without this, the fixwould turn a loud failure into a silently wrong replica for a compressed SSE-C source: removing
the destination transforms lets such a replica be stored as encrypt(s2(plaintext)) with no
compression marker, so a GET with the correct key returns 200 and an S2 stream. That holds for
default-encryption destinations too, not only compressing ones.
Size: M, +68/-26 lines of product code across four files (net +42).
The alternative predicate is
replicaTrusted && crypto.SSEC.IsEncrypted(metadata)after the restoreat
cmd/object-handlers.go:2078, which needs no new helper. I chose the header form because themultipart handler must decide at line 181, before its own restore at line 253, and already carries
the same header list inline; one shared helper keeps the two paths from drifting apart.
Behaviour after the fix. A validated raw SSE-C replica is stored byte for byte as the source
wrote it, with the source seal intact, so a GET on the destination with the customer key returns the
same plaintext as the source whatever default encryption or compression the destination bucket has
configured. This is the semantics upstream minio#19107 intended, and it matches what AWS documents for
SSE-C replication: the replica is retrieved with the same customer key the source object used. The
destination holds no key, so it can neither decrypt nor re-frame the object. Ordinary client PUTs
and multipart uploads are untouched, including a client that presents real SSE-C headers, which
never satisfies
isRawSSECReplica.Explicitly out of scope.
CopyObjectHandler(cmd/object-handlers.go:1323) andPostPolicyBucketHandler(:2487).Replication never uses either for object data and neither receives the seal headers.
PutObjectPartHandlerandCompleteMultipartUploadHandler, which already derive both decisionsfrom the stored upload metadata (
cmd/object-multipart-handlers.go:880,966).compression allow_encryption=onon the source. This plan rejects such objects; it does nottransport them.
putReplicationOptsdropsX-Minio-Internal-compressionandX-Minio-Internal-actual-size(cmd/bucket-replication.go:786-788), so the destination cannotreconstruct the framing, and carrying it needs new wire headers with mixed-version rules.
Correction to my first draft, from Codex: the multipart path does transport the aggregate actual
size, via
cmd/bucket-replication.go:1731intocmd/erasure-multipart.go:1435; it is thecompression marker that is missing.
4. Tests
All three tests below are written and run; there was no unit repro for this finding before.
TestAPISSECReplicaSkipsDestinationTransforms, to live incmd/replication-trust_test.go,under
ExecObjectLayerAPITestso ErasureSD and Erasure. It writes a real client SSE-C object,reads it back with
GetObjectNInfo(..., ReplicationRequest: true)and builds the replica headersfrom
putReplicationOpts(...).Header()rather than by hand, so the wire shape is the productionone. Six subtests per backend: single PUT under destination default SSE-S3, under destination
compression, and with an explicit
X-Amz-Server-Side-Encryptionheader added to the trustedreplica;
NewMultipartUploadunder the first two; and a control. The PUT cases assert thatMetaSealedKeySSEC,MetaIVandMetaAlgorithmstill equal the source's, thatMetaSealedKeyS3,MetaKeyIDandX-Minio-Internal-compressionare absent, that the stored sizeequals the ciphertext size, and that a GET with the customer key returns the source plaintext; the
multipart ones assert the same on the upload metadata via
GetMultipartInfo. The control sendsthe seal headers from a principal holding only
s3:PutObjectand with theREPLICAstatus headerremoved, then asserts ordinary transforms and that the seal is not smuggled into stored metadata.
The unprivileged-
REPLICA-is-403 case is already asserted atcmd/replication-trust_test.go:222; do not duplicate it.TestAPISSECMultipartReplicaRoundTripWithCompression: a real SSE-C multipart source, then thereplica upload, part and Complete with destination compression on, then a GET with the customer
key and a byte comparison. It also asserts
X-Minio-Internal-Encrypted-Multipartsurvives nowthat the
crypto.Requestedblock atcmd/object-multipart-handlers.go:200no longer runs forthese requests. One trap worth recording: the SSE-C sealed key is bound to bucket and object path
(
internal/crypto/key.go:98), so the replica must be written at the same key as the source or theGET fails with a masked 403.
TestPutReplicationOptsRejectsCompressedSSEC, a plain unit test overputReplicationOptsand
batchReplicationOpts: compressed SSE-C is rejected, while uncompressed SSE-C, compressedplaintext and plain objects stay accepted. The destination tests cannot cover the guard, since
their fixture asserts the source is not compressed.
cmd/replication-trust_test.go, the four replication tests incmd/handler-utils_test.go,TestObjectAPIPutObjectPart,TestAPIPutObjectHandler,TestAPINewMultipartHandlerandTestAPICompleteMultipartFullObjectVariants.-run '^TestReplicationTrust'matches almost noneof that file, so use the explicit list.
default SSE-S3 and one with destination compression including
.txt; PUT SSE-C objects of 0, 1and 131072 bytes on the source, single PUT and multipart; wait for COMPLETED; GET each replica
with the correct key and byte-compare, and confirm a wrong key is refused.
scripts/server_data_old_replication.pycovers single PUT with correct-key and missing-key GET;the multipart and wrong-key legs still need writing.
5. Compatibility, risk, rollout
No wire, API or metadata format change: the same headers are sent and the same metadata keys are
written, and the destination fix only removes transforms it should never have applied. State the
guarantees by endpoint, not by direction. Protection from the destination transforms comes from
upgrading the destination, whatever version the source runs. Rejection of a compressed SSE-C source
comes from upgrading the source, whatever version the destination runs. Upgrading both gives both;
upgrading only the source does not protect an unpatched destination. The blast radius of the
destination change is confined to requests that are both replica trusted and carrying a source seal,
which the control test pins.
Recovery is the sharp edge, and this plan does not close it. Replicas already written cannot be
repaired by any code change: the bytes were transformed and, in the default-encryption case, the
SSE-C IV was overwritten. Starting a resync does not establish that the corrupted version gets
rewritten. Resync runs
replicateAll, whose target HEAD is keyless and so fails on an SSE-C object;cmd/bucket-replication.go:1502-1505treats that failure as "the object exists" and setsreplicateNone, whichline 1537then overwrites withrAction, stillreplicateMetadata. Therun therefore proceeds into the metadata-only CopyObject at line 1582, which can itself fail. The
defensible statement is that source data is never guaranteed to be retransmitted, not that the
attempt is a clean no-op. Codex found this and I confirmed it on main. Deleting the affected replica
versions on the destination and then re-replicating is a plausible candidate, but it is unverified:
a bounded recovery check demonstrating the replacement and a correct GET must run before any
recovery instruction is published in the release notes or in the replication docs on
silo.pgsty.com. The keyless-HEAD shortcut deserves its own issue, since it also means an SSE-C
replica is never re-verified.
6. Cost
Effort M: +68/-26 product lines across four files, plus the tests, all already written. Server
only, no mcli, Console or SDK work. No ordering dependency on the other issues in this batch. #110
(unreadable objects return HTTP 206) explains why the live compressed replica GET surfaced as a 206
with an XML body while the unit repro sees a clean 500, so the two are complementary but
independent. Two follow-ups fall out of this work and should be filed separately: carrying source
compression state for compressed SSE-C objects over the replication wire, and the keyless target
HEAD at
cmd/bucket-replication.go:1502-1505that leaves an SSE-C replica never re-verified andnever retransmitted. The earlier inherited-debt item "trusted replication SSE-C GET without key
truncates the response" is a different mechanism: read side, in
getObjectHandler(
cmd/object-handlers.go:359-370, where a trusted marker setsopts.ReplicationRequestandcmd/erasure-object.go:257-259then forcesNoDecryption), and about response framing rather thanwhat is stored. This fix neither causes nor repairs it.
7. Consensus with Codex
Rounds used: 2/3. Codex answered CONSENSUS: YES in round 2, agreeing on validity, root cause,
fix approach, test plan and scope, with no remaining disagreements.
Round 1 was CONSENSUS: NO: Codex agreed on validity, root cause and my multipart correction, and
disagreed on fix approach, test plan and scope. I verified all five objections against main and
accepted every one; none was rejected.
cmd/object-handlers.go:2203itself, not only thesseConfig.Applythat normally feeds it, since a trusted peer sending an explicitX-Amz-Server-Side-Encryptionheader alongside a source seal would otherwise still re-encrypt.Now the
explicit-sse-headersubtest: red on main, green with the gate.report a
putReplicationOptsfailure asCompleted. Without this the fix would convert a loudfailure into a silently wrong replica, on default-encryption destinations as well as compressing
ones. This was the objection that changed the design.
unprivileged-
REPLICA-is-403 half is cited fromcmd/replication-trust_test.go:222rather thanduplicated, which Codex confirmed is sufficient.
replicateAll's keyless target HEAD fails on SSE-Cand the code then never retransmits the data.
actual size is not transported.
Round 2 returned four non-blocking amendments, all applied: add the source-guard test (now
TestPutReplicationOptsRejectsCompressedSSEC, red then green); state mixed-version behaviour byendpoint rather than by direction; sharpen the recovery text, since
replicateNoneset atcmd/bucket-replication.go:1504is overwritten byrActionat line 1537, so the honest conclusionis that source data is never guaranteed to be retransmitted rather than that the attempt is a clean
no-op; and refresh the appendix numbers, which were stale in the copy Codex was sent. Codex also
answered the open question: keep the compressed SSE-C guard in the shared
putReplicationOptsrather than scoping it to bucket replication, because
cmd/batch-handlers.go:1591alreadypropagates the error, the archive caller logs and skips option errors at line 622 rather than
failing whole jobs, and batch replication reads without a customer key at line 695, so a compressed
SSE-C source already fails earlier there.
Rejected suggestions and why: none. Open disagreements: none.
Appendix A — prototype diff
Product diff
/Users/vonng/pgsty/silo-codex-triage-20260905/silo-109/plan.diff, 4 files, +68/-26:cmd/replication-trust.go+25,cmd/object-handlers.go+17/-7,cmd/object-multipart-handlers.go+13/-19,cmd/bucket-replication.go+13. Tests/Users/vonng/pgsty/silo-codex-triage-20260905/silo-109/tests/review_20260905_ssec_replica_test.go, 556 lines.Before, on ErasureSD and Erasure: the
default-sse-s3,compression,explicit-sse-headerandmpu-compressionsubtests FAIL (12 subtests across both backends, 8 of them failing), plusTestAPISSECMultipartReplicaRoundTripWithCompressionFAIL andTestPutReplicationOptsRejectsCompressedSSEC/compressed-ssec-rejectedFAIL. Thempu-default-sse-s3anduntrusted-is-still-transformedsubtests PASS on main, which is whatestablishes the multipart split.
After: all PASS, with the existing tests listed in §4 green in the same run.
Vonng commentedon Sep 5, 2026
Fix record (2026-09-05)
Status: implemented, reviewed, awaiting merge. Pull request: #122 (branch
fix/issue-109-raw-ssec-replica, commitc52acc1a5, based on mainf0bd164b9).Root cause, as fixed. A raw SSE-C replica write carries the source ciphertext and the source seal only in the internal replication headers, so
crypto.Requested(r.Header)was false andPutObjectHandler/NewMultipartUploadHandlerapplied the destination's default encryption and compression on top (cmd/object-handlers.go:2091-2094,:2108,:2203;cmd/object-multipart-handlers.go:184-187,:292). Inherited from upstream468a9fae8.Change (4 files, +68/-26 product lines).
cmd/replication-trust.go:isRawSSECReplica(header, replicaTrusted), true only after the signature-verified trust evaluation and with a seal header present.cmd/object-handlers.go: single PUT skips bucket default encryption, compression and the encryption branch for such writes.cmd/object-multipart-handlers.go: multipart initiation skips default encryption and compression, and the inline seal-header loop is replaced by the shared helper.cmd/bucket-replication.go:putReplicationOptsrejects a compressed SSE-C source, andreplicateObject/replicateAllreport that asFailedwith the error instead of leavingCompleted. Out of scope, as agreed: carrying compression state over the wire (#118), repairing replicas already written and the resync gap (#120), CopyObject / PostPolicy / PutObjectPart / CompleteMultipart, which never receive the seal or already follow the stored upload metadata.Tests. New
cmd/replication-trust-ssec-replica_test.go:TestAPISSECReplicaSkipsDestinationTransforms(six subtests per backend, replica headers built fromputReplicationOpts(...).Header(); asserts source seal fields preserved, no SSE-S3 seal / KMS key id / compression marker, stored size equals ciphertext size, GET with the customer key returns the plaintext, untrusted control still transformed),TestAPISSECMultipartReplicaRoundTripWithCompression,TestPutReplicationOptsRejectsCompressedSSEC. Red on main exactly as the plan predicted (8 subtests plus the two tests), green with the fix; 17 neighbouring replication, multipart and PutObject tests stay green; go vet, gofmt and golangci-lint clean.Adversarial Codex review (gpt-6-astra). Round 1: PASS, no blocking findings; one optional finding (compare
MetaSealedKeySSEC,MetaIV,MetaAlgorithmwith the source in the multipart-init cases instead of checking presence) was applied before opening the PR. Residual risks it recorded: the plan's two-site TLS acceptance run is a pre-release item, not yet run; fixtures use unversioned buckets and one multipart part; the classifier validates authorization and replica intent, not seal validity (existing trusted-peer assumption); an old source can still send compressed SSE-C and a patched source cannot protect an old destination; per-partActualSizeon SSE-C replicas is a separate defect (#119); already-transformed replicas stay unrepaired (#118, #120).Still to do outside this change. Bounded two-site live check before release; release fix note; no recovery instruction in the docs until #120 is fixed and the bounded recovery check has run.
build: refresh rebrand compatibility baseline for the SSE-C replica h…
Vonng commentedon Sep 6, 2026
Merged — record complete (2026-09-06)
Merged via #122 (merge commit
32e75c27b) intomain. Supersedes the "awaiting merge" status above: main is green — siloe7d0e62f1, Go CI (Test cmd/, Test internal/, Race + S3 Select, Format/Build/Vet, Lint/Generated Files, Cross Compile) and VulnCheck all pass.Issue closed; fix record complete.
fix: store raw SSE-C replicas verbatim on the destination
fix: exclude SSE-C objects from compression
Vonng commentedon Sep 6, 2026
Independent review update, 2026-09-06: the destination-transform prevention in #122 and the new-write compression exclusion in #126 are appropriately scoped; keep this prevention issue closed.
The unchanged main
e7d0e62f1full suite passes (5,566 tests/subtests). A real two-server TLS recovery check also confirms the remaining deliverable boundary: main + #134 restores existing single-PUT replicas damaged by destination default SSE-S3 and multipart replicas damaged by destination compression, but a destination-compressed single-PUT replica still cannot be overwritten because old-object decrypted-size validation runs before the raw-replica exemption. Detailed reproduction and required follow-up are recorded in #120.Therefore “this prevention fix is merged” must not be read as “all existing #109-damaged replicas are repaired by resync.” Keep the recovery dependency open; no need to reopen or undo the correct prevention change here.
fix: retransmit existing SSE-C replicas instead of metadata-copying them
fix: repair an undecodable SSE-C replica on retransmit
fix: repair an undecodable SSE-C replica on retransmit
fix: retransmit existing SSE-C replicas instead of metadata-copying them
fix: repair an undecodable SSE-C replica on retransmit