Vitest project file and token exposure in dev servers
vitest-dev vitest · @vitest browser · @vitest ui · vitejs vite-plus
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @vitest/ui npm |
|
|
| @vitest/browser npm |
|
|
| vite-plus npm |
vitest-dev vitest · @vitest browser · @vitest ui · vitejs vite-plus
| Product | Affected | Fixed in |
|---|---|---|
| @vitest/ui npm |
|
|
| @vitest/browser npm |
|
|
| vite-plus npm |
≥ 1.0.0-rc.0 · < 1.3.0
|
Vitest is a testing framework powered by Vite. From 5.0.0-beta.6 until 5.0.5, Vitest dev servers can misapply server.fs.deny because project servers replace Vite's defaults and the root server adds .vitest-secret-token after Vite compiles its matcher. An attacker who can reach an affected UI, Browser Mode, or API server can read denied project files or the fallback API token at node_modules/.vitest/.vitest-secret-token, and Browser Mode with test.projects can expose JavaScript-compatible .env values through a malicious website. This issue is fixed in version 5.0.5.
From the CVE record · GitHub_M
Affected Vitest dev servers can misapply file-access restrictions. An attacker who can reach an affected UI, Browser Mode, or API server can read denied project files or a fallback API token. Browser Mode with test.projects can also expose JavaScript-compatible .env values through a malicious website.
Check deployments using @vitest/ui or @vitest/browser versions >=5.0.0-beta.6 and <5.0.5, or vite-plus versions >=1.0.0-rc.0 and <1.3.0.