Skip to content

fix(server): sandbox trace file routes and check the WebSocket origin - #44178

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:harden-http-server
Nov 17, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:harden-http-server

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

Summary

  • /trace/file and the service worker /file/ route send Content-Security-Policy: sandbox and answer 403 to frame navigations.
  • WebSocket upgrade requires Origin, when present, to match Host or X-Forwarded-Host.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [playwright-test] › reporter-junit.spec.ts:350 › created › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22
❌ [playwright-test] › reporter-junit.spec.ts:350 › merged › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22

3 flaky ⚠️ [installation tests] › connect-to-selenium.spec.ts:20 › connect to selenium `@package-installations-ubuntu-latest`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › VI-030 should work with video+trace `@chromium-playwright-x64-ubuntu24-64-core-node22`
⚠️ [firefox-library] › library/capabilities.spec.ts:105 › CA-008 should support webgl Radoslav Kirilov (@smoke) `@firefox-playwright-x64-ubuntu24-64-core-node22`

23645 passed, 716 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chrome] › mcp/crash.spec.ts:31 › crash recovery › reports the navigation error, then resets and logs the crash @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:58 › crash recovery › lists only one tab @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:79 › crash recovery › marks non-current crashed tab in the tab list @mcp-ubuntu-latest-chrome

5237 passed, 633 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 All five failures predate this PR

Hi, I'm the Playwright bot. I checked the failures in tests 1 and MCP for 8b5072cc5. Both groups also fail on main, without this PR.

Evidence and suggested correction

The trace-file restrictions and WebSocket-origin check do not explain these failures. The affected tests and JUnit reporter are unchanged from the comparison commit, 354e6fa33.

Pre-existing failures

  • JUnit, Windows: reporter-junit.spec.ts:350, both created and merged variants of should add file attribute relative to fileRoot, fail at the classname assertion: expected auth/a.test.js, received auth\a.test.js. Both tests already fail at that assertion in this main job. This is a platform-specific assertion error, not evidence of a flake. A small correction is to expect path.join('auth', 'a.test.js') for classname; keep the forward-slash expectations for the normalized file attribute.
  • MCP, Chrome: crash.spec.ts:31 (reports the navigation error, then resets and logs the crash), :58 (lists only one tab), and :79 (marks non-current crashed tab in the tab list) all fail identically in this main job: the first times out waiting for crash recovery, and the other two time out with Not connected. These tests use the standard-input/output transport, not the modified HTTP WebSocket upgrade.

Checked the failures on Linux by the Playwright bot - agent run

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 All five failures predate this PR

Hi, I'm the Playwright bot. I rechecked the logs and confirmed the earlier verdict for MCP and tests 1 at 8b5072cc5: all five failures also occur on main.

Evidence by failure group

The PR changes trace-file responses and HTTP WebSocket origin checks. The failing tests, MCP transport fixture, and JUnit reporter are unchanged from comparison commit 354e6fa33.

Pre-existing failures — not caused by this PR

  • MCP, Chrome: All three crash.spec.ts failures occur with the same errors in this earlier main job. :31, “reports the navigation error, then resets and logs the crash,” times out at the recovery assertion; :58, “lists only one tab,” and :79, “marks non-current crashed tab in the tab list,” time out with Not connected. These tests use standard input/output for MCP, not the modified HTTP WebSocket upgrade.
  • JUnit, Windows: Both created and merged variants of reporter-junit.spec.ts:350, “should add file attribute relative to fileRoot,” fail identically in this earlier main job: classname is auth\a.test.js, but the assertion expects auth/a.test.js. This is a platform-specific assertion error, not evidence of a flake. Expect path.join('auth', 'a.test.js') for classname; retain forward slashes in the normalized file expectations.

Checked the failures on Linux by the Playwright bot - agent run

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit 9efd7d3 into microsoft:main Nov 17, 2026
22 of 24 checks passed
Pavel Feldman (pavelfeldman) pushed a commit to microsoft/playwright-cli that referenced this pull request Nov 18, 2026
## ✨ Highlights

- **🗂️ Identify and resume your extension sessions**
([#496](#496)) —
`playwright-cli attach --extension=chrome --session=docs-review
--session-color=blue` labels the tab group with your session name
instead of a truncated product name. Disconnected groups remain
available to select on the next connection. Use `--no-tab-group` to
leave your existing tab organization alone.
([microsoft/playwright#44047](microsoft/playwright#44047))
- **🧹 Close an agent's tabs when its work is done** — `playwright-cli
-s=docs-review detach --close-tabs` closes that extension session's tabs
before disconnecting. Plain `detach` still leaves the tabs open for
later.
([microsoft/playwright#44084](microsoft/playwright#44084))
- **🖥️ Install stable Chrome on Linux ARM64**
([microsoft/playwright#43998](microsoft/playwright#43998))
— `playwright-cli install-browser chrome` now installs Google's ARM64
Debian package instead of rejecting the architecture.
([microsoft/playwright#44020](microsoft/playwright#44020))

## 🐛 Fixes

- `fix(server): do not reveal the endpoint path over HTTP` — attaching
to a Playwright browser server with `--endpoint` now requires its full
`ws://` or `wss://` endpoint, including the path; HTTP endpoint
discovery has been removed. HTTP URLs for `--cdp` are unaffected.
([microsoft/playwright#44190](microsoft/playwright#44190))
- `fix(mcp): do not wait for busy pages longer than 10s when connecting
over CDP` — a busy existing tab no longer blocks `playwright-cli attach
--cdp=http://localhost:9222` indefinitely. Pages that cannot initialize
within 10 seconds are made available later when they respond.
([microsoft/playwright#44052](microsoft/playwright#44052),
[microsoft/playwright#44105](microsoft/playwright#44105))
- `fix(cli): suggest matching ffmpeg installer for video recording` —
when `video-start` needs ffmpeg, its error now recommends
`playwright-cli install-browser ffmpeg`, which installs the revision
used by the CLI.
([#540](#540),
[microsoft/playwright#44088](microsoft/playwright#44088))
- `fix(mcp): validate run-code input` — `playwright-cli run-code`
without code or `--filename` reports a clear input error instead of an
internal `TypeError`.
([microsoft/playwright#44080](microsoft/playwright#44080),
[microsoft/playwright#44087](microsoft/playwright#44087))
- `fix(locator): select among visible elements in first/last/nth with
locateOnlyVisible` — with `browser.contextOptions.locateOnlyVisible`
enabled, locators used in `run-code` apply `first()`, `last()` and
`nth()` to visible matches instead of selecting a hidden element and
finding nothing. Explicit visibility filters still take precedence.
([microsoft/playwright#43855](microsoft/playwright#43855),
[microsoft/playwright#44083](microsoft/playwright#44083))
- `fix(chromium): apply timezone to service workers` — Chromium service
workers honor `browser.contextOptions.timezoneId` from their first
statement, keeping date handling consistent with pages.
([microsoft/playwright#43983](microsoft/playwright#43983),
[microsoft/playwright#44021](microsoft/playwright#44021))
- `fix(tracing): hold dropped screencast frames while throttling` —
recording with `playwright-cli tracing-start` uses less browser CPU on
idle animated pages without changing the frames kept in the trace.
([microsoft/playwright#44053](microsoft/playwright#44053),
[microsoft/playwright#44068](microsoft/playwright#44068))
- `fix(trace-viewer): harden snapshot rendering` — Trace Viewer blocks
navigation and form submission from recorded snapshots. Trace-file
routes also reject frame navigations, and its server checks WebSocket
origins.
([microsoft/playwright#44177](microsoft/playwright#44177),
[microsoft/playwright#44178](microsoft/playwright#44178))

## 📦 Upgrading

Node.js 20 or newer is required.

```bash
npm install -g @playwright/cli@0.1.25
```

Co-authored-by: microsoft-playwright-automation[bot] <203992400+microsoft-playwright-automation[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants