Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency esbuild to ^0.25.0 [SECURITY] #71

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 11, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
esbuild ^0.24.2 -> ^0.25.0 age adoption passing confidence

GitHub Vulnerability Alerts

GHSA-67mh-4wv8-2f99

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

  • Fetching /index.html: normally you have a script tag here
  • Fetching /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
  • Connecting /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)))
  • Fetching URLs in the known file: once the attacker knows one file, the attacker can know the URLs imported from that file

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.

PoC

  1. Download reproduction.zip
  2. Extract it and move to that directory
  3. Run npm i
  4. Run npm run watch
  5. Run 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.

image

Impact

Users using the serve feature may get the source code stolen by malicious websites.


  • If you want to rebase/retry this PR, check this box

Copy link
Contributor Author

renovate bot commented Feb 11, 2025

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: package-lock.json
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @jgoz/[email protected]
npm error Found: [email protected]
npm error node_modules/esbuild
npm error   dev esbuild@"^0.25.0" from the root project
npm error   peer esbuild@">= 0.14.0" from [email protected]
npm error   node_modules/esbuild-plugin-clean
npm error     dev esbuild-plugin-clean@"^1.0.1" from the root project
npm error   2 more (esbuild-plugin-copy, esbuild-sass-plugin)
npm error
npm error Could not resolve dependency:
npm error peer esbuild@"0.17.x || 0.18.x || 0.19.x || 0.20.x || 0.21.x || 0.22.x || 0.23.x || 0.24.x" from @jgoz/[email protected]
npm error node_modules/@jgoz/esbuild-plugin-typecheck
npm error   dev @jgoz/esbuild-plugin-typecheck@"^4.0.2" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/esbuild
npm error   peer esbuild@"0.17.x || 0.18.x || 0.19.x || 0.20.x || 0.21.x || 0.22.x || 0.23.x || 0.24.x" from @jgoz/[email protected]
npm error   node_modules/@jgoz/esbuild-plugin-typecheck
npm error     dev @jgoz/esbuild-plugin-typecheck@"^4.0.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /tmp/renovate/cache/others/npm/_logs/2025-02-11T08_32_52_935Z-eresolve-report.txt
npm error A complete log of this run can be found in: /tmp/renovate/cache/others/npm/_logs/2025-02-11T08_32_52_935Z-debug-0.log

Copy link
Contributor Author

renovate bot commented Feb 11, 2025

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@devkokov devkokov merged commit 767287b into main Feb 11, 2025
6 checks passed
@devkokov devkokov deleted the renovate-npm-esbuild-vulnerability branch February 11, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant