mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #571] [MERGED] fix: harden origin validation and proxy request handling #679
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#679
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/571
Author: @mhart
Created: 3/17/2026
Status: ✅ Merged
Merged: 3/17/2026
Merged by: @southpolesteve
Base:
main← Head:origin-checks📝 Commits (4)
ec0c8cdTreatOrigin: "null"as an explicit cross-origin valuedfa9382Further hardening0500d8dAdd Vite HMR websocket token regression tests69d635fAdd clarifying comment and share a single dev server📊 Changes
9 files changed (+314 additions, -30 deletions)
View changed files
📝
packages/vinext/src/config/config-matchers.ts(+37 -2)📝
packages/vinext/src/server/dev-origin-check.ts(+18 -3)📝
packages/vinext/src/server/request-pipeline.ts(+18 -5)📝
tests/__snapshots__/entry-templates.test.ts.snap(+60 -6)📝
tests/app-router.test.ts(+7 -6)📝
tests/dev-origin-check.test.ts(+6 -2)📝
tests/request-pipeline.test.ts(+20 -6)📝
tests/shims.test.ts(+44 -0)➕
tests/vite-hmr-websocket.test.ts(+104 -0)📄 Description
Treat Origin: "null" as an explicit cross-origin value in both dev request validation and Server Action CSRF checks, so sandboxed or opaque browser contexts are blocked unless they are explicitly allowlisted.
Harden external rewrite proxying by stripping hop-by-hop transport headers before forwarding requests, add regression coverage for those headers, and tighten CSRF host fallback to use request.url when Host is missing.
Add Vite HMR websocket regression tests that verify upgrades with an Origin header require a valid HMR token, then clean up that coverage by sharing a single dev server and documenting why proxy auth headers are intentionally preserved for request proxying.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.