Esbuild version 0.23.1 represents a minor update over its predecessor, version 0.23.0, in the popular JavaScript and CSS bundling and minification tool. Both versions share the same core description: being an "extremely fast" bundler and minifier, a key selling point for developers prioritizing build speed. The MIT license and source code repository remain consistent, ensuring continued open-source availability and contribution opportunities.
The most noticeable difference lies in the optionalDependencies. While the list of optional dependencies remains identical, supporting a wide range of platforms from Windows (ia32, x64, arm64) and Linux (various architectures including arm, x64, and more exotic ones like loong64 and riscv64) to macOS (x64, arm64) and others, the version numbers of these dependencies are incremented to "0.23.1" to match the parent package. This probably signals internal updates for platform-specific components, possibly addressing bugs or optimizations.
Another difference is in the dist metadata. The unpacked size has slightly increased from 133567 bytes in version 0.23.0 to 133628 bytes in version 0.23.1. The number of files stays the same. This minimal size bump suggests that the changes are contained within existing files rather than the addition of new ones. Most important the release date moves from July 2nd, 2024 to August 16th, 2024, so the version contains the bug fixes until that date.
For developers, this update likely represents a stability and refinement release. While no new features are explicitly mentioned, the updated dependencies and minor size increase imply bug fixes, performance improvements, or enhanced compatibility. Users of esbuild should consider upgrading to version 0.23.1 for a more robust and potentially faster bundling experience across various operating systems and architectures.
All the vulnerabilities related to the version 0.23.1 of the package
esbuild enables any website to send any requests to the development server and read the response
esbuild allows any websites to send any request to the development server and read the response due to default CORS settings.
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:
http://malicious.example.com).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.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
/index.html: normally you have a script tag here/assets: it's common to have a assets directory when you have JS files and CSS files in a different directory and the directory listing feature tells the attacker the list of files/esbuild SSE endpoint: the SSE endpoint sends the URL path of the changed files when the file is changed (new EventSource('/esbuild').addEventListener('change', e => console.log(e.type, e.data)))The scenario above fetches the compiled content, but if the victim has the source map option enabled, the attacker can also get the non-compiled content by fetching the source map file.
npm inpm run watchfetch('http://127.0.0.1:8000/app.js').then(r => r.text()).then(content => console.log(content)) in a different website's dev tools.Users using the serve feature may get the source code stolen by malicious websites.