GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: validate websocket request by hi-ogawa · Pull Request #7317 · vitest-dev/vitest

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Jan 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Description

  • backports
    • fix: backport #7317 to v2 #7318
    • fix: backport #7317 to v1 #7319

summary

Adds ?token=xxx requirement for websocket upgrade request on __vitest__api__ and __vitest_browser_api__. Token is randomly generated on the server and it's injected in ui, tester, and orchestrator html, which are not accessible from cross origin.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hi-ogawa added 2 commits January 20, 2025 15:12
@hi-ogawa
fix: validate websocket api request
49e0e4c
fix: shouldHandle cannot be async

wip: copy isHostAllowed

chore: move code

chore: comment

wip: allow only same origin

chore: cleanup

wip: isApiRequestAllowed

chore: cleanup

wip: switch to token check

chore: unused

fix: inject VITEST_API_TOKEN in orchestrator ui

docs: add api.allowedHosts

fix: require token for __vitest_browser_api__ request

chore: cleanup

refactor: combine to isWebsocketRequestAllowed
@hi-ogawa
docs: fix
7c812cb
@netlify

netlify Bot commented Jan 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✅ Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9e76ab8
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/679f29277bb1e30008d255f5
😎 Deploy Preview https://deploy-preview-7317--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hi-ogawa added 4 commits January 21, 2025 11:44
@hi-ogawa
chore: comment
9f5988d
@hi-ogawa
Merge branch 'main' into fix-vitest-ui-rpc-cors
f6d07bb
@hi-ogawa
test: fix token
66f34b8
@hi-ogawa
fix: timing safe equal + handle invalid server.origin
af2e96c
This was referenced Jan 21, 2025
fix: backport #7317 to v2 #7318
Merged
fix: backport #7317 to v1 #7319
Merged
@hi-ogawa
hi-ogawa marked this pull request as ready for review January 21, 2025 03:40
sapphi-red
sapphi-red approved these changes Jan 21, 2025
View reviewed changes
@hi-ogawa
fix: add cache-control no cache
44d2b5c
AriPerkkio
AriPerkkio previously approved these changes Jan 21, 2025
View reviewed changes

@AriPerkkio AriPerkkio left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The token protection looks good to me.

The allowedHosts part is something I don't really understand. The WS endpoints will still be responding to any client that has the token. We are not passing allowedHosts anywhere else, so users still won't be able to open Vitest UI or browser from these. I don't understand why allowedHosts is needed here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread docs/config/index.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hi-ogawa @AriPerkkio
docs: Update docs/config/index.md
ed50f3d
Co-authored-by: Ari Perkkiö <[email protected]>
@hi-ogawa
hi-ogawa dismissed AriPerkkio’s stale review via ed50f3d January 21, 2025 08:38
hi-ogawa added 7 commits January 22, 2025 11:46
@hi-ogawa
Merge branch 'main' into fix-vitest-ui-rpc-cors
620d6dc
@hi-ogawa
wip: remove host check
835e055
@hi-ogawa
refactor: rename
9fb5f80
@hi-ogawa
test: add ui test
983b462
@hi-ogawa
chore: name middleware
3604f2e
@hi-ogawa
fix: add vitestUiHtmlMiddleware after viteHostCheckMiddleware
7f91828
@hi-ogawa
Revert "fix: add vitestUiHtmlMiddleware after viteHostCheckMiddleware"
4e5a50c
This reverts commit 7f91828.
@hi-ogawa hi-ogawa mentioned this pull request Jan 22, 2025
test: #7317 with Vite 5.4.14 #7332
Closed
6 tasks
AriPerkkio
AriPerkkio approved these changes Jan 22, 2025
View reviewed changes
sapphi-red
sapphi-red approved these changes Jan 22, 2025
View reviewed changes
@hi-ogawa
Merge branch 'main' into fix-vitest-ui-rpc-cors
209bf3d
@hi-ogawa
hi-ogawa requested a review from sheremet-va January 29, 2025 06:37
@AriPerkkio
Merge branch 'main' into fix-vitest-ui-rpc-cors
9e76ab8
AriPerkkio pushed a commit that referenced this pull request Feb 2, 2025
@hi-ogawa
fix: backport #7317 to v2 (#7318)
e0fe1d8
AriPerkkio added a commit that referenced this pull request Feb 2, 2025
@hi-ogawa @AriPerkkio
fix: backport #7317 to v1 (#7319)
7ce9fbb
Co-authored-by: Ari Perkkiö <[email protected]>
@AriPerkkio
AriPerkkio merged commit 191ef9e into vitest-dev:main Feb 2, 2025
@sourcery-ai sourcery-ai Bot mentioned this pull request Feb 3, 2025
chore(deps): update dependency vitest to v1.6.1 - autoclosed zce/mwa#186
Closed
1 task
@renovate renovate Bot mentioned this pull request Feb 3, 2025
Update minor and patch dependencies - autoclosed superneko160/htmlparser-frontend#38
Closed
1 task
renovate Bot added a commit to mmkal/expect-type that referenced this pull request Feb 3, 2025
@renovate
chore(deps): update vitest monorepo to v3.0.5
0efdd0d
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
This was referenced Feb 4, 2025
chore(deps-dev): bump vitest from 1.6.0 to 1.6.1 lukasjhan/Verifiable-Digital-Credentials#2
Merged
chore(deps-dev): bump vitest from 1.6.0 to 1.6.1 lukasjhan/monorepo-template#1
Open
renovate Bot added a commit to mmkal/expect-type that referenced this pull request Feb 9, 2025
@renovate
chore(deps): update vitest monorepo to v3.0.5
7b43cd5
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
@renovate renovate Bot mentioned this pull request Feb 9, 2025
chore(deps): update devdependencies (non-major) p-toy-factory/eslint-config-pcp#6
Open
1 task
renovate Bot added a commit to mmkal/expect-type that referenced this pull request Feb 12, 2025
@renovate
chore(deps): update vitest monorepo to v3.0.5
bb43607
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
renovate Bot added a commit to mmkal/expect-type that referenced this pull request Feb 12, 2025
@renovate
chore(deps): update vitest monorepo to v3.0.5
4f0deed
##### [v3.0.5](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@hi-ogawa](https://github.com/hi-ogawa) and [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)
@renovate renovate Bot mentioned this pull request Feb 14, 2025
chore(deps): update all non-major dependencies react-bootstrap/react-bootstrap#6845
Merged
1 task
This was referenced Mar 6, 2025
Update vitest monorepo to v3 (major) assurance-maladie-digital/design-system-v3#358
Closed
chore(deps): update dependency @vitest/coverage-v8 to v3 benyap/firestore-backfire#455
Open
chore(deps): update dependency @vitest/coverage-istanbul to v3 jvllmr/component-titles#197
Open
chore(deps): update vitest monorepo to v3 (major) tooppoo/ac6_assemble_tool#654
Merged
chore(deps): update dependency @vitest/coverage-v8 to v5 TimMikeladze/next-upload#69
Open
chore(deps): update dependency @vitest/coverage-v8 to v3 - autoclosed mheob/used-pm#82
Closed
chore: update dependency @vitest/ui to v4 hacomono-lib/json-origami#204
Closed
@sourcery-ai sourcery-ai Bot mentioned this pull request Mar 10, 2025
build(deps): bump the npm_and_yarn group with 5 updates Dargon789/thirdweb-dev#53
Closed
This was referenced Mar 13, 2025
chore(deps): update dependency @vitest/coverage-istanbul to v3 willswire/estado#14
Closed
Update dependency @vitest/coverage-v8 to v5 tjenkinson/sql-cursor-pagination#140
Open
@renovate-bot renovate-bot mentioned this pull request Mar 13, 2025
fix(deps)!: Update dependency @vitest/coverage-v8 to v5 - autoclosed GoogleCloudPlatform/terraform-ml-image-annotation-gcf#200
Closed
1 task
jelmore1674 pushed a commit to jelmore1674/build-changelog that referenced this pull request Mar 19, 2025
Renovate Bot Gitea
chore(deps): update vitest monorepo to v3.0.5 (#85)
eae6e73
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/main/packages/coverage-v8#readme) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8)) | devDependencies | patch | [`3.0.4` -> `3.0.5`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-v8/3.0.4/3.0.5) |
| [vitest](https://github.com/vitest-dev/vitest) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | devDependencies | patch | [`3.0.4` -> `3.0.5`](https://renovatebot.com/diffs/npm/vitest/3.0.4/3.0.5) |

---

### Release Notes

<details>
<summary>vitest-dev/vitest (@&#8203;vitest/coverage-v8)</summary>

### [`v3.0.5`](https://github.com/vitest-dev/vitest/releases/tag/v3.0.5)

[Compare Source](vitest-dev/vitest@v3.0.4...v3.0.5)

This release includes security patches for:

-   [Remote Code Execution when accessing a malicious website while Vitest API server is listening | CVE-2025-24964](GHSA-9crc-q9x8-hgqq)

##### 🚀 Features

-   **ui**: Insert message "no tests found" in ui - by [@&#8203;DevJoaoLopes](https://github.com/DevJoaoLopes) in vitest-dev/vitest#7366 [<samp>(92da4)</samp>](vitest-dev/vitest@92da490bd)

##### 🐞 Bug Fixes

-   Validate websocket request - by [@&#8203;hi-ogawa](https://github.com/hi-ogawa) and [@&#8203;AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7317 [<samp>(191ef)</samp>](vitest-dev/vitest@191ef9e34)
-   Don't toggle cli cursor on non-TTY - by [@&#8203;AriPerkkio](https://github.com/AriPerkkio) in vitest-dev/vitest#7336 [<samp>(3c805)</samp>](vitest-dev/vitest@3c8050e69)
-   **vite-node**: Differentiate file url with hash and query - by [@&#8203;hi-ogawa](https://github.com/hi-ogawa)  in vitest-dev/vitest#7365 [<samp>(926ca)</samp>](vitest-dev/vitest@926ca9546)

##### [View changes on GitHub](vitest-dev/vitest@v3.0.4...v3.0.5)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNTcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE1OS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://gitea.justinelmore.dev/jelmore1674/build-changelog/pulls/85
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
@sourcery-ai sourcery-ai Bot mentioned this pull request Mar 24, 2025
Bump vitest from 1.6.0 to 1.6.1 sarvex/athleticxr.ai#285
Merged
@renovate renovate Bot mentioned this pull request May 5, 2025
fix(deps): update all non-major dependencies vrn-deco/cli#96
Open
1 task
@campaigner-prod campaigner-prod Bot mentioned this pull request Apr 23, 2026
fix(deps): vuln minor upgrades — 15 packages (minor: 1 · patch: 14) DataDog/reagraph#13
Closed
4 tasks
hanzo-dev pushed a commit to hanzoai/vitest that referenced this pull request Sep 9, 2026
@hi-ogawa @AriPerkkio
fix: validate websocket request (vitest-dev#7317)
0cf078d
Co-authored-by: Ari Perkkiö <[email protected]>
This was referenced Sep 23, 2026
chore(ci): shard vitest across 4 runners and run affected tests locally Shelf-nu/shelf.nu#3079
Merged
Closes Error handling for .prettierrc, Refactor and modularize index.ts, Unit tests for index.ts, Performance: reuse the imported signing key accensa/accensa-app#456
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@AriPerkkio AriPerkkio AriPerkkio approved these changes
@sheremet-va sheremet-va Awaiting requested review from sheremet-va
+1 more reviewer
@sapphi-red sapphi-red sapphi-red approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@hi-ogawa @AriPerkkio @sapphi-red
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.