sec(server): restrict custom names for guest players and validate lobby ID endpoints (#1636)#4018
sec(server): restrict custom names for guest players and validate lobby ID endpoints (#1636)#4018berkelmali wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Worker validates game ID formats on REST endpoints and normalizes/censors WebSocket identity fields (username, clanTag) up-front, generating deterministic guest names for unauthenticated connections and using censored fields during reconnection. ChangesGame ID validation and identity normalization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description:
Unauthenticated guest players could submit any custom username and clan tag when joining a lobby, enabling them to impersonate registered players or administrators. Additionally, server endpoints for creating or querying games used raw unvalidated URL parameters, making them susceptible to cache poisoning or path enjections.
This fix updates Worker.ts to strictly override the username of unauthenticated guest connections to AnonXXX (generated deterministically from a short hash of their persistent UUID) and clear their clan tag. It also introduces GAME_ID_REGEX validations on all Express endpoints receiving lobby IDs to guarantee safe, malformed-free parameters.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
barfires