From 755fa50400e2c35d547094d2e4829c1ed0935af5 Mon Sep 17 00:00:00 2001 From: classiemilio Date: Wed, 18 Mar 2026 17:56:03 -0400 Subject: [PATCH] fix: handle relative URLs in Websocket domain filter script (#624) * fix: handle relative URLs in domain filter WebSocket script Pass location.href as base URL to the URL constructor so relative URLs (e.g. "/path" or "//host/path") resolve correctly instead of throwing. Co-Authored-By: Claude Opus 4.6 Affirm-Skill: commit-and-push * fix: apply domain filter review followups Use location.href as base in native WebSocket handler to match EventSource/sendBeacon, remove redundant comment, add test coverage. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 Co-authored-by: ctate <366502+ctate@users.noreply.github.com> --- cli/src/native/network.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/native/network.rs b/cli/src/native/network.rs index 0f178d7..48226e2 100644 --- a/cli/src/native/network.rs +++ b/cli/src/native/network.rs @@ -184,7 +184,7 @@ pub async fn install_domain_filter_script( const OrigWS = window.WebSocket; window.WebSocket = function(url, protocols) {{ try {{ - const u = new URL(url); + const u = new URL(url, location.href); if (!_isDomainAllowed(u.hostname)) throw new DOMException('WebSocket blocked: ' + u.hostname, 'SecurityError'); }} catch(e) {{ if (e instanceof DOMException) throw e; }} return new OrigWS(url, protocols);