fix(network): one malformed signaling frame crashes the UDP game server
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bun, typescript
- Ambito
- networking, security
Direzione di ricerca
Inizia da modules/network/src/server/udp.server.network.ts, intorno alle righe 158–176, e leggi shared/signaling.ts per consultare l'helper parseSignal esistente. Poi esamina i test di signaling in test/server/udp.server.spec.ts e aggiungi un caso con un frame malformato accanto al caso valido. Il lavoro è completato quando i frame non validi non causano più l'arresto anomalo del server e il test verifica che il socket venga chiuso con il codice 1008.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Which package is this bug report for?
network
Issue description
The async message handler of the UDP signaling WebSocket calls JSON.parse on raw input and then awaits setRemoteDescription / addIceCandidate with unvalidated data, with no try/catch. Neither the engine nor the loader installs an unhandled-rejection handler, so the rejection is unhandled and the Bun process exits. Any client that connects over TCP gets the session token this socket needs, so any player can stop the game server with a single frame. A null payload also throws on data.type, and pendingCandidates grows without limit.
Where:
Evidence:
message: async (webSocket, message) => {
...
const data = JSON.parse(typeof message === "string" ? message : new TextDecoder().decode(message));
if (data.type === "offer") { await this.receiveClientOffer(peerConnection, data.offer, webSocket); }
Reproduced with the same handler shape on Bun 1.3.14: ws.send("{") → SyntaxError: JSON Parse error: Expected '}' → process exits with code 1.
Suggested fix: Parse with the existing parseSignal (shared/signaling.ts), check the types of type / offer / candidate, wrap the body in try/catch and close the socket with 1008 on failure. Add a malformed-frame test next to the "signaling" happy path in test/server/udp.server.spec.ts.
Found during a code audit of main at be72076.
Code sample
// Same handler shape as UDPServer's signaling socket
const server = Bun.serve({
port: 0,
fetch: (req, srv) => (srv.upgrade(req) ? undefined : new Response("no")),
websocket: { message: async (_ws, m) => { const d = JSON.parse(String(m)); console.log(d.type); } },
});
const ws = new WebSocket(`ws://localhost:${server.port}`);
ws.onopen = () => ws.send("{");
// → SyntaxError: JSON Parse error, process exits with code 1
Versions
- Engine
mainat be72076 - pnpm 12.0.0, Node.js 26, Bun 1.3.14
Issue priority
High (immediate attention needed)
I have tested this issue on a development release
be72076
- Lingua principale
- TypeScript
- Stelle
- 7
- Fork
- 2
- Merge medio
- 1g 17h
- PR unite (30g)
- 17
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NanoForge-dev/Engine
-
dependencies enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NanoForge-dev/Engine#513 ·
I maintainer di solito rispondono entro 1 giorno
-
bug chore tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
NanoForge-dev/Engine#511 ·
I maintainer di solito rispondono entro 1 giorno
-
docs(network): TSDoc says ICE_SERVERS defaults to an empty list, the code uses public STUN serversApertadocumentation good first issue modules:network
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
NanoForge-dev/Engine#509 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation modules:ecs packages:asset packages:core
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NanoForge-dev/Engine#508 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue modules:music modules:sound
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NanoForge-dev/Engine#505 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NanoForge-dev/Engine
Issue simili
-
Mend: dependency security vulnerability
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
fdm-monster/fdm-monster#5563 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
be-BOP-io-SA/be-BOP#2849 ·
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
growilabs/growi#12246 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 The Rulekeeper - An index run that gives up on the lock ends SucceededForse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SSWConsulting/SSW.Rules#2809 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
automated-triage type/bug type/ci
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno