[codex] Block banned actors from moderation commands (BUZZ-SEC-007)#1915
Open
jmecom wants to merge 1 commit into
Open
[codex] Block banned actors from moderation commands (BUZZ-SEC-007)#1915jmecom wants to merge 1 commit into
jmecom wants to merge 1 commit into
Conversation
jmecom
marked this pull request as ready for review
July 15, 2026 18:17
jmecom
force-pushed
the
codex/fix-buzz-sec-007
branch
2 times, most recently
from
July 15, 2026 22:37
a5cf051 to
5c7fb97
Compare
tlongwell-block
approved these changes
Jul 16, 2026
jmecom
force-pushed
the
codex/fix-buzz-sec-007
branch
from
July 16, 2026 20:32
5c7fb97 to
3965125
Compare
jmecom
force-pushed
the
codex/fix-buzz-sec-007
branch
from
July 16, 2026 20:54
3965125 to
defa8fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Moderation commands now check the actor's durable, tenant-scoped ban state before executing any mutation. This closes the HTTP and stale-WebSocket paths that let a banned administrator reach an unban command without completing a fresh authentication challenge.
Timeouts remain distinct from bans: an authorized moderator who is timed out can still lift that timeout, while a banned actor cannot run any moderation command.
Why
Moderation commands intentionally run before the ordinary write-restriction gate so administrators can remove timeouts. The code assumed every banned actor had already been rejected by WebSocket authentication, but NIP-98 requests and already-authenticated sockets could reach the handler without that check. A banned administrator could therefore unban themselves and regain normal relay access.
Impact
Ban enforcement now applies at the moderation mutation boundary on every transport. Database failures while checking the ban state reject the command rather than allowing it through.
Testing
cargo test -p buzz-relay banned_admin_cannot_reach_an_unban_command --libAddresses BUZZ-SEC-007.