Bump vite to 5.4.21 [SECURITY]
This PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| vite (source) | 4.5.14 -> 5.4.21 |
GitHub Vulnerability Alerts
CVE-2025-58752
Summary
Any HTML files on the machine were served regardless of the server.fs settings.
Impact
Only apps that match the following conditions are affected:
- explicitly exposes the Vite dev server to the network (using --host or server.host config option)
-
appType: 'spa'(default) orappType: 'mpa'is used
This vulnerability also affects the preview server. The preview server allowed HTML files not under the output directory to be served.
Details
The serveStaticMiddleware function is in charge of serving static files from the server. It returns the viteServeStaticMiddleware function which runs the needed tests and serves the page. The viteServeStaticMiddleware function checks if the extension of the requested file is ".html". If so, it doesn't serve the page. Instead, the server will go on to the next middlewares, in this case htmlFallbackMiddleware, and then to indexHtmlMiddleware. These middlewares don't perform any test against allow or deny rules, and they don't make sure that the accessed file is in the root directory of the server. They just find the file and send back its contents to the client.
PoC
Execute the following shell commands:
npm create vite@latest
cd vite-project/
echo "secret" > /tmp/secret.html
npm install
npm run dev
Then, in a different shell, run the following command:
curl -v --path-as-is 'http://localhost:5173/../../../../../../../../../../../tmp/secret.html'
The contents of /tmp/secret.html will be returned.
This will also work for HTML files that are in the root directory of the project, but are in the deny list (or not in the allow list). Test that by stopping the running server (CTRL+C), and running the following commands in the server's shell:
echo 'import path from "node:path"; import { defineConfig } from "vite"; export default defineConfig({server: {fs: {deny: [path.resolve(__dirname, "secret_files/*")]}}})' > [vite.config.js](http://vite.config.js)
mkdir secret_files
echo "secret txt" > secret_files/secret.txt
echo "secret html" > secret_files/secret.html
npm run dev
Then, in a different shell, run the following command:
curl -v --path-as-is 'http://localhost:5173/secret_files/secret.txt'
You will receive a 403 HTTP Response, because everything in the secret_files directory is denied.
Now in the same shell run the following command:
curl -v --path-as-is 'http://localhost:5173/secret_files/secret.html'
You will receive the contents of secret_files/secret.html.
CVE-2025-58751
Summary
Files starting with the same name with the public directory were served bypassing the server.fs settings.
Impact
Only apps that match the following conditions are affected:
- explicitly exposes the Vite dev server to the network (using --host or
server.hostconfig option) - uses the public directory feature (enabled by default)
- a symlink exists in the public directory
Details
The servePublicMiddleware function is in charge of serving public files from the server. It returns the viteServePublicMiddleware function which runs the needed tests and serves the page. The viteServePublicMiddleware function checks if the publicFiles variable is defined, and then uses it to determine if the requested page is public. In the case that the publicFiles is undefined, the code will treat the requested page as a public page, and go on with the serving function. publicFiles may be undefined if there is a symbolic link anywhere inside the public directory. In that case, every requested page will be passed to the public serving function. The serving function is based on the sirv library. Vite patches the library to add the possibility to test loading access to pages, but when the public page middleware disables this functionality since public pages are meant to be available always, regardless of whether they are in the allow or deny list.
In the case of public pages, the serving function is provided with the path to the public directory as a root directory. The code of the sirv library uses the join function to get the full path to the requested file. For example, if the public directory is "/www/public", and the requested file is "myfile", the code will join them to the string "/www/public/myfile". The code will then pass this string to the normalize function. Afterwards, the code will use the string's startsWith function to determine whether the created path is within the given directory or not. Only if it is, it will be served.
Since sirv trims the trailing slash of the public directory, the string's startsWith function may return true even if the created path is not within the public directory. For example, if the server's root is at "/www", and the public directory is at "/www/p", if the created path will be "/www/private.txt", the startsWith function will still return true, because the string "/www/private.txt" starts with "/www/p". To achieve this, the attacker will use ".." to ask for the file "../private.txt". The code will then join it to the "/www/p" string, and will receive "/www/p/../private.txt". Then, the normalize function will return "/www/private.txt", which will then be passed to the startsWith function, which will return true, and the processing of the page will continue without checking the deny list (since this is the public directory middleware which doesn't check that).
PoC
Execute the following shell commands:
npm create vite@latest
cd vite-project/
mkdir p
cd p
ln -s a b
cd ..
echo 'import path from "node:path"; import { defineConfig } from "vite"; export default defineConfig({publicDir: path.resolve(__dirname, "p/"), server: {fs: {deny: [path.resolve(__dirname, "private.txt")]}}})' > vite.config.js
echo "secret" > private.txt
npm install
npm run dev
Then, in a different shell, run the following command:
curl -v --path-as-is 'http://localhost:5173/private.txt'
You will receive a 403 HTTP Response, because private.txt is denied.
Now in the same shell run the following command:
curl -v --path-as-is 'http://localhost:5173/../private.txt'
You will receive the contents of private.txt.
Related links
- https://github.com/lukeed/sirv/commit/f0113f3f8266328d804ee808f763a3c11f8997eb
CVE-2025-62522
Summary
Files denied by server.fs.deny were sent if the URL ended with \ when the dev server is running on Windows.
Impact
Only apps that match the following conditions are affected:
- explicitly exposes the Vite dev server to the network (using --host or
server.hostconfig option) - running the dev server on Windows
Details
server.fs.deny can contain patterns matching against files (by default it includes .env, .env.*, *.{crt,pem} as such patterns). These patterns were able to bypass by using a back slash(\). The root cause is that fs.readFile('/foo.png/') loads /foo.png.
PoC
npm create vite@latest
cd vite-project/
cat "secret" > .env
npm install
npm run dev
curl --request-target /.env\ http://localhost:5173
Release Notes
vitejs/vite (vite)
v5.4.21
Please refer to CHANGELOG.md for details.
v5.4.20
Please refer to CHANGELOG.md for details.
v5.4.19
Please refer to CHANGELOG.md for details.
v5.4.18
Please refer to CHANGELOG.md for details.
v5.4.17
Please refer to CHANGELOG.md for details.
v5.4.16
Please refer to CHANGELOG.md for details.
v5.4.15
Please refer to CHANGELOG.md for details.
v5.4.14
Please refer to CHANGELOG.md for details.
v5.4.13
Please refer to CHANGELOG.md for details.
v5.4.12
This version contains a breaking change due to security fixes. See https://github.com/vitejs/vite/security/advisories/GHSA-vg6x-rcgg-rjx6 for more details.
Please refer to CHANGELOG.md for details.
v5.4.11

Today, we're taking another big step in Vite's story. The Vite team, contributors, and ecosystem partners are excited to announce the release of the next Vite major:
- Vite 6.0 announcement blog post
- Docs
- Translations: 简体中文, 日本語, Español, Português, 한국어, Deutsch
- Migration Guide
We want to thank the more than 1K contributors to Vite Core and the maintainers and contributors of Vite plugins, integrations, tools, and translations that have helped us craft this new major. We invite you to get involved and help us improve Vite for the whole ecosystem. Learn more at our Contributing Guide.
⚠ BREAKING CHANGES
- drop node 21 support in version ranges (#18729)
- deps: update dependency dotenv-expand to v12 (#18697)
- resolve: allow removing conditions (#18395)
- html: support more asset sources (#11138)
- remove fs.cachedChecks option (#18493)
- proxy bypass with WebSocket (#18070)
- css: remove default import in ssr dev (#17922)
- lib: use package name for css output file name (#18488)
- update to chokidar v4 (#18453)
- support
file://resolution (#18422) - deps: update postcss-load-config to v6 (#15235)
- css: change default sass api to modern/modern-compiler (#17937)
- css: load postcss config within workspace root only (#18440)
- default
build.cssMinifyto'esbuild'for SSR (#15637) -
json: add
json.stringify: 'auto'and make that the default (#18303) - bump minimal terser version to 5.16.0 (#18209)
-
deps: migrate
fast-globtotinyglobby(#18243)
Features
- add support for .cur type (#18680) (5ec9eed)
- drop node 21 support in version ranges (#18729) (a384d8f)
- enable HMR by default on ModuleRunner side (#18749) (4d2abc7)
- support
module-synccondition when loading config if enabled (#18650) (cf5028d) - add
isSsrTargetWebWorkerflag toconfigEnvironmenthook (#18620) (3f5fab0) - add
ssr.resolve.mainFieldsoption (#18646) (a6f5f5b) - expose default mainFields/conditions (#18648) (c12c653)
- extended applyToEnvironment and perEnvironmentPlugin (#18544) (8fa70cd)
-
optimizer: allow users to specify their esbuild
platformoption (#18611) (0924879) - show error when accessing variables not exposed in CJS build (#18649) (87c5502)
-
asset: add
?inlineand?no-inlinequeries to control inlining (#15454) (9162172) - asset: inline svg in dev if within limit (#18581) (f08b146)
- use a single transport for fetchModule and HMR support (#18362) (78dc490)
- html: support more asset sources (#11138) (8a7af50)
- resolve: allow removing conditions (#18395) (d002e7d)
-
html: support
vite-ignoreattribute to opt-out of processing (#18494) (d951310) - lib: use package name for css output file name (#18488) (61cbf6f)
- log complete config in debug mode (#18289) (04f6736)
- proxy bypass with WebSocket (#18070) (3c9836d)
- support
file://resolution (#18422) (6a7e313) - update to chokidar v4 (#18453) (192d555)
- allow custom
consoleincreateLogger(#18379) (0c497d9) - css: add more stricter typing of lightningcss (#18460) (b9b925e)
- css: change default sass api to modern/modern-compiler (#17937) (d4e0442)
- read
sec-fetch-destheader to detect JS in transform (#9981) (e51dc40) - css: load postcss config within workspace root only (#18440) (d23a493)
-
json: add
json.stringify: 'auto'and make that the default (#18303) (b80daa7) - add .git to deny list by default (#18382) (105ca12)
- add
environment::listen(#18263) (4d5f51d) - enable dependencies discovery and pre-bundling in ssr environments (#18358) (9b21f69)
- restrict characters useable for environment name (#18255) (9ab6180)
- support arbitrary module namespace identifier imports from cjs deps (#18236) (4389a91)
- introduce RunnableDevEnvironment (#18190) (fb292f2)
- support
this.environmentinoptionsandonLoghook (#18142) (7722c06) - css: support es2023 build target for lightningcss (#17998) (1a76300)
- Environment API (#16471) (242f550)
- expose
EnvironmentOptionstype (#18080) (35cf59c)
Bug Fixes
-
createRunnableDevEnvironmentreturnsRunnableDevEnvironment, notDevEnvironment(#18673) (74221c3) -
getModulesByFileshould return aserverModule(#18715) (b80d5ec) - catch error in full reload handler (#18713) (a10e741)
- client: overlay not appearing when multiple vite clients were loaded (#18647) (27d70b5)
- deps: update all non-major dependencies (#18691) (f005461)
- deps: update dependency dotenv-expand to v12 (#18697) (0c658de)
- display pre-transform error details (#18764) (554f45f)
- exit code on
SIGTERM(#18741) (cc55e36) - expose missing
InterceptorOptionstype (#18766) (6252c60) - html: fix inline proxy modules invalidation (#18696) (8ab04b7)
- log error when send in module runner failed (#18753) (ba821bb)
- module-runner: make evaluator optional (#18672) (fd1283f)
- optimizer: detect npm / yarn / pnpm dependency changes correctly (#17336) (#18560) (818cf3e)
- optimizer: trigger onCrawlEnd after manual included deps are registered (#18733) (dc60410)
- optimizer: workaround firefox's false warning for no sources source map (#18665) (473424e)
-
ssr: replace
__vite_ssr_identity__with(0, ...)and inject;between statements (#18748) (94546be) - cjs build for perEnvironmentState et al (#18656) (95c4b3c)
-
html: externalize
rollup.externalscripts correctly (#18618) (55461b4) - include more modules to prefix-only module list (#18667) (5a2103f)
-
ssr: format
ssrTransformparse error (#18644) (d9be921) - ssr: preserve fetchModule error details (#18626) (866a433)
- browser field should not be included by default for
consumer: 'server'(#18575) (87b2347) - client: detect ws close correctly (#18548) (637d31b)
- resolve: run ensureVersionQuery for SSR (#18591) (63207e5)
- use
server.perEnvironmentStartEndDuringDev(#18549) (fe30349) - allow nested dependency selector to be used for
optimizeDeps.includefor SSR (#18506) (826c81a) - asset
new URL(,import.meta.url)match (#18194) (5286a90) - close watcher if it's disabled (#18521) (85bd0e9)
- config: write temporary vite config to node_modules (#18509) (72eaef5)
-
css:
cssCodeSplituses the current environment configuration (#18486) (eefe895) -
json: don't
json.stringifyarrays (#18541) (fa50b03) -
less: prevent rebasing
[@import](https://redirect.github.com/import) url(...)(#17857) (aec5fdd) - lib: only resolve css bundle name if have styles (#18530) (5d6dc49)
- scss: improve error logs (#18522) (3194a6a)
-
definein environment config was not working (#18515) (052799e) - build: apply resolve.external/noExternal to server environments (#18495) (5a967cb)
- config: remove error if require resolve to esm (#18437) (f886f75)
- consider URLs with any protocol to be external (#17369) (a0336bd)
- css: remove default import in ssr dev (#17922) (eccf663)
- use picomatch to align with tinyglobby (#18503) (437795d)
-
css:
cssCodeSplitinenvironments.xxx.buildis invalid (#18464) (993e71c) - css: make sass types work with sass-embedded (#18459) (89f8303)
- deps: update all non-major dependencies (#18484) (2ec12df)
- handle warmup glob hang (#18462) (409fa5c)
- manifest: non entry CSS chunk src was wrong (#18133) (c148676)
- module-runner: delay function eval until module runner instantiation (#18480) (472afbd)
- plugins: noop if config hook returns same config reference (#18467) (bd540d5)
- return the same instance of ModuleNode for the same EnvironmentModuleNode (#18455) (5ead461)
- set scripts imported by HTML moduleSideEffects=true (#18411) (2ebe4b4)
- use websocket to test server liveness before client reload (#17891) (7f9f8c6)
- add typing to
CSSOptions.preprocessorOptions(#18001) (7eeb6f2) - default
build.cssMinifyto'esbuild'for SSR (#15637) (f1d3bf7) - dev: prevent double URL encoding in server.open on macOS (#18443) (56b7176)
- preview: set resolvedUrls null after close (#18445) (65014a3)
- ssr: inject identity function at the top (#18449) (0ab20a3)
- ssr: preserve source maps for hoisted imports (fix #16355) (#16356) (8e382a6)
- augment hash for CSS files to prevent chromium erroring by loading previous files (#18367) (a569f42)
-
cli:
--watchshould not overridebuild.watchoptions (#18390) (b2965c8) - css: don't transform sass function calls with namespace (#18414) (dbb2604)
-
deps: update
opendependency to 10.1.0 (#18349) (5cca4bf) - deps: update all non-major dependencies (#18345) (5552583)
- more robust plugin.sharedDuringBuild (#18351) (47b1270)
-
ssr:
thisin exported function should beundefined(#18329) (bae6a37) -
worker: rewrite rollup
output.formatwithworker.formaton worker build error (#18165) (dc82334) -
injectQuerydouble encoding (#18246) (2c5f948) - add position to import analysis resolve exception (#18344) (0fe95d4)
- assets: make srcset parsing HTML spec compliant (#16323) (#18242) (0e6d4a5)
- css: dont remove JS chunk for pure CSS chunk when the export is used (#18307) (889bfc0)
- deps: bump tsconfck (#18322) (67783b2)
- deps: update all non-major dependencies (#18292) (5cac054)
- destroy the runner when runnable environment is closed (#18282) (5212d09)
- handle yarn command fail when root does not exist (#18141) (460aaff)
- hmr: don't try to rewrite imports for direct CSS soft invalidation (#18252) (a03bb0e)
- make it easier to configure environment runner (#18273) (fb35a78)
- middleware-mode: call all hot.listen when server restart (#18261) (007773b)
- optimizer: don't externalize transitive dep package name with asset extension (#18152) (fafc7e2)
- resolve: fix resolve cache key for external conditions (#18332) (93d286c)
-
resolve: fix resolve cache to consider
conditionsand more (#18302) (2017a33) -
types: add more overload to
defineConfig(#18299) (94e34cf) - asset import should skip handling data URIs (#18163) (70813c7)
- cache the runnable environment module runner (#18215) (95020ab)
- call
this.hot.closefor non-ws HotChannel (#18212) (bad0ccc) - close HotChannel on environment close (#18206) (2d148e3)
- config: treat all files as ESM on deno (#18081) (c1ed8a5)
- css: ensure sass compiler initialized only once (#18128) (4cc5322)
- css: fix lightningcss dep url resolution with custom root (#18125) (eb08f60)
- css: fix missing source file warning with sass modern api custom importer (#18113) (d7763a5)
-
data-uri: only match ids starting with
data:(#18241) (ec0efe8) - deps: update all non-major dependencies (#18170) (c8aea5a)
- deps: upgrade rollup 4.22.4+ to ensure avoiding XSS (#18180) (ea1d0b9)
-
html: make build-html plugin work with
sharedPlugins(#18214) (34041b9) - mixedModuleGraph: handle undefined id in getModulesByFile (#18201) (768a50f)
-
optimizer: re-optimize when changing config
webCompatible(#18221) (a44b0a2) - require serialization for
HMRConnection.sendon implementation side (#18186) (9470011) - ssr: fix source map remapping with multiple sources (#18150) (e003a2c)
- use
config.consumerinstead ofoptions?.ssr/config.build.ssr(#18140) (21ec1ce) - vite: refactor "module cache" to "evaluated modules", pass down module to "runInlinedModule" (#18092) (e83beff)
- avoid DOM Clobbering gadget in
getRelativeUrlFromDocument(#18115) (ade1d89) - fs raw query (#18112) (9d2413c)
- preload: throw error preloading module as well (#18098) (ba56cf4)
- allow scanning exports from
script modulein svelte (#18063) (7d699aa) -
build: declare
preload-helperhas no side effects (#18057) (587ad7b) - css: fallback to mainthread if logger or pkgImporter option is set for sass (#18071) (d81dc59)
- dynamicImportVars: correct glob pattern for paths with parentheses (#17940) (2a391a7)
- ensure req.url matches moduleByEtag URL to avoid incorrect 304 (#17997) (abf04c3)
- html: escape html attribute (#18067) (5983f36)
- incorrect environment consumer option resolution (#18079) (0e3467e)
- preload: allow ignoring dep errors (#18046) (3fb2889)
- store backwards compatible
ssrModuleandssrError(#18031) (cf8ced5)
Performance Improvements
- reduce bundle size for
Object.keys(import.meta.glob(...))/Object.values(import.meta.glob(...))(#18666) (ed99a2c) - worker: inline worker without base64 (#18752) (90c66c9)
- remove strip-ansi for a node built-in (#18630) (5182272)
- css: skip style.css extraction if code-split css (#18470) (34fdb6b)
- call
module.enableCompileCache()(#18323) (18f1dad) - use
crypto.hashwhen available (#18317) (2a14884)
Documentation
- rename
HotUpdateContexttoHotUpdateOptions(#18718) (824c347) - add jsdocs to flags in BuilderOptions (#18516) (1507068)
- missing changes guides (#18491) (5da78a6)
- update fs.deny default in JSDoc (#18514) (1fcc83d)
- update homepage (#18274) (a99a0aa)
- fix typo in proxy.ts (#18162) (49087bd)
Reverts
Miscellaneous Chores
- add 5.4.x changelogs (#18768) (26b58c8)
- add some comments about mimes (#18705) (f07e9b9)
- deps: update all non-major dependencies (#18746) (0ad16e9)
- deps: update all non-major dependencies (#18634) (e2231a9)
- deps: update transitive deps (#18602) (0c8b152)
- tweak build config (#18622) (2a88f71)
- add warning for
/mapping inresolve.alias(#18588) (a51c254) - deps: update all non-major dependencies (#18562) (fb227ec)
- remove unused
ssrvariable (#18594) (23c39fc) - fix moduleSideEffects in build script on Windows (#18518) (25fe9e3)
- use premove instead of rimraf (#18499) (f97a578)
- deps: update postcss-load-config to v6 (#15235) (3a27f62)
- deps: update dependency picomatch to v4 (#15876) (3774881)
- combine deps license with same text (#18356) (b5d1a05)
- create-vite: mark template files as CC0 (#18366) (f6b9074)
- deps: bump TypeScript to 5.6 (#18254) (57a0e85)
-
deps: migrate
fast-globtotinyglobby(#18243) (6f74a3a) - deps: update all non-major dependencies (#18404) (802839d)
- deps: update dependency sirv to v3 (#18346) (5ea4b00)
- fix grammar ([#R
Configuration
📅 Schedule: Branch creation - "" in timezone UTC, 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 this update again.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
Netlify deploy preview
https://deploy-preview-47072--material-ui.netlify.app/
Bundle size report
| Bundle | Parsed size | Gzip size |
|---|---|---|
| @mui/material | 0B(0.00%) | 0B(0.00%) |
| @mui/lab | 0B(0.00%) | 0B(0.00%) |
| @mui/system | 0B(0.00%) | 0B(0.00%) |
| @mui/utils | 0B(0.00%) | 0B(0.00%) |
Generated by :no_entry_sign: dangerJS against fbb9cd40356a76ca24123926c084aa7a174dcf05