feat(socket): validate and rate-limit every incoming event (#3) #27
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: jeux/le-grand-concours#27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sec/3-validate-socket-events"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements ticket #3 — validate and limit all incoming Socket.IO events.
Problem
Payloads were destructured with ad-hoc checks: a missing payload could throw, several strings had no server bound, and there was no rate limiting or room-creation quota.
Changes
server/src/socket/validation.ts): every incoming event is validated and normalized. Missing, mistyped or oversized payloads are rejected; the room code is uppercased and must be exactly four letters; string bounds live inserver/src/socket/limits.ts. Room events answer with an explicitroom:error; invalid game events are dropped silently (no feedback to hostile clients).server/src/socket/rate-limit.ts): per-socket fixed-window cap across all events, cleared on disconnect.MAX_ACTIVE_ROOMScap (viaroom.store.roomCount) refuses creation beyond the limit.Verification (local, all green)
node:test111 pass / 1 skip (validators, limiter, roomCount, hostile-input integration)validation.ts&rate-limit.tsat 100%)Docs updated:
docs/Implémentation.md(validation & limits section, tests, limits).Refs #3