Repository navigation
Description
Problem
Object-version retention and legal-hold metadata are removed before the replication CopyObject handler checks incoming timestamps. The check is inside the branches for nonempty values, so an empty or absent incoming value can erase newer state. A retention removal also fails to persist its source timestamp, allowing delayed older retention to reappear.
Reproduction
Both cases use the normal metadata-replication request shape: an explicit object version, replica request markers, x-amz-tagging-directive: REPLACE, source timestamps, and the default metadata directive COPY. Signed-handler tests reproduce both cases on ErasureSD and Erasure, on both releases.
- Store GOVERNANCE retention through 2030 and legal hold ON, both timestamped 10:00. Apply an independent replicated tag update carrying an older retention removal timestamped 09:30 and no legal-hold value. CopyObject returns 200, but the newer retention and hold disappear. They should survive.
- Start with retention timestamp 09:00. Apply retention removal timestamped 10:00. The target clears the value but retains timestamp 09:00. A delayed retained value timestamped 09:30 then restores GOVERNANCE. The newer removal should remain authoritative.
The normal sender reads retention/hold source timestamps independently of the current values in cmd/bucket-replication.go; this is a reachable ordinary replication sequence.
Cause and minimal repair
The retention branch and hold branch skip ordering when incoming values are empty. The old path traces to c4373ef290344fd01981864cb9feca9410cf5b21. The interval fix f4c1286c9dfd882384dad74667b639b93f66b418 repaired nonempty ordering but omitted these cases.
Compare source timestamps for each field before deciding whether to set or remove its value. Preserve newer stored values for older/unknown input, and persist the source timestamp of a newer removal even when the value is empty.
Acceptance
- Older empty/absent replication state cannot clear newer retention or hold.
- Newer retention removal persists its timestamp and prevents an older retained value from returning.
- Existing nonempty ordering tests continue to pass on both object-layer backends.
Related: #77 concerns bucket-level ObjectLockConfig selection/heal, where nil has a different contract. This issue concerns per-object-version retention/legal-hold in CopyObject and needs its own focused fix.
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-111(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 — #111 (Claude ⨯ Codex consensus, 2026-09-05)
1. Verdict
Confirmed. Both reported cases reproduce on current main
f0bd164b9;git diff 9b11dc946..f0bd164b9overcmd/object-handlers.go,cmd/bucket-object-lock.go,cmd/bucket-replication.go,internal/bucket/object/lock/lock.goandinternal/http/headers.gois empty, so the reviewed code is unchanged. I ran the Codex repro in a detached worktree at main:TestReviewReplicaAbsentLockFieldsPreserveNewerStateandTestReviewReplicaRetentionRemovalKeepsOrderingTimestampfail on ErasureSD and Erasure, reporting the storedGOVERNANCE, retain-until date and holdONas"", and the removal keeping the stale09:00timestamp. I also wrote a third probe using the exact shape a real sender emits after a retention removal, headers present with empty values rather than absent, and it fails on main the same way, so both wire shapes are affected. One refinement to the issue text: the empty-value blind spot is older thanc4373ef29. That commit added the replica timestamp path, but the enclosingretentionMode.Valid()/legalHold.Status.Valid()gate came in with upstream43a3778b4(minio#9259);c4373ef29and the SILO interval fixf4c1286c9both stayed inside that gate.2. Root cause
cmd/object-handlers.go:1708deletes the three public Object Lock value keys from the rebuilt metadata (FilterObjectLockMetadata(..., true, true)atinternal/bucket/object/lock/lock.go:606-613, which touches only the value keys and leaves the internal timestamps alone), andcmd/object-handlers.go:1715and:1732only put a value back insideretentionMode.Valid()andlegalHold.Status.Valid(). A replica request whose source no longer carries a value therefore never reaches the ordering comparison: the stored state stays stripped and is lost, whatever the timestamps say.checkPutObjectLockAllowedreturns an invalid mode withErrNonefor both shapes a replication sender produces for "no retention": headers absent (cmd/bucket-object-lock.go:322, thereplicaTrustedearly return) and headers present but empty (cmd/bucket-object-lock.go:313-317, where theErrObjectLockInvalidHeadersfromParseObjectLockRetentionHeadersis deliberately swallowed for a trusted replica). Both shapes are ordinary:cmd/object-handlers.go:3208-3216records a retention removal as empty mode plus empty date plus a fresh timestamp,getCopyObjMetadataatcmd/bucket-replication.go:715-754copies those empty values into the CopyObject metadata map, and minio-goapi-compose-object.gocopyObjectDodoesheaders.Set(k, v)for every entry, so the empty header goes on the wire. Second defect: when the removal does win, no timestamp is written either, socmd/bucket-object-lock.go:370olderThanlater sees an unparseable stored timestamp and lets any older retained value back in.3. Minimal fix
cmd/object-handlers.goCopyObjectHandler, the two blocks at:1715and:1732, plus the two restore helpers atcmd/bucket-object-lock.go:388and:399. Decide each field on the source timestamp first and the incoming value second, and move the timestamp restore in each helper ahead of its early return on an empty stored value. The non-replica path is untouched. ~35 changed lines of product code, S.dstOpts.ReplicationSourceRetentionTimestampdecides the winner. A stale or timestamp-less update restores the stored state, so absent-and-unordered means unknown rather than removed;olderThanatcmd/bucket-object-lock.go:370-377already refuses to let a zero source timestamp win. A newer update applies, and a removal is simply a newer update with no value: the value stays cleared and the source timestamp is persisted, so a delayed older retained value can no longer resurrect. Legal hold uses the same ordering but only a valid incomingON/OFFcan win; anything else restores the stored hold. That asymmetry is deliberate and is the one place the two fields must differ. S3 has no legal-hold removal: an explicitly empty hold header is already rejected as an invalid status (internal/bucket/object/lock/lock.go:515-517, surfaced atcmd/bucket-object-lock.go:298-302), so the only value-less shape that reaches the branch is an absent one, and an absent status conveys no legal-hold change even when an orphaned timestamp arrives with it.PutObjectLegalHoldHandleratcmd/object-handlers.go:3044always writes a validatedON/OFFtogether with its timestamp, so an object damaged by this bug is the one thing that carries a hold timestamp with no status, and a uniform rule would let that damage clear a healthy hold elsewhere. The restore helpers now put the stored timestamp back even when the stored value is empty, which matters under the REPLACE metadata directive:replicationToInternalHeadersatcmd/handler-utils.go:106does not map the reserved lock timestamps, so under REPLACE the helper is the only thing that can carry a stored removal timestamp forward. This matches upstream MinIO's per-field last-writer-wins model onX-Minio-Source-Replication-Retention-TimestampandX-Minio-Source-Replication-LegalHold-Timestamp, and it matches S3, wherePutObjectRetentionwith an empty mode is the documented way to drop retention on aGOVERNANCEobject.ObjectLockConfigselection and heal, which is Audit site-replication source timestamps, tombstones, and per-site counters #77 and has a different nil contract.PutObjectHandleratcmd/object-handlers.go:2186, which writes a whole new version from the request and records no lock timestamps at all, so ordering between a full-object replica PUT and a metadata CopyObject stays as inherited from upstream.PutObjectExtractat:2646, which only creates new objects. The pre-existing asymmetry ingetReplicationActionatcmd/bucket-replication.go:977-1024, where a source holding an emptyx-amz-object-lock-modenever compares equal to a target that has the key deleted, so a removed-retention object is re-sent on every replication evaluation; that is unchanged by this fix and belongs to its own issue. The fact thatstoredObjectLockStatereads the source object's metadata, which is correct for replication because the sender copies an object onto itself atcmd/bucket-replication.go:1582but would be the wrong object for a hand-made cross-object copy carrying replication headers. And any change to the sender or to the wire format.4. Tests
cmd/replication-trust_test.gonext toTestAPICopyObjectReplicaLegalHoldTimestamp, renamed off theTestReviewprefix (suggestTestAPICopyObjectReplicaAbsentLockFieldsPreserveNewerStateandTestAPICopyObjectReplicaRetentionRemovalKeepsOrderingTimestamp). They run underExecObjectLayerAPITeston ErasureSD and Erasure and use signed V4 requests with the production replica shape. Add three cases they do not cover, all written and measured in the prototype (/Users/vonng/pgsty/silo-codex-triage-20260905/silo-111/tests/review_object_lock_replication_probe_test.go):x-amz-object-lock-mode/x-amz-object-lock-retain-until-datepair, once newer and once stale, since that is what a real sender emits afterPutObjectRetentionremoval;ONand its timestamp are preserved.Every case asserts mode, retain-until date and retention timestamp together, and the Codex removal test should be extended the same way: it currently checks only the mode after the stale retained update is rejected.
TestAPICopyObjectReplicaLegalHoldTimestamp,TestAPICopyObjectHandler,TestAPICopyObjectPartHandler,TestAPICopyObjectReplicationHeaderPoisoning,TestAPICopyObjectMetadataOnlyNullVersion,TestAPICopyObjectMarkerOnlyDoesNotCopyCiphertext,TestAPIPutObjectReplicationTrust.5. Compatibility, risk, rollout
No API, wire or configuration change: the same headers are read, none is added, and no stored field changes meaning. The source timestamps are read only for a trusted replication peer (
cmd/object-api-options.go:372-376) and an unparseable one is already a 400 rather than a silent zero (:387-399), so no new client-reachable surface appears. Mixed-version replication is safe in the direction that matters. A 0806 peer runs the same sender: the metadata replication branch fromapplyAction:to thec.CopyObjectcall incmd/bucket-replication.gois byte-identical between main and thesilo-state-baseline0806 worktree, so it emits the same timestamps; and a field that arrives with no source timestamp is unordered, so it now preserves whatever the destination holds, which is exactly what protects a destination carrying its own retention or hold. During a rolling upgrade an un-upgraded receiver keeps the old erasing behaviour until it restarts, so the fix converges node by node with no coordination. Objects already damaged by the bug are not repaired: a hold or retention already dropped on a replica must be re-applied at the source, which then replicates normally, andmc replicate resyncis the existing tool for that. One deliberate side effect: when a newer replica retention update carries no value, the destination now stores the ordering timestamp with no value, the same shape a localPutObjectRetentionremoval already leaves behind.6. Cost
S: ~35 changed product lines across two files, ~290 test lines (113 for the two adopted Codex tests, ~180 for the three added probes; the probes can be trimmed and merged into one table-driven test if the reviewer prefers). No dependency on other issues; #77 is separate and must not be bundled. Server-side only, no mcli or SDK work. One engineer, well under a day including review.
7. Consensus with Codex
Rounds used: 2/3. CONSENSUS: YES in round 2, on all five dimensions.
Agreed: validity, root cause, fix approach, test plan, scope and minimality. Codex confirmed my reading of its own repro, that absent and present-empty retention must have equivalent semantics after validation, and that no live integration gate is needed.
Amendments accepted from Codex, all four: (1) the asymmetric legal-hold rule, on its orphaned-timestamp argument, which I verified and had independently reached; (2) test coverage under the REPLACE metadata directive plus an absent-legal-hold-with-newer-timestamp case, since the Codex repros use COPY and therefore never exercise the restore helpers; (3) two wording corrections, that
FilterObjectLockMetadatadeletes only the public value keys and that a timestamp-less incoming field preserves destination state rather than there being "nothing to erase"; (4) assert the retain-until date alongside the mode and the stored legal-hold timestamp under REPLACE, and drop the claim that a value-less hold update is "only ever the residue of this bug" since ordinary absence also exists.Rejected suggestions: none. Codex proposed no scope creep.
Open disagreements: none. Codex notes, correctly, that it verified the prototype by reading it and did not rerun the tests itself; every test result quoted here is from my runs in a detached worktree at
f0bd164b9.Appendix A — prototype diff
Product code only; the review tests are not part of it. Full file:
/Users/vonng/pgsty/silo-codex-triage-20260905/silo-111/plan.diff.Measured on ErasureSD and Erasure in a detached worktree at
f0bd164b9, singlego testinvocation,-count=1:TestReviewReplicaAbsentLockFieldsPreserveNewerStateFAIL,TestReviewReplicaRetentionRemovalKeepsOrderingTimestampFAIL, present-empty probe FAIL on both backends.TestAPICopyObjectReplicaLegalHoldTimestamp, and the six neighbouring CopyObject and replication-trust tests from §4.ok github.com/minio/minio/cmd 5.523s.Vonng commentedon Sep 5, 2026
Fix record (2026-09-05)
Status: implemented, reviewed, awaiting merge. Pull request: #129 (branch
fix/issue-111-object-lock-replica-ordering, commitb2dca43fd, based on mainf0bd164b9).Change (
cmd/object-handlers.go,cmd/bucket-object-lock.go,cmd/object-api-options.go). The retention and legal-hold blocks inCopyObjectHandlerbecome switches keyed on the per-field source timestamp: newer update applies; newer removal clears the value and persists its timestamp; stale or unordered update restores the stored state; legal hold requires a valid incoming status. The restore helpers write the stored timestamp before their early return.Three deviations from the plan's prototype, each required by the adversarial review and each with a regression test: (1)
putOptsFromHeadersnow carries the parsed lock timestamps on the SSE-KMS branch, which had dropped them, so replicated updates are ordered on an SSE-KMS-default destination; (2) for a trusted replica an SSE-C key rotation's reserved-metadata snapshot is reconciled with the lock decision so the merge cannot reinstate the old timestamp; (3) the new value-less handling applies only to actual trusted replicas, not to marker-only authenticated requests, which keep their previous behaviour.Tests. The two adopted Codex repros plus probes for present-empty removals, the REPLACE directive, an orphaned legal-hold timestamp, the SSE-KMS destination and the marker-only request; red on main, green with the fix on both backends;
TestAPICopyObjectReplicaLegalHoldTimestampand neighbouring CopyObject tests stay green; gofmt, go vet and golangci-lint clean.Adversarial Codex review (gpt-6-astra). Round 1: FAIL, three MAJOR (SSE-KMS timestamps dropped; SSE-C rotation merge reinstating the old timestamp; marker-only requests inheriting source lock state). All three fixed with regressions. Round 2: PASS, one optional NIT on a test comment, applied.
This branch is the base for #120 (SSE-C replica retransmit), whose PUT/multipart path reuses this lock-ordering semantics.
Vonng commentedon Sep 6, 2026
Merged — record complete (2026-09-06)
Merged via #129 (merge commit
885ca604a) 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: order value-less replicated Object Lock updates by timestamp
fix: retransmit and re-order Object Lock for SSE-C replicas (single e…
fix: retransmit and re-order Object Lock for SSE-C replicas (single e…