fix(room-server): honour allow_server_author to bypass rate limiting for web UI posts#8
Open
fix(room-server): honour allow_server_author to bypass rate limiting for web UI posts#8
Conversation
…for web UI posts add_post() accepted allow_server_author: bool = False but never checked it. The web API passes allow_server_author=True when posting on behalf of the room server (e.g. from the web UI message composer), using the room server's own public key as client_pubkey. Because the rate-limit window is keyed on client_pubkey, any web UI message counted against the room server's own key. After 10 web UI messages in a minute the room server's key would hit MAX_POSTS_PER_CLIENT_PER_MINUTE and every subsequent web UI post would silently return False, surfacing as "Failed to add message (rate limit or validation error)" in the web UI. Fix: wrap the rate-limit block in `if not allow_server_author:`. Server / web-UI messages skip the window entirely and go straight to insert_room_message(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
eb56916 to
bdfff9b
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.
Summary
add_post()withallow_server_author=Truebut the rate limiter was ignoring that flag, causing web UI posts to be incorrectly rate-limited alongside client messagesTest plan