mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #601] [CLOSED] fix: reject dangerous URI schemes in client-side navigation #702
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#702
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/601
Author: @southpolesteve
Created: 3/20/2026
Status: ❌ Closed
Base:
main← Head:fix/block-dangerous-uri-schemes📝 Commits (2)
fa1bef8fix: reject dangerous URI schemes in client-side navigation83f98d7test: update browser entry snapshot for dangerous scheme check📊 Changes
4 files changed (+20 additions, -0 deletions)
View changed files
📝
packages/vinext/src/entries/app-browser-entry.ts(+4 -0)📝
packages/vinext/src/shims/navigation.ts(+3 -0)📝
packages/vinext/src/shims/router.ts(+9 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+4 -0)📄 Description
Summary
javascript:,data:, andvbscript:URI schemes before navigating.push/replace(both hook and singleton), App RouternavigateImpl(), and the server actionx-action-redirecthandler.Details
The client router passed URLs to
window.location.assign()/window.location.replace()without validating the URI scheme. If application code calledrouter.push()orrouter.replace()with untrusted input (e.g., a query parameter), dangerous schemes likejavascript:would be navigated to.The fix uses the existing
isDangerousScheme()utility fromurl-safety.ts, which is already used by theLinkandFormcomponents. The server action redirect handler (x-action-redirect) gets an inline check since it lives in generated code.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.