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
+2 -2
View File
@@ -6,6 +6,7 @@ import type {
} from "../domain/javascript/javascriptRuntimeObservation.js";
import { BrowserObservationError } from "../domain/browserObservationError.js";
import type { BrowserObservationOperation } from "../domain/browserObservationErrors.js";
import { urlDeclaresQueryOrFragment } from "../domain/urlComponents.js";
import { parseCdpEndpointValue, readCdpJson } from "../browser/CdpEndpoint.js";
const versionSchema = z
@@ -98,8 +99,7 @@ const validatedInspectorWebSocket = (
socket.port !== trusted.port ||
socket.username !== "" ||
socket.password !== "" ||
socket.search !== "" ||
socket.hash !== "" ||
urlDeclaresQueryOrFragment(socket) ||
!allowedPaths.has(socket.pathname)
)
throw new BrowserObservationError(operation, "invalid_endpoint_response");