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:
@@ -19,6 +19,8 @@ describe("browser observation contracts", () => {
|
||||
"https://*.example.com",
|
||||
"https://example.com/path",
|
||||
"https://example.com/?token=secret",
|
||||
"https://example.com/?",
|
||||
"https://example.com/#",
|
||||
"https://user:pass@example.com",
|
||||
"file:///tmp/page.html",
|
||||
])
|
||||
@@ -37,6 +39,8 @@ describe("browser observation contracts", () => {
|
||||
"http://192.168.1.2:9222",
|
||||
"https://127.0.0.1:9222",
|
||||
"http://127.0.0.1:9222/json/list",
|
||||
"http://127.0.0.1:9222/?",
|
||||
"http://127.0.0.1:9222/#",
|
||||
"http://user:pass@127.0.0.1:9222",
|
||||
])
|
||||
expect(browserEndpointSchema.safeParse(value).success, value).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user