CVE-2026-112948: Vitest: Servers misapply `server.fs.deny`, serving `.env`, private keys, `.git`, and the API token file
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.
References
- github.com/advisories/GHSA-p458-7748-mcp3
- github.com/vitest-dev/vitest/commit/28dc1edfb6ba5a181fe208576989063795aeadb3
- github.com/vitest-dev/vitest/pull/11578
- github.com/vitest-dev/vitest/releases/tag/v5.0.5
- github.com/vitest-dev/vitest/security/advisories/GHSA-p458-7748-mcp3
- nvd.nist.gov/vuln/detail/CVE-2026-112948
Code Behaviors & Features
Detect and mitigate CVE-2026-112948 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →