[Security] Bump esbuild and vite
Bumps esbuild to 0.25.0 and updates ancestor dependency vite. These dependencies need to be updated together.
Updates esbuild from 0.24.2 to 0.25.0 This update includes a security fix.
Vulnerabilities fixed
esbuild enables any website to send any requests to the development server and read the response
Summary
esbuild allows any websites to send any request to the development server and read the response due to default CORS settings.
Details
esbuild sets
Access-Control-Allow-Origin: *header to all requests, including the SSE connection, which allows any websites to send any request to the development server and read the response.https://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/pkg/api/serve_other.go#L121
https://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/pkg/api/serve_other.go#L363Attack scenario:
- The attacker serves a malicious web page (
http://malicious.example.com).- The user accesses the malicious web page.
- The attacker sends a
fetch('http://127.0.0.1:8000/main.js')request by JS in that malicious web page. This request is normally blocked by same-origin policy, but that's not the case for the reasons above.- The attacker gets the content of
http://127.0.0.1:8000/main.js.In this scenario, I assumed that the attacker knows the URL of the bundle output file name. But the attacker can also get that information by
... (truncated)
Patched versions: 0.25.0
Affected versions: <= 0.24.2
Release notes
Sourced from esbuild's releases.
v0.25.0
This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of
esbuildin yourpackage.jsonfile (recommended) or be using a version range syntax that only accepts patch upgrades such as^0.24.0or~0.24.0. See npm's documentation about semver for more information.
Restrict access to esbuild's development server (GHSA-67mh-4wv8-2f99)
This change addresses esbuild's first security vulnerability report. Previously esbuild set the
Access-Control-Allow-Originheader to*to allow esbuild's development server to be flexible in how it's used for development. However, this allows the websites you visit to make HTTP requests to esbuild's local development server, which gives read-only access to your source code if the website were to fetch your source code's specific URL. You can read more information in the report.Starting with this release, CORS will now be disabled, and requests will now be denied if the host does not match the one provided to
--serve=. The default host is0.0.0.0, which refers to all of the IP addresses that represent the local machine (e.g. both127.0.0.1and192.168.0.1). If you want to customize anything about esbuild's development server, you can put a proxy in front of esbuild and modify the incoming and/or outgoing requests.In addition, the
serve()API call has been changed to return an array ofhostsinstead of a singlehoststring. This makes it possible to determine all of the hosts that esbuild's development server will accept.Thanks to
@sapphi-redfor reporting this issue.Delete output files when a build fails in watch mode (#3643)
It has been requested for esbuild to delete files when a build fails in watch mode. Previously esbuild left the old files in place, which could cause people to not immediately realize that the most recent build failed. With this release, esbuild will now delete all output files if a rebuild fails. Fixing the build error and triggering another rebuild will restore all output files again.
Fix correctness issues with the CSS nesting transform (#3620, #3877, #3933, #3997, #4005, #4037, #4038)
This release fixes the following problems:
Naive expansion of CSS nesting can result in an exponential blow-up of generated CSS if each nesting level has multiple selectors. Previously esbuild sometimes collapsed individual nesting levels using
:is()to limit expansion. However, this collapsing wasn't correct in some cases, so it has been removed to fix correctness issues./* Original code */ .parent { > .a, > .b1 > .b2 { color: red; } } /* Old output (with --supported:nesting=false) */ .parent > :is(.a, .b1 > .b2) { color: red; } /* New output (with --supported:nesting=false) */ .parent > .a, .parent > .b1 > .b2 { color: red; }Thanks to
@tim-wefor working on a fix.The
&CSS nesting selector can be repeated multiple times to increase CSS specificity. Previously esbuild ignored this possibility and incorrectly considered&&to have the same specificity as&. With this release, this should now work correctly:/* Original code (color should be red) */
... (truncated)
Changelog
Sourced from esbuild's changelog.
Changelog: 2024
This changelog documents all esbuild versions published in the year 2024 (versions 0.19.12 through 0.24.2).
Commits
-
e9174d6publish 0.25.0 to npm -
c27dbebfixhostsinplugin-tests.js -
6794f60fixhostsinnode-unref-tests.js -
de85afdMerge commit from fork -
da1de1bfix #4065: bitwise operators can return bigints -
f4e9d19switch case liveness:defaultis always last -
7aa47c3fix #4028: minify live/deadswitchcases better -
22ecd30minify: more constant folding for strict equality -
4cdf03cfix #4053: reordering of.tsxinnode_modules -
dc71977fix #3692:0now picks a random ephemeral port - Additional commits viewable in compare view
Updates vite from 6.1.1 to 6.2.0
Release notes
Sourced from vite's releases.
create-vite@6.2.0
Please refer to CHANGELOG.md for details.
v6.2.0
Please refer to CHANGELOG.md for details.
v6.2.0-beta.1
Please refer to CHANGELOG.md for details.
v6.2.0-beta.0
Please refer to CHANGELOG.md for details.
Changelog
Sourced from vite's changelog.
6.2.0 (2025-02-25)
- fix(deps): update all non-major dependencies (#19501) (c94c9e0), closes #19501
- fix(worker): string interpolation in dynamic worker options (#19476) (07091a1), closes #19476
- chore: use unicode cross icon instead of x (#19497) (5c70296), closes #19497
6.2.0-beta.1 (2025-02-21)
- fix(css): temporary add
?.afterthis.getModuleInfoinvite:css-post(#19478) (12b0b8a), closes #194786.2.0-beta.0 (2025-02-21)
- feat: show
modeon server start and add env debugger (#18808) (c575b82), closes #18808- feat: use host url to open browser (#19414) (f6926ca), closes #19414
- feat(css): allow scoping css to importers exports (#19418) (3ebd838), closes #19418
- chore: bump esbuild to 0.25.0 (#19389) (73987f2), closes #19389
Commits
-
fa7c211chore: update 6.1.0 changelog (#19363) -
051370arelease: v6.1.0 -
6e0e3c0refactor: deprecatevite optimizecommand (#19348) -
7c2a794feat: use native runtime to import the config (#19178) -
fcd5785fix(build): fix stale build manifest on watch rebuild (#19361) -
a5e306ffeat: show hosts in cert in CLI (#19317) -
4d88f6cfeat: support for env var for defining allowed hosts (#19325) -
fdb36e0fix: avoid builtStart during vite optimize (#19356) -
5ce7443release: v6.1.0-beta.2 -
e7b4ba3fix(html): fix css disorder when building multiple entry html (#19143) - Additional commits viewable in compare view
Dependabot commands
You can trigger Dependabot actions by commenting on this MR
-
$dependabot recreatewill recreate this MR rewriting all the manual changes and resolving conflicts