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
A new named query filter hides live rows from the object sweep, which then deletes their objects #538
The sweep loaders keep every query filter of the model. A new named query filter, for example an archive filter, hides its rows from the sweep, so the sweep deletes the objects of those live rows after the grace.
Where
Main at 3b7a3c7122b9a3dd4a18c66c85640be95913ce4a.
NamedStorageKeys.cs:54-58. The loader queries dbContext.Set<TEntity>() with all filters on. It keeps them on purpose, so that a soft-deleted row names no key and the Tenant filter scopes the system caller.
Add a named query filter Archived to the workshop attachment entity that hides rows with IsArchived = true.
Add an attachment, then set IsArchived = true on its row.
Move the clock past the grace (AddTimeout + Margin) with a fake TimeProvider, and run SweepObjects.
Read the object from the bucket.
Expected
The sweep keeps the object, because a live row names it. Or a test fails as soon as a filter that the sweep does not know is added.
Actual
The sweep does not see the archived row and deletes its object. Un-archiving the row then points at a missing file.
Impact
Silent, irreversible data loss in an app that adds a query filter, which is a common change. No test or build check catches it.
Source
The re-review finding about a new app query filter in the review comment of #526: #526 (comment)
Suggested fix
From the review: ignore each query filter in the loader and apply the soft-delete rule and the tenant scope in the loader itself, or add a test that fails on a filter name that the sweep does not know.
Activity