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

オープン
#487 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
networking

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
7
フォーク
2
平均マージ
1日 17時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NanoForge-dev/Engine のほかの issue

NanoForge-dev/Engine の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。