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

Aberta
#487 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
76/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
node.js, typescript
Domínio
networking

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
7
Forks
2
Merge médio
1d 17h
PRs com merge (30d)
17

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de NanoForge-dev/Engine

Todas as issues de NanoForge-dev/Engine

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.