Backport legal-hold fixes to release/2026 (#377, #381) for a 2026.x security release #382

Merged
jcoffey-dev merged 2 commits from sec/legal-hold-backport into release/2026 2026-11-11 22:46:18 +00:00
Owner

What

Backports both legal-hold fixes to release/2026 for a 2026.x security release. release/2026 carries the identical buggy code, so the 2026.x line is affected the same as 27.1.

  • 9dae9b04 — cherry-pick of #377 (27e6b0a): a legal hold now freezes the archived mail of an account deleted while undelete still kept it, instead of the scheduled purge destroying it under an active hold.
  • dcd32909 — cherry-pick of #381 (c884bad): a deleted-but-held account's audit and journal records are kept under the hold (held_accounts() folds in kept accounts a hold covers).

Both cherry-picked clean with -x (original hashes in the commit messages). On 27.1 these shipped in 27.1-rc.21.

Clean room

Both commits worked only against inbuxa's own tree — the hold/undelete/audit hooks in crates/common/crates/services and the existing legal_hold test. No Stalwart Enterprise-licensed source was read.

Testing

Built and ran legal_hold_tests against this release/2026 base — green (the Finding 2 item proven RED without the fix, GREEN with it on main); cargo fmt --check clean. CI does not run the #[ignore]d system suite, so it was checked locally.

Run: RUST_MIN_STACK=16777216 STORE=RocksDb cargo test -p tests legal_hold_tests -- --ignored

Release

Lands right before the 2026.x security release, per the batch route. Both items go in one advisory (spoliation under an active legal hold); advisory publishes once prod runs the patched builds, on John's go-ahead. Merge/timing is John's call.

## What Backports both legal-hold fixes to `release/2026` for a 2026.x security release. `release/2026` carries the identical buggy code, so the 2026.x line is affected the same as 27.1. - `9dae9b04` — cherry-pick of #377 (`27e6b0a`): a legal hold now freezes the archived mail of an account deleted while undelete still kept it, instead of the scheduled purge destroying it under an active hold. - `dcd32909` — cherry-pick of #381 (`c884bad`): a deleted-but-held account's audit and journal records are kept under the hold (`held_accounts()` folds in kept accounts a hold covers). Both cherry-picked clean with `-x` (original hashes in the commit messages). On 27.1 these shipped in `27.1-rc.21`. ## Clean room Both commits worked only against inbuxa's own tree — the hold/undelete/audit hooks in `crates/common`/`crates/services` and the existing `legal_hold` test. No Stalwart Enterprise-licensed source was read. ## Testing Built and ran `legal_hold_tests` against this `release/2026` base — green (the Finding 2 item proven RED without the fix, GREEN with it on main); `cargo fmt --check` clean. CI does not run the `#[ignore]`d system suite, so it was checked locally. Run: `RUST_MIN_STACK=16777216 STORE=RocksDb cargo test -p tests legal_hold_tests -- --ignored` ## Release Lands right before the 2026.x security release, per the batch route. Both items go in one advisory (spoliation under an active legal hold); advisory publishes once prod runs the patched builds, on John's go-ahead. Merge/timing is John's call.
jcoffey-dev added 2 commits 2026-11-11 19:47:19 +00:00
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.

(cherry picked from commit 27e6b0a57b)
Keep a deleted-but-held account's audit and journal records under the hold
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 9m26s
dcd32909d5
held_accounts() scanned only live accounts, so an account deleted while
undelete still kept it -- the case a legal hold is placed for -- was absent
from the set the retention purges trust. audit_purge consults it directly,
so a deleted-but-held account's audit trail was purged once past the 90-day
floor while the hold was active. The journal purge augmented the set at its
own call site, so it was affected only when a hold covered no live account.

held_accounts() now folds in the accounts undelete keeps that a hold covers,
through the domain and tenant their retained record carries, so every purge
that trusts it keeps a deleted-but-held account's records. The journal call
site's now-redundant augmentation is removed, leaving one source of truth.

Covered by legal_hold_tests: a deleted-but-held custodian is now present in
held_accounts() (LH-6, AU-7).

(cherry picked from commit c884bad555)
jcoffey-dev merged commit 5895b9ab26 into release/2026 2026-11-11 22:46:18 +00:00
jcoffey-dev deleted branch sec/legal-hold-backport 2026-11-11 22:46:19 +00:00
jcoffey-dev referenced this issue from a commit 2026-11-11 22:53:08 +00:00
Sign in to join this conversation.