Vitest: Servers misapply `server.fs.deny`, serving `.env`, private keys, `.git`, and the API token file
### Summary In Vitest 5, Vite's `server.fs.deny` is 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 with `test.projects`, a malicious website can also read `.env` values through the developer's browser. This only applies when Vitest runs an HTTP server, which happens with the UI (`--ui`), Browser Mode, or `api` enabled. Plain `vitest` and `vitest run` don't listen on any port and are not affected. The fix ships in `vitest`, and `@vitest/ui` and `@vitest/browser` are listed because they are what enables the affected setups. Both pin `vitest` to the same version as a peer dependency, so upgrading either one also requires the patched `vitest`. Users who enable `api` without `@vitest/ui` or `@vitest/browser` are also affected and should upgrade `vitest`. ### 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 when `server.fs.deny` is unset, and it compiles the list into a matcher during config resolution, so later changes to the array have no effect. | setup | listening server | Vite's default deny list | `.vitest-secret-token` | | ---------------------------------- |
- Products
- @vitest/browser, @vitest/ui, vite-plus
- Affected versions
- Not specified
- Fixed versions
- 1.3.0, 5.0.5
- CVEs
- CVE-2026-112948
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 16:08 UTC · Revision 1
Source evidence
Vitest: Servers misapply `server.fs.deny`, serving `.env`, private keys, `.git`, and the API token file
core-osv · Original sourcePublished 21 Oct 2026, 19:57 UTC
### Summary In Vitest 5, Vite's `server.fs.deny` is 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 with `test.projects`, a malicious website can also read `.env` values through the developer's browser. This only applies when Vitest runs an HTTP server, which happens with the UI (`--ui`), Browser Mode, or `api` enabled. Plain `vitest` and `vitest run` don't listen on any port and are not affected. The fix ships in `vitest`, and `@vitest/ui` and `@vitest/browser` are listed because they are what enables the affected setups. Both pin `vitest` to the same version as a peer dependency, so upgrading either one also requires the patched `vitest`. Users who enable `api` without `@vitest/ui` or `@vitest/browser` are also affected and should upgrade `vitest`. ### 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 when `server.fs.deny` is unset, and it compiles the list into a matcher during config resolution, so later changes to the array have no effect. | setup | listening server | Vite's default deny list | `.vitest-secret-token` | | ---------------------------------- |
osv:GHSA-p458-7748-mcp3
@vitest/ui
Fixed versions: 5.0.5
@vitest/browser
Fixed versions: 5.0.5
vite-plus
Fixed versions: 1.3.0
Complete source record
{
"id": "d18a0853a02cc44180fb2140f5fcb7af33b595e845ad7af30d48c467ceeacb84",
"url": "https://osv.dev/vulnerability/GHSA-p458-7748-mcp3",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Vitest: Servers misapply `server.fs.deny`, serving `.env`, private keys, `.git`, and the API token file",
"summary": "### Summary In Vitest 5, Vite's `server.fs.deny` is 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 with `test.projects`, a malicious website can also read `.env` values through the developer's browser. This only applies when Vitest runs an HTTP server, which happens with the UI (`--ui`), Browser Mode, or `api` enabled. Plain `vitest` and `vitest run` don't listen on any port and are not affected. The fix ships in `vitest`, and `@vitest/ui` and `@vitest/browser` are listed because they are what enables the affected setups. Both pin `vitest` to the same version as a peer dependency, so upgrading either one also requires the patched `vitest`. Users who enable `api` without `@vitest/ui` or `@vitest/browser` are also affected and should upgrade `vitest`. ### 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 when `server.fs.deny` is unset, and it compiles the list into a matcher during config resolution, so later changes to the array have no effect. | setup | listening server | Vite's default deny list | `.vitest-secret-token` | | ---------------------------------- | ",
"evidence": "osv:GHSA-p458-7748-mcp3",
"products": [
{
"name": {
"value": "@vitest/ui",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "5.0.5",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "@vitest/browser",
"evidence": "/affected/1/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "5.0.5",
"evidence": "/affected/1/ranges"
}
],
"affected_versions": []
},
{
"name": {
"value": "vite-plus",
"evidence": "/affected/2/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "1.3.0",
"evidence": "/affected/2/ranges"
}
],
"affected_versions": []
}
],
"severity": "medium",
"structured": {
"id": "GHSA-p458-7748-mcp3",
"aliases": [
"CVE-2026-112948",
"GHSA-p458-7748-mcp3"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
}
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "5.0.0-beta.6"
},
{
"fixed": "5.0.5"
}
]
}
],
"package": {
"name": "@vitest/ui",
"purl": "pkg:npm/%40vitest/ui",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-p458-7748-mcp3/GHSA-p458-7748-mcp3.json"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "5.0.0-beta.6"
},
{
"fixed": "5.0.5"
}
]
}
],
"package": {
"name": "@vitest/browser",
"purl": "pkg:npm/%40vitest/browser",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-p458-7748-mcp3/GHSA-p458-7748-mcp3.json"
}
},
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "1.0.0-rc.0"
},
{
"fixed": "1.3.0"
}
]
}
],
"package": {
"name": "vite-plus",
"purl": "pkg:npm/vite-plus",
"ecosystem": "npm"
},
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-p458-7748-mcp3/GHSA-p458-7748-mcp3.json"
}
}
],
"modified": "2026-10-21T20:01:39.862679779Z",
"provider": "osv",
"references": [
"https://github.com/vitest-dev/vitest/security/advisories/GHSA-p458-7748-mcp3",
"https://nvd.nist.gov/vuln/detail/CVE-2026-112948",
"https://github.com/vitest-dev/vitest/pull/11578",
"https://github.com/vitest-dev/vitest/commit/28dc1edfb6ba5a181fe208576989063795aeadb3",
"https://github.com/vitest-dev/vitest",
"https://github.com/vitest-dev/vitest/releases/tag/v5.0.5"
],
"provider_metadata": {
"cwe_ids": [
"CWE-200",
"CWE-552"
],
"severity": "MODERATE",
"github_reviewed": true,
"nvd_published_at": "2026-10-20T16:17:05Z",
"github_reviewed_at": "2026-10-21T19:57:00Z"
}
},
"related_cves": [
{
"value": "CVE-2026-112948",
"evidence": "/aliases"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 399305,
"published_at": "2026-10-21T19:57:00+00:00"
}