From f045ec1ea50d2f461d060ea423b9fd7e0c0d22f8 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 1 Nov 2026 03:03:26 +0800 Subject: [PATCH] gateway: the extension socket's test takes a 401 from the LAN guard as refused TestBrowserExtensionOnlyFromItsOrigin (0e9057227) wanted 403 for every case. On Linux the other computer's try is answered by the LAN guard first, 401 for no key, before the handler's 403; it is refused either way, never switched to a WebSocket. Found by the full suite in magpie-desktop after the push. Run: go test ./internal/gateway -run Browser on mote (macOS) and in magpie-desktop (Linux, -tags nogui), both ok. The rest of that Linux full run at 0565c0bba: ., internal/cli ok with -tags nogui; reds that fail the same at origin/main f9ca3dd44 or are filed: internal/agent's install tests (#4033, #3548), TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestColdTurnsTaken, ok alone (#4510). --- internal/gateway/browser_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/gateway/browser_test.go b/internal/gateway/browser_test.go index 63a30f077..2f4e94ebd 100644 --- a/internal/gateway/browser_test.go +++ b/internal/gateway/browser_test.go @@ -214,7 +214,9 @@ func TestBrowserExtensionOnlyFromItsOrigin(t *testing.T) { } w := httptest.NewRecorder() h.ServeHTTP(w, r) - if w.Code != http.StatusForbidden { + // refused, by the LAN guard (401 for a computer sending no key) or + // by the handler (403): never switched to a WebSocket + if w.Code != http.StatusForbidden && w.Code != http.StatusUnauthorized { t.Fatalf("%+v: %d %s", c, w.Code, w.Body.String()) } }