Skip to content

[P1] Existing SSE-C replicas cannot always be updated or repaired #120

Closed

Description

@Vonng

Independent verification update — 2026-09-06, round 2

The within-scope P1 recovery gap is verified fixed at #134 79ca3659652ec452fcc764544a467fda31f4fafe; keep open until merge. A fresh two-site TLS test reproduced the old published binary's damaged SSE-C replicas, then upgraded destination before source while preserving data and VersionIDs. The candidate repairs single-PUT replicas under destination default SSE-S3 and compression, and compressed multipart replicas. The already-readable default-SSE multipart control remains correct. All four plaintexts match their source, the original VersionIDs are preserved, wrong customer keys are rejected, and subsequent tag updates propagate.

The #136 final-counter flush fix is verified separately. A distinct remaining false-success accounting defect is now tracked in #139: when an existing replica rejects an update, its successful HEAD can still produce Completed / zero failures. Therefore resync status alone is not recovery acceptance; verify source replication status and destination data/metadata. Multi-pool Object Lock authority remains #133.


Problem

Every replication path except the first upload asks the target HeadObject before deciding what to
send. That HEAD carries no SSE-C customer key, so for an SSE-C object the target answers
400 InvalidRequest. The sender maps that answer to a metadata-only CopyObject, which the target
also rejects. The result is that once a non-empty SSE-C replica exists, tag, retention,
and legal-hold changes on the source do not reach it, a heal after a transient failure does not
retransmit, and mc replicate resync neither repairs the replica nor reports honestly, because a
second keyless HEAD counts every SSE-C object as a resync failure. First-time replication of a new
SSE-C PUT is unaffected, and a replica that is missing on the target is still healed correctly,
because a missing object answers 404 NoSuchKey. Two further shortcuts sit behind the first one: a full retransmit of
a multipart SSE-C object is rejected by the destination's duplicate version and ETag
precondition, and the sender converts that rejection into success, so no part is ever sent. All of
this is inherited from upstream: upstream/master is byte for byte identical at the lines below.

Reproduction and evidence

Two new signed-handler tests, ErasureSD and Erasure, versioned bucket, SILO main f0bd164b9, replay
the exact requests the replication sender issues.

TestAPISSECReplicationTargetHead:

Request the sender makes Observed on main
Keyless HEAD, sender headers only 400 InvalidRequest, "The object was stored using a form of Server Side Encryption..."
Keyless HEAD on a missing key 404 NoSuchKey, which is why a missing replica still heals
Keyless HEAD plus the internal replication marker 200, Content-Length = plaintext size, ETag = last 32 bytes of the sealed ETag
Metadata-only CopyObject built from getCopyObjMetadata, replica trusted, no key 400 ExcessData
The same CopyObject on a zero-byte SSE-C object 200, because there is no data for the reader to overrun

TestAPISSECReplicaWriteDuplicateVersionShortcut replays the full retransmit against a replica that
already carries the source version and ETag. The single-part PUT returns 200 and the write lands,
the zero-byte PUT likewise, and the multipart NewMultipartUpload returns 412 PreconditionFailed,
which cmd/bucket-replication.go:1650 turns into nil. In every case tested the object survived
unchanged: a GET with the customer key still returned the source plaintext.

Cause and minimal repair

On main f0bd164b9, cmd/bucket-replication.go:1461-1467 builds the target HEAD with no SSE-C key
and no internal replication marker, so cmd/encryption-v1.go:1029 rejects it. The sender then hits
cmd/bucket-replication.go:1502-1506, whose two assignments are both dead: line 1537 overwrites
rinfo.ReplicationAction with rAction, still replicateMetadata from line 1361, and line 1540
routes any action other than replicateAll into the metadata-only CopyObject at line 1582. That
copy is admitted by the trusted-replica exemption at cmd/object-handlers.go:1468, but the source
checksum cannot be decrypted, so a server-side CRC-64NVME is requested
(cmd/object-handlers.go:1602-1607), which clears metadataOnly (:1809-1811) and turns the
metadata copy into a data rewrite whose reader is sized from the decrypted size (:1560-1561,
:1646) while ReplicationRequest forces NoDecryption (cmd/erasure-object.go:257-259); the
reader overruns and line 1583 records replication.Failed. Forcing replicateAll instead is not
sufficient on its own: cmd/object-handlers-common.go:194-200 rejects a write whose PreserveETag
and VersionID both match, and only the single-part sealed ETag is truncated before that comparison
(cmd/encryption-v1.go:1051), so multipart SSE-C replicas match and are skipped. Introduced by
upstream ad04afe38 (2024-06-12, "Fix SSEC multipart checksum replication (minio#19915)").

Minimal repair, three hunks in two files. At cmd/bucket-replication.go:1502-1506 set
rAction = replicateAll in place of the two dead assignments, so an SSE-C replica that cannot be
described is retransmitted rather than metadata-copied. At cmd/object-handlers-common.go:194-200
exempt a trusted SSE-C replica write from the duplicate version and ETag rejection, so that
retransmit actually lands for multipart as well. At cmd/bucket-replication.go:3000-3005 set the
internal replication marker on the resync accounting HEAD when roi.SSEC; this corrects an SSE-C
accounting false negative only and is not evidence that anything was retransmitted. Out of scope:
adding the marker to the deciding HEAD at line 1461, which would also need the SSE-C ETag comparison
in getReplicationAction fixed to be worth anything; making the target accept a keyless
metadata-only copy; and general replication outcome accounting. The accepted cost is that every
update of an SSE-C object now retransmits its bytes. Size S, +25/-7 product lines.

Acceptance

  • An existing SSE-C replica is retransmitted, not metadata-copied, on heal, existing-object, and metadata replication, single-part and multipart, and the run reports Completed.
  • A tag, retention, or legal-hold change on an SSE-C source object reaches the target, asserted on the destination metadata and not only on the status, and the replica still decrypts to the source plaintext with the customer key.
  • A multipart SSE-C replica upload over a matching version and ETag is no longer answered with 412, and the parts are actually sent.
  • The destination exemption is keyed on the incoming write, not the stored object: an incoming non-SSE-C replica write over an SSE-C destination is still rejected, and an incoming SSE-C replica write is exempted whatever the destination holds.
  • Non-SSE-C behaviour is unchanged, including the replicateNone and replicateMetadata paths, ordinary duplicate version and ETag rejection, and explicit If-Match and If-None-Match.
  • mc replicate resync on an SSE-C bucket reports replicated objects as replicated.
  • A destination that rejects the internal marker still behaves as before: the accounting HEAD fails and the object is counted as failed, with no change to the deciding path.
  • Bounded recovery check for the [P1] SSE-C replicas become unreadable with destination default encryption or compression #109 damage, run once before any recovery instruction is published, covering single-part and multipart objects: two TLS sites, one bucket pair with destination default SSE-S3 and one with destination compression; damage the replicas, deploy the [P1] SSE-C replicas become unreadable with destination default encryption or compression #109 destination fix first, then show that (a) resync alone now retransmits and the destination GET with the correct key returns the source plaintext, and (b) deleting the damaged destination versions and resyncing also produces a correct replica, with a wrong key refused in both cases.

Deployment

The fix requires changes on both the sender and the destination. The sender change alters dispatch
and resync accounting; the destination exemption is what lets a multipart retransmit replace an
existing replica; and #109's destination fix must be deployed first, or a retransmitted replica is
transformed again the same way. Publish no recovery instruction until the bounded check in the acceptance list has run.

Related

Follow-up to #109, whose fix plan withdrew the resync recovery recipe because of this defect.
Upstream minio/minio carries the identical code. AWS documents that an
SSE-C replica is retrieved with the same customer key the source object used, so the destination
cannot decrypt or re-encrypt the body on its own.

Versions and verification

Found during the 2026-09-05 fix-plan triage of #109 on main f0bd164b9 (release
RELEASE.2026-09-03T13-18-01Z / 9b11dc946 for SILO, RELEASE.2026-09-03T07-13-05Z / a2ef95c0
for mcli). Verified by reading the sender path on main and by two new signed-handler tests that
replay the sender's exact HEAD, CopyObject, PUT, and multipart requests against a versioned bucket
on both backends; the sender-side decision itself was traced in code rather than exercised end to
end. Discussed with the Codex reviewer (gpt-6-astra) over three rounds; see the consensus record.

Activity

  1. added
    bug
    on Sep 5, 2026
  2. Vonng commented on Sep 5, 2026

    @Vonng
    MemberAuthor

    Progress record and escalation (2026-09-05)

    Status: not merged. Three Codex rounds; one MAJOR finding remains, escalated to the maintainer. Branch fix/issue-120-ssec-replica-retransmit (commit 6fd1d7211, stacked on the #111 branch b2dca43fd), not pushed.

    What is done and Codex-clean. The core of this issue — making an existing SSE-C replica retransmittable and repairable — plus three of the four round-2 findings:

    • Dispatch: replicateAll selects a full retransmit when the keyless SSE-C HEAD cannot answer, instead of a metadata CopyObject that fails on any non-empty SSE-C object; putReplicationOpts errors now report Failed, not a phantom Completed.
    • The duplicate version+ETag exemption is keyed on the incoming SSE-C replica write, so a multipart retransmit is no longer swallowed by 412.
    • The resync accounting HEAD carries the internal marker for SSE-C objects.
    • A removed retention is sent as a value-less update carrying its ordering timestamp, and putReplicationOpts now emits that timestamp whenever the reserved key is present (round-2 finding 4).
    • A transient destination read error propagates instead of being read as "no lock" (round-2 finding 2).
    • A marker-only, non-replica PUT/MPU keeps ordinary write semantics and no longer loses a validated legal hold or default retention (round-2 finding 3, a regression the ordering helper had introduced).

    The remaining MAJOR (Codex round 3), which needs your decision. #120 newly enables re-writing an existing SSE-C object version on the destination via a full PUT or multipart upload. Lock ordering is decided in the handler (read the destination version's lock state, order the incoming update against it), but the write commits later — for multipart, after the whole upload. So in active-active replication, if a newer legal hold ON@10:00 reaches the destination version after a retransmit was initiated with OFF@09:00, the retransmit's completion can roll the hold back to OFF. That is a WORM / legal-hold correctness gap. It is narrow (needs active-active, SSE-C, and a concurrent lock update landing inside the retransmit window) but legal hold is exactly what must never be silently dropped.

    Codex's smallest sufficient fix: perform the final lock-state comparison and merge under the namespace write lock that protects the version replacement, at the SSE-C replica PUT and multipart-completion paths (a general CopyObject refactor is not required). That is a cross-layer change into the erasure PutObject / CompleteMultipartUpload commit path, beyond this issue's minimal subject; the handler-level ordering here matches the bar Codex accepted for #111's CopyObject, but Codex distinguishes #120 because the multipart window spans the whole upload rather than a short handler operation. I agree the gap is real.

    Options (maintainer's call):

    1. Authorise the commit-time merge under the write lock for the SSE-C replica PUT and multipart-completion paths (closes the gap; a larger, carefully-locked change and further Codex rounds).
    2. Accept the retransmit fix now with the handler-level ordering, document the active-active legal-hold race as a known limitation, and file a separate follow-up issue for the commit-time merge.

    My recommendation: option 1, because the gap is a legal-hold rollback. The three fixed findings and the retransmit mechanics are ready either way. The escalation is on this one point.

  3. Vonng commented on Sep 5, 2026

    @Vonng
    MemberAuthor

    Escalation update (2026-09-06): the multi-pool lock-safe reconcile is unbounded

    Following the maintainer's authorisation to do the commit-time Object Lock merge under the write lock, three further Codex rounds (4, 5, 6) each confirmed the same-version SSE-C retransmit is lock-safe on a single erasure set, but each surfaced a new way it is not lock-safe across multiple server pools:

    • Round 4: the in-lock read searched only the receiving set; a version in another pool was missed.
    • Round 5: pinning the write to the version's owning pool is bypassed by the existing-upload shortcut and by pools excluded for decommission/rebalance, and never runs for uploads persisted before the fix.
    • Round 6 (final authorised round), three findings that together show the fix is a distributed-systems project, not a bounded change:
      1. The receiving set's lock is the wrong serialisation boundary: lock-metadata mutations take pool 0's namespace lock, so a retransmit holding pool 1's lock is not mutually excluded from a concurrent PutObjectRetention/LegalHold.
      2. Object ModTime does not identify the newest lock state (retention and legal hold carry independent ordering timestamps and can leave ModTime unchanged), so a resolver that picks one record by ModTime can return the older lock; the newest retention and legal hold can even live in different pools.
      3. A successful retransmit into pool 1 leaves the stale copy in pool 0, which normal reads still select on an equal-ModTime tie, so the update is invisible despite completing.

    The branch is +2212 lines over the #111 base. Findings 1-3 are largely general multi-pool duplicate-version behaviour (shared pool-layer locking, per-field timestamp resolution, cross-pool stale-copy retirement), not specific to SSE-C retransmit. Making them fully correct is well beyond this issue's minimal subject.

    Decision for the maintainer (the retransmit mechanics, exemption, accounting marker, putReplicationOpts removal, and the single-pool in-lock ordering are all Codex-clean):

    1. Narrow [P1] Existing SSE-C replicas cannot always be updated or repaired #120 to single-pool-correct — merge the retransmit + single-pool reconcile, document that a multi-pool active-active deployment can lose a concurrent lock update racing a retransmit, and file a separate issue for the multi-pool lock-safe reconcile (a general multi-pool replica-write correctness project). Recommended.
    2. Authorise the larger multi-pool project now (shared pools-layer lock across all lock mutations, per-field cross-pool timestamp resolution, cross-pool copy retirement), with more rounds and higher risk.
    3. Hold [P1] Existing SSE-C replicas cannot always be updated or repaired #120 entirely until the multi-pool reconcile is designed and built.

    The implementer's single-pool safety assessment is being attached; branch is at d900f40b7, not pushed, no PR.

  4. Vonng commented on Sep 6, 2026

    @Vonng
    MemberAuthor

    Fix record (2026-09-06): merged scope decided, PR open

    Status: implemented, reviewed (Codex PASS, round 8), narrowed to single erasure set per the maintainer, awaiting merge. Pull request: #134 (branch fix/issue-120-ssec-replica-retransmit, commit 9e39aad80, stacked on the #111 branch — merge #111 first).

    What ships. The SSE-C replica retransmit (dispatch + duplicate-version exemption + resync accounting marker + putReplicationOpts removal/timestamp), and Object Lock ordering for the full replica write done under the object write lock at commit time (PutObject / CompleteMultipartUpload re-read the addressed version on the receiving erasure set — empty persisted multipart VersionID normalised to null — and re-order per field, honouring removals; absent version keeps the write's accepted lock; read errors fail the write). Marker-only and non-replica writes keep ordinary semantics.

    Scope decision. Correct for a single erasure set (the default). The multi-pool authoritative reconcile (shared pools-layer lock serialising with metadata mutations, per-field cross-pool timestamp resolution, cross-pool stale-copy retirement) is a general multi-pool replica-write concern, deliberately deferred and tracked in #133.

    Adversarial Codex review (gpt-6-astra), eight rounds. 1-3: the ordering must survive a concurrent update (handler-level was insufficient); the maintainer authorised the commit-time write-lock merge. 4-6: drove out the multi-pool gaps (per-pool lock is the wrong boundary vs metadata mutations on pool 0's NSLock; object ModTime does not track per-field lock timestamps; a stale other-pool copy stays authoritative for reads) — establishing the full multi-pool fix is a distributed-systems project beyond this issue. The maintainer narrowed scope to a single erasure set. 7: a null-version completion looked up the latest version instead of the null version (fixed by normalising the empty persisted VersionID). 8: PASS, no findings.

    Tests. Single-set: multipart and PUT interleave (newer hold survives), null-version completion (preserves the null version, leaves the UUID version), retransmit, exemption, target-head, retention-removal round-trip; #111 suite and object-layer regressions green; gofmt, go vet, golangci-lint clean.

    Deployment. #109 (PR #122) first. Multi-pool limitation tracked in #133. No recovery instruction for #109-damaged replicas until the bounded recovery check runs.

  5. moved this from Backlog to In progress in Siloon Sep 6, 2026
  6. Vonng commented on Sep 6, 2026

    @Vonng
    MemberAuthor

    Independent functional review, 2026-09-06: #134 is not yet sufficient to close this issue.

    Reviewed server main e7d0e62f16ed8a2373a4e9f5c4639d62886c09f2, mcli main bec94e4ef47f63d978e57f19091506d2090bd6c6, and #134 at 9e39aad802f0d5a674648fb439411568bc5296c0. The live candidate was main + #134 in a disposable checkout, resolving only the duplicate rinfo.Err/Failed assignment conflict. No production fix was added to the candidate.

    P1: resync still cannot repair a destination-compressed single-PUT SSE-C replica.

    I ran two real TLS loopback servers with separate data directories and KMS keys configured, bucket replication with proxying disabled, the same SSE-C customer key on source/destination GETs, and both single-PUT and multipart objects. Damage was created using the published RELEASE.2026-09-03T13-18-01Z binary. The destination was upgraded before the sender, preserving both data directories and object VersionIDs.

    Existing replica main + resync main + #134 + resync
    Single PUT, destination default SSE-S3 unreadable correct plaintext
    Multipart, destination default SSE-S3 already readable control correct plaintext
    Single PUT, destination compression unreadable still unreadable: XMinioObjectTampered
    Multipart, destination compression unreadable (sio: unsupported version) correct plaintext

    The failing single PUT contains 196,608 plaintext bytes (b'SILO raw SSE-C recovery\n' * 8192), uploaded as single.txt; the source retains the correct plaintext. The sender logs unable to replicate ... The requested object was modified and may be compromised, and the destination GET with the correct key continues to fail after the resync has completed. Repeating the resync reproduces it. Deleting only the damaged destination VersionID in this disposable lab, then resyncing, restores the exact source bytes; that is a diagnostic control, not a general production recovery prescription.

    Root cause: PutObjectHandler installs opts.CheckPrecondFn whenever PreserveETag is set. That callback calls DecryptObjectInfo(&oi, r) before the new raw-SSE-C duplicate-version exemption in checkPreconditionsPUT. DecryptObjectInfo calls oi.DecryptedSize(). The old destination has compress(ciphertext) storage, so its stored length can be invalid as an encrypted stream. The replacement fails before it reaches the exemption. This is within the agreed single-pool scope; #133 does not explain or excuse it.

    The bounded fix needs to allow the authenticated raw replica replacement to reach commit without first requiring the damaged old body to have a valid decrypted length, while retaining explicit conditional headers and the commit-time Object Lock reconciliation. Add the destination-compressed single PUT to the regression tests, using a real source stream and an actually transformed old destination.

    Integration checks also need repair before merging #134.

    The full unchanged main suites passed independently: server 5,566 tests/subtests; mcli 406. Those green suites do not cover the failed recovery case above. Keep #120 open and hold #134 pending the repair and the bounded recovery rerun. #109's prevention fix can remain closed; this is its outstanding recovery dependency.

  7. changed the title [-][P2] An existing SSE-C replica is not updated or repaired: the target HEAD is keyless, the metadata copy fails on a non-empty object, and a multipart retransmit is silently skipped[/-] [+][P1] Existing SSE-C replicas cannot always be updated or repaired[/+] on Sep 6, 2026
  8. added 9 commits that reference this issue on Sep 6, 2026
    05fec4e
    eb197c6
    795eb7c
    79da38f
    79ca365
    8774691
    109d824
    34cbca9
    236e163
  9. moved this from In progress to Done in Siloon Sep 6, 2026
  10. Vonng commented on Sep 7, 2026

    @Vonng
    MemberAuthor

    Resolved by #134 (merged to main as 0af0907ef).

    Existing SSE-C replicas are now retransmitted (re-encrypted end to end) rather than metadata-copied, so an undecodable/compression-damaged replica can be repaired and Object Lock is re-ordered correctly on the replica. The single-PUT SSE-C overwrite path is no longer blocked by CheckPrecondFn running DecryptObjectInfo for a trusted raw-SSE-C replica write that carries no conditional headers.

    Merge note: during the rebase, the commit that made the old resyncBucket StatObject probe SSE-C-aware was dropped, because #139 (already on main) had replaced that entire probe-based classification with resyncResultFor(...), which reads the actual replication outcome and is encryption-agnostic. All core retransmit changes were kept.

    Verified: Codex adversarial review (2 rounds, including a live two-site test), 14 TestAPISSEC* tests + resync-classification tests green, full acceptance on merged main.

    Scope narrowed to a single erasure set; multi-pool replica-write Object Lock reconciliation is tracked in #133.

  11. self-assigned this
    on Sep 15, 2026
  12. added theissue type on Sep 15, 2026
  13. added this to the 20260916 milestone on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions