[Security] Bump esbuild, vitest and @vitejs/plugin-react
Bumps esbuild to 0.25.5 and updates ancestor dependencies esbuild, vitest and @vitejs/plugin-react. These dependencies need to be updated together.
Updates esbuild
from 0.21.5 to 0.25.5 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#L363
Attack 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.5
Fix a regression with
browser
inpackage.json
(#4187)The fix to #4144 in version 0.25.3 introduced a regression that caused
browser
overrides specified inpackage.json
to fail to override relative path names that end in a trailing slash. That behavior change affected theaxios@0.30.0
package. This regression has been fixed, and now has test coverage.Add support for certain keywords as TypeScript tuple labels (#4192)
Previously esbuild could incorrectly fail to parse certain keywords as TypeScript tuple labels that are parsed by the official TypeScript compiler if they were followed by a
?
modifier. These labels includedfunction
,import
,infer
,new
,readonly
, andtypeof
. With this release, these keywords will now be parsed correctly. Here's an example of some affected code:type Foo = [ value: any, readonly?: boolean, // This is now parsed correctly ]
Add CSS prefixes for the
stretch
sizing value (#4184)This release adds support for prefixing CSS declarations such as
div { width: stretch }
. That CSS is now transformed into this depending on what the--target=
setting includes:div { width: -webkit-fill-available; width: -moz-available; width: stretch; }
v0.25.4
Add simple support for CORS to esbuild's development server (#4125)
Starting with version 0.25.0, esbuild's development server is no longer configured to serve cross-origin requests. This was a deliberate change to prevent any website you visit from accessing your running esbuild development server. However, this change prevented (by design) certain use cases such as "debugging in production" by having your production website load code from
localhost
where the esbuild development server is running.To enable this use case, esbuild is adding a feature to allow Cross-Origin Resource Sharing (a.k.a. CORS) for simple requests. Specifically, passing your origin to the new
cors
option will now set theAccess-Control-Allow-Origin
response header when the request has a matchingOrigin
header. Note that this currently only works for requests that don't send a preflightOPTIONS
request, as esbuild's development server doesn't currently supportOPTIONS
requests.Some examples:
CLI:
esbuild --servedir=. --cors-origin=https://example.com
JS:
const ctx = await esbuild.context({}) await ctx.serve({ servedir: '.', cors: {
... (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).
0.24.2
Fix regression with
--define
andimport.meta
(#4010, #4012, #4013)The previous change in version 0.24.1 to use a more expression-like parser for
define
values to allow quoted property names introduced a regression that removed the ability to use--define:import.meta=...
. Even thoughimport
is normally a keyword that can't be used as an identifier, ES modules special-case theimport.meta
expression to behave like an identifier anyway. This change fixes the regression.This fix was contributed by
@sapphi-red
.0.24.1
Allow
es2024
as a target intsconfig.json
(#4004)TypeScript recently added
es2024
as a compilation target, so esbuild now supports this in thetarget
field oftsconfig.json
files, such as in the following configuration file:{ "compilerOptions": { "target": "ES2024" } }
As a reminder, the only thing that esbuild uses this field for is determining whether or not to use legacy TypeScript behavior for class fields. You can read more in the documentation.
This fix was contributed by
@billyjanitsch
.Allow automatic semicolon insertion after
get
/set
This change fixes a grammar bug in the parser that incorrectly treated the following code as a syntax error:
class Foo { get *x() {} set *y() {} }
The above code will be considered valid starting with this release. This change to esbuild follows a similar change to TypeScript which will allow this syntax starting with TypeScript 5.7.
Allow quoted property names in
--define
and--pure
(#4008)The
define
andpure
API options now accept identifier expressions containing quoted property names. Previously all identifiers in the identifier expression had to be bare identifiers. This change now makes--define
and--pure
consistent with--global-name
, which already supported quoted property names. For example, the following is now possible:
... (truncated)
Commits
-
ea453bf
publish 0.25.5 to npm -
223ddc6
fix #4187: browserpackage.json
regression -
b2c8251
fix #4192: typescript tuple label parser edge case -
28cf2f3
fix #4184: css prefixes forstretch
-
bee1b09
fix comment indents -
9ddfe5f
runmake update-compat-table
-
c339f34
fix a misplaced comment -
218d29e
publish 0.25.4 to npm -
e66cd0b
dev server: simple support for CORS requests (#4171) -
8bf3368
js api: validate some options as arrays of strings - Additional commits viewable in compare view
Updates vitest
from 2.1.1 to 3.1.4
Release notes
Sourced from vitest's releases.
v3.1.4
🐞 Bug Fixes
- Apply browser CLI options only if the project has the browser set in the config already - by
@sheremet-va
in vitest-dev/vitest#8002 (64f2b)View changes on GitHub
v3.1.3
🐞 Bug Fixes
- Correctly resolve vitest import if
inline: true
is set - by@sheremet-va
in vitest-dev/vitest#7856 (a83f3)- Fix fixture parsing with lowered async with esbuild 0.25.3 - by
@hi-ogawa
in vitest-dev/vitest#7921 (c5c85)- Remove event-catcher code - by
@sheremet-va
in vitest-dev/vitest#7898 (deb1b)- Reset mocks on test retry/repeat - by
@sheremet-va
in vitest-dev/vitest#7897 (2fa76)- Ignore failures on writeToCache - by
@orgads
in vitest-dev/vitest#7893 (8c7f7)- browser: Correctly inherit CLI options - by
@sheremet-va
in vitest-dev/vitest#7858 (03660)- deps: Update all non-major dependencies - in vitest-dev/vitest#7867 (67ef7)
- reporters:
--merge-reports
to show each total run times - by@AriPerkkio
in vitest-dev/vitest#7877 (d613b)View changes on GitHub
v3.1.2
🐞 Bug Fixes
- Add global
chai
variable invitest/globals
(fix: #7474) - by@Jay-Karia
in vitest-dev/vitest#7771 and vitest-dev/vitest#7474 (d9297)- Prevent modifying
test.exclude
when same object passed incoverage.exclude
- by@AriPerkkio
in vitest-dev/vitest#7774 (c3751)- Fix already hoisted mock - by
@hi-ogawa
in vitest-dev/vitest#7815 (773b1)- Fix test.scoped inheritance - by
@hi-ogawa
in vitest-dev/vitest#7814 (db6c3)- Remove pointer-events-none after resizing the left panel - by
@alexprudhomme
in vitest-dev/vitest#7811 (a7e77)- Default to run mode when stdin is not a TTY - by
@kentonv
,@hi-ogawa
and@sheremet-va
in vitest-dev/vitest#7673 (6358f)- Use happy-dom/jsdom types for
envionmentOptions
- by@hi-ogawa
in vitest-dev/vitest#7795 (67430)- browser:
- Fix transform error before browser server initialization - by
@hi-ogawa
in vitest-dev/vitest#7783 (5f762)- Fix mocking from outside of root - by
@hi-ogawa
in vitest-dev/vitest#7789 (03f55)- Scale iframe for non ui case - by
@hi-ogawa
in vitest-dev/vitest#6512 (c3374)- coverage:
await
profiler calls - by@AriPerkkio
in vitest-dev/vitest#7763 (795a6)- Expose profiling timers - by
@AriPerkkio
in vitest-dev/vitest#7820 (5652b)- deps:
- Update all non-major dependencies - in vitest-dev/vitest#7765 (7c3df)
- Update all non-major dependencies - in vitest-dev/vitest#7831 (15701)
- runner:
- Correctly call test hooks and teardown functions - by
@sheremet-va
in vitest-dev/vitest#7775 (3c00c)- Show stacktrace on test timeout error - by
@hi-ogawa
in vitest-dev/vitest#7799 (df33b)- ui:
- Load panel sizes from storage on initial load - by
@userquin
in vitest-dev/vitest#7265 (6555d)- vite-node:
- Named export should overwrite export all - by
@hi-ogawa
in vitest-dev/vitest#7846 (5ba0d)- Add ERR_MODULE_NOT_FOUND code error if module cannot be loaded - by
@sheremet-va
in vitest-dev/vitest#7776 (f9eac)
... (truncated)
Commits
-
ac88181
chore: release v3.1.4 -
64f2b43
fix: apply browser CLI options only if the project has the browser set in the... -
6e8d937
chore: release v3.1.3 -
8c7f75a
fix: ignore failures on writeToCache (#7893) -
d613b81
fix(reporters):--merge-reports
to show each total run times (#7877) -
2fa763a
fix: reset mocks on test retry/repeat (#7897) -
573cb16
ci: fix flaky browser tests (#7887) -
03660f9
fix(browser): correctly inherit CLI options (#7858) -
a83f3bf
fix: correctly resolve vitest import ifinline: true
is set (#7856) -
5a0afd1
chore: release v3.1.2 - Additional commits viewable in compare view
Updates @vitejs/plugin-react
from 4.3.1 to 4.5.0
Release notes
Sourced from @vitejs/plugin-react
's releases.
plugin-react@4.5.0
Add
filter
for rolldown-vite #470Added
filter
so that it is more performant when running this plugin with rolldown-powered version of Vite.Skip HMR for JSX files with hooks #480
This removes the HMR warning for hooks with JSX.
plugin-react@4.4.1
Fix type issue when using
moduleResolution: "node"
in tsconfig #462plugin-react@4.4.0
Make compatible with rolldown-vite
This plugin is now compatible with rolldown-powered version of Vite. Note that currently the
__source
property value position might be incorrect. This will be fixed in the near future.plugin-react@4.4.0-beta.2
Add
reactRefreshHost
optionAdd
reactRefreshHost
option to set a React Fast Refresh runtime URL prefix. This is useful in a module federation context to enable HMR by specifying the host application URL in the Vite config of a remote application. See full discussion here: module-federation/vite#183export default defineConfig({ plugins: [react({ reactRefreshHost: 'http://localhost:3000' })], })
plugin-react@4.4.0-beta.1
No release notes provided.
plugin-react@4.3.4
Add Vite 6 to peerDependencies range
Vite 6 is highly backward compatible, not much to add!
Force Babel to output spec compliant import attributes #386
The default was an old spec (
with type: "json"
). We now enforce spec compliant (with { type: "json" }
)plugin-react@4.3.3
React Compiler runtimeModule option removed
React Compiler was updated to accept a
target
option andruntimeModule
was removed. vite-plugin-react will still detectruntimeModule
for backwards compatibility.When using a custom
runtimeModule
ortarget !== '19'
, the plugin will not try to pre-optimizereact/compiler-runtime
dependency.
... (truncated)
Changelog
Sourced from @vitejs/plugin-react
's changelog.
4.5.0 (2025-05-23)
Add
filter
for rolldown-vite #470Added
filter
so that it is more performant when running this plugin with rolldown-powered version of Vite.Skip HMR for JSX files with hooks #480
This removes the HMR warning for hooks with JSX.
4.4.1 (2025-04-19)
Fix type issue when using
moduleResolution: "node"
in tsconfig #4624.4.0 (2025-04-15)
Make compatible with rolldown-vite
This plugin is now compatible with rolldown-powered version of Vite. Note that currently the
__source
property value position might be incorrect. This will be fixed in the near future.4.4.0-beta.2 (2025-04-15)
Add
reactRefreshHost
optionAdd
reactRefreshHost
option to set a React Fast Refresh runtime URL prefix. This is useful in a module federation context to enable HMR by specifying the host application URL in the Vite config of a remote application. See full discussion here: module-federation/vite#183export default defineConfig({ plugins: [react({ reactRefreshHost: 'http://localhost:3000' })], })
4.4.0-beta.1 (2025-04-09)
4.4.0-beta.0 (2025-04-09)
4.3.4 (2024-11-26)
Add Vite 6 to peerDependencies range
Vite 6 is highly backward compatible, not much to add!
Force Babel to output spec compliant import attributes #386
The default was an old spec (
with type: "json"
). We now enforce spec compliant (with { type: "json" }
)4.3.3 (2024-10-19)
... (truncated)
Commits
-
476e705
release: plugin-react@4.5.0 -
02b1ede
fix(hmr): skip HMR for JSX files with hooks (#480) -
5a94bd7
feat: add filter (#470) -
7517103
fix(react): inject__self
and__source
by babel for rolldown-vite (#467) -
ec1dfb3
chore: fix link in changelog (#463) -
57cc398
release: plugin-react@4.4.1 -
a62bdd6
fix(react): fix package.jsontypes
(#462) -
8beda4f
release: plugin-react@4.4.0 -
fffe4ad
feat: add support for rolldown-vite (#451) -
c197fd9
release: plugin-react@4.4.0-beta.2 - Additional commits viewable in compare view