fix: honor empty URL query and fragment markers (#2091)

URL.search and URL.hash are empty for both a missing component and an explicit empty one, so endpoint and origin checks were accepting URLs the callers meant to reject.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Faheem Ahmad
2026-10-13 06:05:29 +09:00
committed by GitHub
co-authored by Cursor
parent d59ab6d977
commit af29247a78
10 changed files with 62 additions and 14 deletions
@@ -6,6 +6,7 @@ import { javascriptRuntimeUnresolvedLocationSchema } from "./javascriptRuntimeOb
import { javascriptApplicationGraphSchema } from "./javascriptApplicationGraph.js";
import { digestSchema } from "../digests.js";
import { prefixedDigestSchema } from "../digests.js";
import { urlDeclaresQueryOrFragment } from "../urlComponents.js";
const evidenceIdSchema = prefixedDigestSchema("ev");
const nodeIdSchema = prefixedDigestSchema("jag_node");
@@ -53,8 +54,7 @@ const normalizeRuntimeUrlPrefix = (value: string): string | null => {
!["http:", "https:"].includes(url.protocol) ||
url.username !== "" ||
url.password !== "" ||
url.search !== "" ||
url.hash !== ""
urlDeclaresQueryOrFragment(url)
)
return null;
if (!url.pathname.endsWith("/")) url.pathname += "/";