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

Đang mở
#487 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
networking

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
7
Fork
2
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NanoForge-dev/Engine

Tất cả issue của NanoForge-dev/Engine

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.