db: purge all references to a dropped account
All checks were successful
CI / check (push) Successful in 3m45s

Dropping (or expiring) an account left its channel access, channel
successorship, and group membership/foundership behind, keyed by name — so
re-registering the same nick silently inherited the old privileges. The
AccountDropped fold and the live drop_account path now share one helper
that erases every reference (founder channels are still handled by
handle_account_gone's successor transfer). Closes a privilege-inheritance
hole; especially relevant to inactivity expiry.
This commit is contained in:
Jean Chevronnet 2026-07-16 03:51:01 +00:00
parent dc23a44f57
commit fa55bc3e3a
No known key found for this signature in database
3 changed files with 74 additions and 1 deletions

View file

@ -500,6 +500,10 @@ impl Db {
}
self.log.append(Event::AccountDropped { account: account.to_string() }).map_err(|_| RegError::Internal)?;
self.accounts.remove(&k);
// Keep live state in step with what the AccountDropped fold does on replay:
// erase every reference so a re-registration can't inherit the account's
// channel access, successorship, or group standing.
super::event::purge_account_refs(account, &mut self.channels, &mut self.grouped, &mut self.net.groups);
Ok(true)
}