mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
requireBanAuthority (BAN_MEMBERS + role hierarchy) was wired only into ModerationService.BanUser/UnbanUser — which had zero production callers. The live path, handlePatchUser, ran a raw UPDATE with no hierarchy check, so any admin-panel actor could ban an equal- or higher-ranked user, including the owner. The ban/unban branch now calls the service (dead code becomes THE code — ban path 1 of 3 consolidated), which also audits as user_ban/user_unban, keeping the historical audit vocabulary. Authorization now runs in permission → existence → hierarchy order: an actor without ban authority sees Forbidden, never NotFound, so the ban path cannot enumerate user ids. The role+ban transaction is gone — the ban leg lives in the service, runs first, and a refusal returns before the role change executes, so a rejected ban never half-applies a PATCH. MemStore gains honest BanUser/UnbanUser so the matrix is testable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>