feat(objectstore): S3 conditional writes to prevent silent overwrites#62473
Open
solracsf wants to merge 1 commit into
Open
feat(objectstore): S3 conditional writes to prevent silent overwrites#62473solracsf wants to merge 1 commit into
solracsf wants to merge 1 commit into
Conversation
solracsf
requested review from
Altahrim and
salmart-dev
and removed request for
a team
July 24, 2026 08:38
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
solracsf
force-pushed
the
feat/objectstore-conditional-writes
branch
from
July 24, 2026 09:48
d71a875 to
9beefe3
Compare
Member
Author
PHPunit failure does not seem related. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nextcloud stores each file's data as an object keyed by the file-cache auto-increment id (
urn:oid:<fileid>), so a newly created file always targets an object key that should not exist yet. When the file cache and the bucket drift out of sync, a DB restored from backup, two instances pointed at one bucket, or duplicated file ids, the current unconditional writesilently overwrites and destroys the existing object.
This adds opt-in S3 conditional writes: when enabled, creates send
If-None-Match: *so the store atomically refuses to overwrite an existing object, turning silent data loss into a loud, data-preserving failure.https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-writes.html
If-None-Match: *on single-PUT and multipart creates; 412 typed exception, bounded 409 retry, abort-safe multipart completion.ObjectStoreStorage::writeStreamuses it only for newly created files; on refusal it cleans up and logs a critical, actionable message (no data overwritten).conditional_writesconfig:false(default),'auto'(one cached bucket probe, enable only if enforced),true. Self-disables on SigV2.Compatibility
false, so upgrades are unchanged.Testing
Checklist
3. to review, feature component)stable32)AI (if applicable)