Skip to content

fix(room-server): honour allow_server_author to bypass rate limiting for web UI posts#8

Open
tjdownes wants to merge 1 commit intodevfrom
fix/room-server-server-author
Open

fix(room-server): honour allow_server_author to bypass rate limiting for web UI posts#8
tjdownes wants to merge 1 commit intodevfrom
fix/room-server-server-author

Conversation

@tjdownes
Copy link
Copy Markdown
Owner

@tjdownes tjdownes commented May 1, 2026

Summary

  • Web UI posts call add_post() with allow_server_author=True but the rate limiter was ignoring that flag, causing web UI posts to be incorrectly rate-limited alongside client messages

Test plan

  • Device test: rapid web UI posts are not dropped by the rate limiter

…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>
@tjdownes tjdownes force-pushed the fix/room-server-server-author branch from eb56916 to bdfff9b Compare May 1, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant