Skip to content

fix(players): rate limit vMenu:RequestPlayerList and check permission - #667

Closed
normal88 wants to merge 1 commit into
TomGrobbe:legacyfrom
normal88:fix/player-list-request-guard
Closed

normal88 wants to merge 1 commit into
TomGrobbe:legacyfrom
normal88:fix/player-list-request-guard

Conversation

@normal88

Copy link
Copy Markdown

vMenu:RequestPlayerList had no permission check and no rate limit. With 100+ players online, spamming it makes the server build and send the whole player list on every request, and the server CPU goes way up. Pretty easy to abuse.

  • needs vMenu.OnlinePlayers.Menu now, players without it get an empty list back
  • one request per second per player, the rest get dropped (logs a warning every 50 drops so you can see who's spamming)
  • the list is built at most once per second and shared between requests
  • rate limit data gets cleaned up when a player leaves
  • client side, WaitRequested() gives up after 3 seconds, otherwise one dropped request would leave the Online Players menu waiting forever

Only thing to know: private messages also use this list to get the sender name, so someone without OnlinePlayers.Menu who gets a PM will see Invalid as the name. Everyone has that permission by default so it shouldn't matter for most servers.

The event had no permission check or rate limit, so spamming it with a lot of players online made the server build and send the full player list every time and eat a lot of CPU. Now it needs OnlinePlayers.Menu, a player can ask once per second, and the list is built at most once per second and shared. The client also stops waiting after 3 seconds so a dropped request doesn't leave the menu stuck.
@sir-lord-pizza

Copy link
Copy Markdown
Collaborator

No further changes will be made to the old vMenu at this point. Closing this PR for now.

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.

2 participants