Esbuild version 0.6.9 represents a minor update over its predecessor, version 0.6.8, in the fast-paced world of JavaScript bundlers. Both versions maintain the core promise of esbuild: exceptional speed in bundling and minifying JavaScript code, a crucial factor for developers striving for optimal website performance and faster build times.
However, the differences reside in what this patch brought to the table. Examining the provided data, a notable change is the increase in unpackedSize from 26902 to 29537. This 2.6KB size increase indicates that version 0.6.9 likely incorporates new features, bug fixes or performance improvements that add to the overall package size.
The release dates also reveal a very short turn around between minor versions, with version 0.6.9 released just two days after version 0.6.8. This suggests that the changes introduced are likely of high importance, with bug fixes or minor features being introduced very quickly. While the description remains identical, the updated version is likely focusing on enhanced stability and reliability, aiming for a better developer experience in this new package.
Developers should consider upgrading to version 0.6.9 to benefit from any potential performance optimizations and bug fixes implemented within the package. Despite the relatively short release cycle between minor versions, it is always best to stay up to date with library releases in order to benefit from the latest quality of life changes.
All the vulnerabilities related to the version 0.6.9 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 i
npm run watch
fetch('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.