A legal hold placed over an account that was deleted while undelete still retains it did not freeze that account's already-archived mail.
settle_archive's item loop collapsed every gone account to keeping = None, so an ArchivedItem belonging to a since-deleted account kept its finite undelete deadline no matter which holds covered it. The second loop froze the account's own kept_until but never touched item deadlines, so the scheduled purge would destroy individually-deleted messages of a departed custodian while a hold was asserting over them (LH-8, LH-6).
Scope note: a kept account's inbox mail is already preserved wholesale by the account-level kept_until, so this only ever bit individually-deleted messages (the ones that live in the ArchivedItem store). Narrower than a whole mailbox, but still a spoliation/compliance gap under an active hold.
Fix
A gone-but-kept account now resolves its Keeping from the holds covering the domain and tenant its kept record carries, so its archived items freeze and release on the same path a live account's do. A gone-and-not-kept account still gets None (release only). +16/-2 in crates/common/src/hold.rs.
Clean room
Worked only against inbuxa's own tree — the settle_archive hold/undelete hooks in crates/common and the existing legal_hold test. No Stalwart Enterprise-licensed source was read.
Testing
legal_hold_tests gains a departed-custodian case on a dedicated single-account domain: import mail → delete one message (archived on a finite deadline) → destroy the account (kept) → place a domain-scoped hold → assert accountsCovered == 1, itemsHeld >= 1, sizeHeld > 0. Confirmed RED without the fix (itemsHeld: 0) and GREEN with it; cargo fmt clean.
Run: RUST_MIN_STACK=16777216 STORE=RocksDb cargo test -p tests legal_hold_tests -- --ignored
Compliance/data-loss fix — hold for review before release; advisory to follow. Finding 2 (audit records of a deleted-held account can be purged) is a separate root and not addressed here.
## What
A legal hold placed over an account that was deleted while undelete still retains it did not freeze that account's already-archived mail.
`settle_archive`'s item loop collapsed every gone account to `keeping = None`, so an `ArchivedItem` belonging to a since-deleted account kept its finite undelete deadline no matter which holds covered it. The second loop froze the account's own `kept_until` but never touched item deadlines, so the scheduled purge would destroy individually-deleted messages of a departed custodian while a hold was asserting over them (LH-8, LH-6).
Scope note: a kept account's **inbox** mail is already preserved wholesale by the account-level `kept_until`, so this only ever bit **individually-deleted** messages (the ones that live in the `ArchivedItem` store). Narrower than a whole mailbox, but still a spoliation/compliance gap under an active hold.
## Fix
A gone-but-kept account now resolves its `Keeping` from the holds covering the domain and tenant its kept record carries, so its archived items freeze and release on the same path a live account's do. A gone-**and**-not-kept account still gets `None` (release only). +16/-2 in `crates/common/src/hold.rs`.
## Clean room
Worked only against inbuxa's own tree — the `settle_archive` hold/undelete hooks in `crates/common` and the existing `legal_hold` test. No Stalwart Enterprise-licensed source was read.
## Testing
`legal_hold_tests` gains a departed-custodian case on a dedicated single-account domain: import mail → delete one message (archived on a finite deadline) → destroy the account (kept) → place a domain-scoped hold → assert `accountsCovered == 1`, `itemsHeld >= 1`, `sizeHeld > 0`. Confirmed RED without the fix (`itemsHeld: 0`) and GREEN with it; `cargo fmt` clean.
Run: `RUST_MIN_STACK=16777216 STORE=RocksDb cargo test -p tests legal_hold_tests -- --ignored`
Compliance/data-loss fix — hold for review before release; advisory to follow. Finding 2 (audit records of a deleted-held account can be purged) is a separate root and not addressed here.
settle_archive's item loop collapsed any gone account to keeping=None, so
an archived item belonging to an account that was deleted while undelete
still retains it kept its finite deadline no matter what holds covered it.
The second loop froze the account's own kept_until but never the item
deadlines, so the scheduled purge destroyed individually-deleted messages
of a departed custodian while a hold was asserting over them (LH-8, LH-6).
A gone-but-kept account now resolves its Keeping from the holds covering
the domain and tenant its kept record carries, so its archived items
freeze and release on the same path a live account's do. A gone-and-not-
kept account still gets None (release only).
Covered by legal_hold_tests: a late, domain-scoped hold over a deleted
custodian now freezes the message they had deleted before leaving.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
A legal hold placed over an account that was deleted while undelete still retains it did not freeze that account's already-archived mail.
settle_archive's item loop collapsed every gone account tokeeping = None, so anArchivedItembelonging to a since-deleted account kept its finite undelete deadline no matter which holds covered it. The second loop froze the account's ownkept_untilbut never touched item deadlines, so the scheduled purge would destroy individually-deleted messages of a departed custodian while a hold was asserting over them (LH-8, LH-6).Scope note: a kept account's inbox mail is already preserved wholesale by the account-level
kept_until, so this only ever bit individually-deleted messages (the ones that live in theArchivedItemstore). Narrower than a whole mailbox, but still a spoliation/compliance gap under an active hold.Fix
A gone-but-kept account now resolves its
Keepingfrom the holds covering the domain and tenant its kept record carries, so its archived items freeze and release on the same path a live account's do. A gone-and-not-kept account still getsNone(release only). +16/-2 incrates/common/src/hold.rs.Clean room
Worked only against inbuxa's own tree — the
settle_archivehold/undelete hooks incrates/commonand the existinglegal_holdtest. No Stalwart Enterprise-licensed source was read.Testing
legal_hold_testsgains a departed-custodian case on a dedicated single-account domain: import mail → delete one message (archived on a finite deadline) → destroy the account (kept) → place a domain-scoped hold → assertaccountsCovered == 1,itemsHeld >= 1,sizeHeld > 0. Confirmed RED without the fix (itemsHeld: 0) and GREEN with it;cargo fmtclean.Run:
RUST_MIN_STACK=16777216 STORE=RocksDb cargo test -p tests legal_hold_tests -- --ignoredCompliance/data-loss fix — hold for review before release; advisory to follow. Finding 2 (audit records of a deleted-held account can be purged) is a separate root and not addressed here.