test(display): integration test for the take-control WS-proxy + signed-token path (core#2261) #2269
Reference in New Issue
Block a user
Delete Branch "feat/core2261-takecontrol-wsproxy-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a server-side integration test for the desktop take-control WS-proxy path in workspace-server's
DisplaySessionhandler. It covers the WS-1006 regression surface from core#2247 — the display websocket proxy upgrade + signed-token handshake + bidirectional byte flow — entirely without EC2/desktop/noVNC.What it exercises
signDisplaySessionToken(...)+ active control lock + display-enabled workspace → the WS upgrade succeeds (HTTP 101), the fake websockify backend'sRFB 003.008greeting arrives through the reverse proxy, and a client→server byte echoes back (proves the bidirectional proxy chain end-to-end).display.mode=none→ 404; emptyinstance_id→ 503;proxyPath != /websockify→ 404. Each asserts the upgrade does not happen and that the rejection never leaks to the upstream backend.How it's wired (no network/EC2)
displayForwardpackage var is overridden to return a fakehttptestwebsockify backend URL (gorilla/websocket upgrader that writes the RFB greeting then echoes), restored viat.Cleanup.loadWorkspaceDisplaySessionTarget,loadActiveDisplayControl) are mocked with sqlmock, mirroring the siblingworkspace_display_control_test.goharness;DISPLAY_SESSION_SIGNING_SECRETis set viat.Setenv.DisplaySessionis mounted on a gin router behindhttptest.NewServer, dialed by a realwebsocket.DialerwithSec-WebSocket-Protocol: binary, molecule-display-token.<token>.Complements the canvas reconnect unit tests (
DisplayTab.test.tsx); the real auto-heal is the core#2261 reconciler. Deterministic, fast, short timeouts, all servers/conns closed viat.Cleanup.Refs core#2261, core#2247.
DO NOT MERGE — heavy core SOP gate.
🤖 Generated with Claude Code
QA (core#2261 take-control WS-proxy test). Ran it myself: positive asserts 101 upgrade + RFB greeting through proxy + bidirectional echo; 6 rejections (missing/tampered/expired token, mode=none, empty instance_id, wrong path) each assert no-upgrade + never-reaches-upstream. Deterministic. Good fixture correction (mode=desktop-control/protocol=novnc). Approve.
Security (core#2261). Test-only; no prod surface. Notably it locks in the token-auth guard: tampered/expired/missing signed tokens are proven to 403 and never reach the upstream proxy. Approve.