Skip to content

Bound WebSocket shot slots against resource exhaustion - #20

Merged
timriker merged 1 commit into
timriker:mainfrom
Sythos:docker-resource-fix
Aug 25, 2026
Merged

Bound WebSocket shot slots against resource exhaustion#20
timriker merged 1 commit into
timriker:mainfrom
Sythos:docker-resource-fix

Conversation

@Sythos

@Sythos Sythos commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What changed

  • cap SHOT_MAX_ACTIVE at 64 on both the server and browser boundaries
  • normalize invalid or oversized values before HUD allocation, canvas sizing, and fire gating
  • add client/server parity tests for normal, invalid, and oversized values

Why

CodeQL flagged new Array(maxSlots) in public/hud.js (js/resource-exhaustion, alert #1). SHOT_MAX_ACTIVE ultimately comes from the WebSocket init payload, so an unexpected or malicious value could allocate a huge array, burn CPU, or crash the tab. The server now caps its config before publishing it, and the browser still treats the payload as untrusted.

The existing defaults (1/3) stay unchanged; only values above the defensive 64-slot ceiling are reduced.

Checks: npm run check (server syntax, ESLint, controls docs, and shot-limit tests).

@timriker
timriker merged commit 41659e4 into timriker:main Aug 25, 2026
9 checks passed
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