GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: reject cross-site requests to open-editor and invalidate endpoints by bjohansebas · Pull Request #5691 · webpack/webpack-dev-server Conversation
Member
Summary Basically, this only protects against external websites calling those endpoints. It doesn't protect against Node.js scripts or In contrast, when a request is made with What kind of change does this PR introduce? Did you add tests for your changes? Does this PR introduce a breaking change? If relevant, what needs to be documented once your changes are merged or what have you already documented? Use of AI
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
🦋 Changeset detectedLatest commit: f4a545d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #5691 +/- ## ========================================== + Coverage 89.23% 89.30% +0.07% ========================================== Files 13 13 Lines 6082 6124 +42 ========================================== + Hits 5427 5469 +42 Misses 655 655 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // otherwise fall back to the `Origin`/`Host` comparison. | ||
| if (typeof headers.origin !== "string") { | ||
| return true; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
From what I've tested, the browser doesn't send an Origin header in this case
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Also, without this, we could break a simple curl request, which isn't a good idea.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
55a3d85 to
f4a545d
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This PR hardens webpack-dev-server’s internal, state-changing endpoints (/webpack-dev-server/open-editor and /webpack-dev-server/invalidate) against cross-site request forgery by rejecting cross-site browser requests based on Fetch Metadata (Sec-Fetch-Site) with an Origin/Host fallback.
Changes:
invalidate and open-editor endpoints in Server.launch-editor (and lockfile transitive updates) and add a changeset entry.Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/Server.js |
Adds same-origin request gating for invalidate and open-editor, introducing #isSameOriginRequest to block cross-site triggers. |
test/e2e/cross-origin-request.test.js |
Adds new CSRF-focused tests for the internal endpoints, including browser-driven Fetch Metadata coverage. |
package.json |
Updates launch-editor dependency version. |
package-lock.json |
Updates resolved versions/integrity for launch-editor and transitive shell-quote. |
.changeset/fix-cross-site-request-forgery.md |
Documents the security fix as a patch release note. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.