react-test-harness: network allowlist follow-ups from #6758

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
playwright, typescript

調査の方向性

Start in packages/React/test-harness, reading component-runner.ts, network-guard.integration.test.ts, and connect.integration.test.ts; first check how ComponentRunner derives declared libraries and how the integration suites are gated by RUN_BROWSER_INTEGRATION=1. The issue describes four separate follow-ups, from allowlist tests to CI and attached-browser handling, so choose one and confirm its scope with maintainers. Done means the selected behavior has a focused test or CI job that covers the case described.

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

説明

Follow-ups from #6758, which added a network allowlist and an allowlisting proxy to @memberjunction/react-test-harness. Reviewers raised these as non-blocking, and they were split out of that PR.

1. Allow only the libraries a component declares

ComponentRunner allows the origin of every registered Component Library (CDNUrl, CDNCssUrl) on every page, whatever libraries the component under test declares. Not every one of those origins is a static CDN: at least one is an authenticated API host. A component can therefore send requests to any registered library's origin.

Proposed: build the allowlist from the component's declared libraries, including those of its child components, plus the core runtime. Check that the runtime's ComponentCompiler never needs an undeclared library before narrowing.

2. Pin the AllowNetworkUrls calls in ComponentRunner

Removing either AllowNetworkUrls(...) call in component-runner.ts passes every test: the library URLs in ExecuteComponent, and the core runtime URLs in loadRuntimeLibraries. The failure mode is fail-closed (every component run fails to load React or its libraries), but nothing catches it.

Proposed: a test that runs ComponentRunner with a mocked BrowserManager and asserts both calls are made with the expected URLs, fallback CDN URLs included.

3. WebRTC over UDP in attached browsers

When the harness launches the browser, it passes flags (BROWSER_LAUNCH_ARGS) that keep WebRTC on the allowlisting proxy and turn its UDP off. An attached browser (connect / MJ_REACT_TEST_HARNESS_CONNECT) keeps the flags it was started with. There, only the init script that removes the WebRTC constructors stands in the way of UDP STUN/TURN traffic, and a script can be raced. TCP is still refused at the proxy.

Options: document the flags an attached browser must be started with and warn when they can't be confirmed, or refuse allowlist mode on an attached browser unless the caller confirms the flags.

4. Run the real-browser suite in CI

network-guard.integration.test.ts (and connect.integration.test.ts) run only with RUN_BROWSER_INTEGRATION=1, so CI runs none of them. They are the only tests that prove the guard in a real browser. The proxy's socket-level tests (network-proxy.test.ts) do run in CI.

Proposed: a CI job that installs Playwright's Chromium and runs these suites, at least when packages/React/test-harness changes.

Package: packages/React/test-harness.

🤖 Generated with Claude Code

主要言語
TSQL
スター
32
フォーク
7
平均マージ
1日 16時間
マージ済み PR(30日)
504

環境構築

はじめの一歩

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

MemberJunction/MJ のほかの issue

MemberJunction/MJ の issue をすべて見る

似ている issue

DevOps の issue をもっと見る

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

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