Update dependency @vitest/ui to v5.0.5 [SECURITY] #481
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "renovate/npm-vitest-ui-vulnerability"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
5.0.2→5.0.5Vitest: Servers misapply
server.fs.deny, serving.env, private keys,.git, and the API token fileCVE-2026-112948 / GHSA-p458-7748-mcp3
More information
Details
Summary
In Vitest 5, Vite's
server.fs.denyis not applied as intended on Vitest's dev servers. Depending on the server, files that Vite refuses to serve by default (such as.env, private keys and certificates,.npmrc, and.git) or Vitest's own API token file (.vitest-secret-token) can be read over plain HTTP by a client that can reach the server. In Browser Mode withtest.projects, a malicious website can also read.envvalues through the developer's browser.This only applies when Vitest runs an HTTP server, which happens with the UI (
--ui), Browser Mode, orapienabled. Plainvitestandvitest rundon't listen on any port and are not affected. The fix ships invitest, and@vitest/uiand@vitest/browserare listed because they are what enables the affected setups. Both pinvitestto the same version as a peer dependency, so upgrading either one also requires the patchedvitest. Users who enableapiwithout@vitest/uior@vitest/browserare also affected and should upgradevitest.Details
Vitest 5 adds its API token file to
server.fs.deny, but neither server ended up with the intended list. That's because of two Vite behaviors. Vite applies its default deny list only whenserver.fs.denyis unset, and it compiles the list into a matcher during config resolution, so later changes to the array have no effect..vitest-secret-tokenvitest/vitest run--uiorapitest.projectsdeny: ['.vitest-secret-token']from aconfig()hook, which replaces Vite's defaults. A project server listens on a port in Browser Mode withtest.projects, so in that setup a request likeGET /.env?rawreturns the file. A plainGET /.envis also served astext/javascript, so a malicious page can include it with<script src="http://localhost:<port>/.env">. A classic script include needs no CORS, and each dotenv line whose value is valid JavaScript (a quoted string, number, or boolean) runs as a global assignment the page can read. A syntax error anywhere in the file, such as a#comment, keeps the whole script from running. The same missing defaults also loosen Browser Mode's file-access checks forserver.readFile/writeFile/removeFile, screenshots, and traces.server.fs.allow. When that directory can't be written, for example in a container whose user has no writableHOME, Vitest falls back to<workspaceRoot>/node_modules/.vitest/.vitest-secret-token, which the root server then serves. The token authenticates the UI,/__vitest_attachment__, and the API WebSocket, whose RPC can write and rerun test files whenapi.allowWrite/api.allowExecare enabled.Impact
Information disclosure from the Vitest dev server, and with the token, privileged API access.
test.projects: while the browser server runs, any page the developer visits can read.envvalues that are valid JavaScript, through a classic<script>include. This works when the file consists ofKEY="value"lines. An unquoted value causes a runtime error that stops the script at that line, so only the lines before it leak. A syntax error anywhere in the file, such as a#comment line or anexportprefix, prevents the script from running at all. Recent Chrome versions may ask for Local Network Access permission first.fetchand XHR reads from other websites are still blocked by Vite's default CORS policy, and Vite'sHostcheck blocks DNS rebinding. That CORS policy does allow localhost origins, so a page served from another local dev server could read full files. The token file can't be read through a classic<script>, because a bare token isn't valid JavaScript.api.hostorbrowser.api.host, port forwarding, or a published container port): full file contents are readable over plain HTTP, including the token file when it's in the fallback location.Only the machine running Vitest is exposed, while it runs one of the setups above. Applications built or deployed from the project aren't affected.
The fix is in
vitest<PATCHED>. Vitest 4 and earlier are unaffected. They don't persist an API token, and they don't overrideserver.fs.deny.Workaround
Set
server.fs.denyexplicitly in the root Vitest config, including Vite's default list for your Vite version and the token file. For Vite 8.3:Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
vitest-dev/vitest (@vitest/ui)
v5.0.5Compare Source
🐞 Bug Fixes
fs.denywith api token file - by @hi-ogawa, Hiroshi Ogawa and Claude Opus 5.5 in #11578 (28dc1)--changed- by @sheremet-va in #11583 (14921)datato theimport.meta.hotstub - by @sheremet-va in #11590 (3a828)skipinskipIf, ignoreundefinedoptions - by @sheremet-va in #11591 (d523a)&#​39;failed&#​39;on worker crash - by @AriPerkkio in #11568 (6ae8e)View changes on GitHub
v5.0.4Compare Source
🚀 Features
test.ui.themeoption - by @sheremet-va in #11499 (1da66)--changed- by @sheremet-va in #11424 (a2336)🐞 Bug Fixes
:in project and change the shape ofresultscache - by @sheremet-va in #11453 (9673c)$string values whentaskTitleValueFormatTruncateis 0 - by @hi-ogawa, Hiroshi Ogawa and Claude Opus 5.5 in #11485 (4f7e1)maxWorkerssetting. Previously, it was applied incorrectly and could lead to Vitest using too many resources. For example, a lower number would still open too many browsers. Fixing it means Vitest opens less instances by default now.allowExternalfails to include uncovered files - by @AriPerkkio in #11513 (4ef00)MapandSetdeep equality in some assertions - by @hi-ogawa, Hiroshi Ogawa and Claude Opus 5.5 in #11402 (b4e79)thistomodule.exports- by @sheremet-va in #11504 (b618a)🏎 Performance
View changes on GitHub
v5.0.3Compare Source
🐞 Bug Fixes
result.statusbetweenrepeatsruns - by @hi-ogawa, Hiroshi Ogawa and Codex (GPT-6) in #11218 (5dbeb)test.failsexpectedly failed - by @hi-ogawa, Hiroshi Ogawa and Codex (GPT-6) in #11219 (b2458)listenuntil tests start running - by @sheremet-va in #11366 (7d8ed)toMatchScreenshotuses wrong reference on retried tests - by @macarie in #11393 (c22ab)why-is-node-runningto3.2.1to avoid users running intoERR_PNPM_TRUST_DOWNGRADE- by @AriPerkkio in #11403 (f6c9a)expect.extendasymmetric matchers - by @hi-ogawa, Hiroshi Ogawa and Claude in #11401 (3e794)groupOrderis set - by @mtorp in #11392 (50312)View changes on GitHub
Configuration
📅 Schedule: (in timezone Europe/Amsterdam)
🚦 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 this update again.
This PR has been generated by Mend Renovate CLI.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.