You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nothing stops a put under tenants/ outside AttachmentStorage.AddAsync, so the sweep can delete the object of a row saved later than the grace #536
Nothing stops code from putting an object under tenants/ outside AttachmentStorage.AddAsync. Only AddAsync bounds the time between the put and the save of the row by Attachments:AddTimeout. A put on another path that saves its row later than the grace gets its object deleted by the sweep while the row still names it.
ObjectSweepOptions.cs:31. The grace is AddTimeout + Margin, which is correct only for puts that obey AddTimeout.
ObjectStorage.PutAsync is public. Today AttachmentStorage.cs:38 is its only caller, so the gap is latent. The rule is only text in docs/backend/attachments.md.
Reproduction steps
Add a handler that calls ObjectStorage.PutAsync with a StoredFile.TenantsPrefix key, then waits longer than AddTimeout + Margin before it saves the row. A test can use a fake TimeProvider and a short Margin.
Run SweepObjects between the put and the save.
Save the row.
Expected
The build or a test refuses a put under tenants/ that does not go through AttachmentStorage.AddAsync, or the sweep cannot delete the object of a put still in progress.
Actual
The code compiles and the tests pass. The sweep deletes the object, and the saved row names an object that is gone.
Impact
Silent data loss in an app built from the template, for example a bulk import or a new upload path that puts the files first and saves the rows in one long transaction.
The review notes that a ban of ObjectStorage.PutAsync with RS0030 would also stop puts outside tenants/, which the sweep does not touch. One option is a separate put method for tenants/ keys that only AttachmentStorage can reach, so that the banned API is only that one.
Activity