fix(network): a p2p joiner trusts every frame from the host

Aperta
#487 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
networking

Direzione di ricerca

Start with modules/network/src/client/udp.client.network.ts at the three cited locations and trace how incoming frames are handled in p2p mode. Check for an existing parseSignal helper and tests for packet and signaling handling. Done when malformed or unexpected frames are safely rejected without freezing or crashing the joiner; the issue does not name a test file.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug modules:network
Which package is this bug report for?

network

Issue description

In p2p mode the host is another player. new Uint8Array(ev.data) on a string such as "2000000000" tries a ~2 GB allocation. Signaling frames are JSON.parsed with no try/catch inside an async onmessage, and msg.answer goes straight to setRemoteDescription. One frame can crash or freeze a joiner's tab.

Where:

Evidence:

const packet = new Uint8Array(ev.data);
const msg = JSON.parse(ev.data);
await rtcPeerConnection.setRemoteDescription(msg.answer);

Suggested fix: Check ev.data instanceof ArrayBuffer first, parse signaling with parseSignal inside try/catch, and validate the message shapes.

Found during a code audit of main at be72076.

Code sample

No response

Versions
  • Engine main at 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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NanoForge-dev/Engine

Tutte le issue di NanoForge-dev/Engine

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.