Legal holds, step 4: freezing, release, and the audit log
Placing or widening a hold freezes what's already archived in its scope and range, its old deadline noted; releasing one gives each item no other hold covers that deadline back, or release plus 30 days if later. One pass over the archive does both and changes nothing twice (LH-6, LH-10, LH-11). A held archived item can't be destroyed; restoring still can, and the hold is named only to callers who may see holds (LH-7). Audit records about a held account survive the purge (AU-7). Fixes the daily clean-up of expired archived items (UD-13), which never found any: the registry's unfiltered query reads an all-ids index that archived items aren't in. Items are now walked account by account, kept deleted accounts included. Expired items were still removed whenever their account's archive was read.
This commit is contained in:
@@ -449,7 +449,16 @@ impl Server {
|
||||
pub async fn audit_purge(&self) -> trc::Result<usize> {
|
||||
let settings = log::settings(self.store()).await?;
|
||||
let cutoff = ms().saturating_sub(settings.keep_for_secs.saturating_mul(1000));
|
||||
log::purge(self.store(), cutoff, |_| false).await
|
||||
// LH-6, AU-7: a record about a held account stays while it's held.
|
||||
// Worked out before the purge, which can't wait on lookups.
|
||||
let held = self.held_accounts().await?;
|
||||
log::purge(self.store(), cutoff, |record| {
|
||||
record
|
||||
.target
|
||||
.account_id
|
||||
.is_some_and(|account_id| held.contains(&account_id))
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user