Skip to content

[Security] Bump esbuild, vitest and @vitejs/plugin-react

Bumps esbuild to 0.25.2 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.2 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:

  1. The attacker serves a malicious web page (http://malicious.example.com).
  2. The user accesses the malicious web page.
  3. 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.
  4. 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.2

  • Support flags in regular expressions for the API (#4121)

    The JavaScript plugin API for esbuild takes JavaScript regular expression objects for the filter option. Internally these are translated into Go regular expressions. However, this translation previously ignored the flags property of the regular expression. With this release, esbuild will now translate JavaScript regular expression flags into Go regular expression flags. Specifically the JavaScript regular expression /\.[jt]sx?$/i is turned into the Go regular expression `(?i)\.[jt]sx?$` internally inside of esbuild's API. This should make it possible to use JavaScript regular expressions with the i flag. Note that JavaScript and Go don't support all of the same regular expression features, so this mapping is only approximate.

  • Fix node-specific annotations for string literal export names (#4100)

    When node instantiates a CommonJS module, it scans the AST to look for names to expose via ESM named exports. This is a heuristic that looks for certain patterns such as exports.NAME = ... or module.exports = { ... }. This behavior is used by esbuild to "annotate" CommonJS code that was converted from ESM with the original ESM export names. For example, when converting the file export let foo, bar from ESM to CommonJS, esbuild appends this to the end of the file:

    // Annotate the CommonJS export names for ESM import in node:
    0 && (module.exports = {
      bar,
      foo
    });

    However, this feature previously didn't work correctly for export names that are not valid identifiers, which can be constructed using string literal export names. The generated code contained a syntax error. That problem is fixed in this release:

    // Original code
    let foo
    export { foo as "foo!" }
    // Old output (with --format=cjs --platform=node)
    ...
    0 && (module.exports = {
    "foo!"
    });
    // New output (with --format=cjs --platform=node)
    ...
    0 && (module.exports = {
    "foo!": null
    });
  • Basic support for index source maps (#3439, #4109)

    The source map specification has an optional mode called index source maps that makes it easier for tools to create an aggregate JavaScript file by concatenating many smaller JavaScript files with source maps, and then generate an aggregate source map by simply providing the original source maps along with some offset information. My understanding is that this is rarely used in practice. I'm only aware of two uses of it in the wild: ClojureScript and Turbopack.

    This release provides basic support for indexed source maps. However, the implementation has not been tested on a real app (just on very simple test input). If you are using index source maps in a real app, please try this out and report back if anything isn't working for you.

    Note that this is also not a complete implementation. For example, index source maps technically allows nesting source maps to an arbitrary depth, while esbuild's implementation in this release only supports a single level of nesting. It's unclear whether supporting more than one level of nesting is important or not given the lack of available test cases.

    This feature was contributed by @​clyfish.

v0.25.1

... (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 and import.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 though import is normally a keyword that can't be used as an identifier, ES modules special-case the import.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 in tsconfig.json (#4004)

    TypeScript recently added es2024 as a compilation target, so esbuild now supports this in the target field of tsconfig.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 and pure 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

Updates vitest from 2.1.1 to 3.1.2

Release notes

Sourced from vitest's releases.

v3.1.2

   🐞 Bug Fixes

   🏎️ Performance

    View changes on GitHub

v3.1.1

   🐞 Bug Fixes

    View changes on GitHub

v3.1.0

🚀 Features

... (truncated)

Commits
  • 5a0afd1 chore: release v3.1.2
  • b70a6f1 chore(deps): unbundle tinyglobby and update (#7864)
  • f9eacbc fix(vite-node): add ERR_MODULE_NOT_FOUND code error if module cannot be loade...
  • 3102986 docs: browser.provider link (#7851)
  • 816a5c5 perf(browser): improve browser parallelisation (#7665)
  • 6743008 fix: use happy-dom/jsdom types for envionmentOptions (#7795)
  • 6358f21 fix: default to run mode when stdin is not a TTY (#7673)
  • 15701f5 fix(deps): update all non-major dependencies (#7831)
  • 5652bf9 fix(coverage): expose profiling timers (#7820)
  • 29084f1 chore(deps): update all non-major dependencies (#7802)
  • Additional commits viewable in compare view

Updates @vitejs/plugin-react from 4.3.1 to 4.4.1

Release notes

Sourced from @​vitejs/plugin-react's releases.

plugin-react@4.4.1

Fix type issue when using moduleResolution: "node" in tsconfig #462

plugin-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 option

Add 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#183

export 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 and runtimeModule was removed. vite-plugin-react will still detect runtimeModule for backwards compatibility.

When using a custom runtimeModule or target !== '19', the plugin will not try to pre-optimize react/compiler-runtime dependency.

The react-compiler-runtime is now available on npm can be used instead of the local shim for people using the compiler with React < 19.

Here is the configuration to use the compiler with React 18 and correct source maps in development:

npm install babel-plugin-react-compiler react-compiler-runtime @babel/plugin-transform-react-jsx-development
</tr></table> 

... (truncated)

Changelog

Sourced from @​vitejs/plugin-react's changelog.

4.4.1 (2025-04-19)

Fix type issue when using moduleResolution: "node" in tsconfig #462

4.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 option

Add 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#183

export 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)

React Compiler runtimeModule option removed

React Compiler was updated to accept a target option and runtimeModule was removed. vite-plugin-react will still detect runtimeModule for backwards compatibility.

When using a custom runtimeModule or target !== '19', the plugin will not try to pre-optimize react/compiler-runtime dependency.

The react-compiler-runtime is now available on npm can be used instead of the local shim for people using the compiler with React < 19.

Here is the configuration to use the compiler with React 18 and correct source maps in development:

... (truncated)

Commits
  • 57cc398 release: plugin-react@4.4.1
  • a62bdd6 fix(react): fix package.json types (#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
  • bd1a1ad fix(deps): update all non-major dependencies (#392)
  • 87f7fdd feat: add reactRefreshHost option to support module federation HMR (#420)
  • da01d56 release: plugin-react@4.4.0-beta.1
  • 9b1b510 chore: fix refresh runtime path in dev (#444)
  • 8258442 release: plugin-react@4.4.0-beta.0
  • Additional commits viewable in compare view

Merge request reports

Loading