Repository navigation
refactor: migrate websocket library from gorilla to coder/websocket - #1906
Merged
Merged
Conversation
gorilla/websocket is no longer maintained. Move the backend (log, cerberus, hecate and stats streams, orthrus server) and the agent (leash) to coder/websocket v1.8.15. - Centralize origin checking and upgrade in websocket_upgrade.go; the origin rule is unchanged (same host or X-Forwarded-Host, otherwise 403) - Share read-limit, keepalive and write helpers for log-style sockets - Hecate stream now gets keepalive and a write deadline - Agent keeps wire compatibility: no compression, no proxy, no HTTP/2, binary-only NetConn, abrupt close - Non-upgrade requests to WS endpoints now return 426 instead of 400 - Drop the Renovate ignore for the old dependency and update ARCHITECTURE docs
Contributor
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Contributor
✅ Supply Chain Verification Results✅ PASSED 📦 SBOM Summary
🔍 Vulnerability Scan
📎 Artifacts
Generated by Supply Chain Verification workflow • View Details |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
With the ACL module on, Cerberus checks the API client IP against every enabled access list. Several security specs created enabled lists (or hosts attached to them) and never deleted them, so the next spec that turned the ACL module on was refused by the leftovers. The GeoIP unenforced-alert spec hit this after emergency-operations, failed in beforeAll and cleanup, and left the ACL on for the rest of the run. Clean up in a finally/afterEach in emergency-operations, acl-creation, acl-dropdown-regression, acl-waf-layering, acl-enforcement and access-lists-crud, and add a deleteProxyHostByDomain helper.
The bare .font-mono.text-xs selector also matched the GeoIP database card's file path on /security, so Playwright's strict mode rejected it. Scope it to the scrollable log pane. The live log viewer only renders while Cerberus is on, and the security shard baseline leaves it off, so the spec's old probe (whose result nothing read) never skipped or enabled anything. Enable Cerberus for the file and restore the previous state afterwards.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gorilla/websocketis no longer maintained. This moves both the server side (backend/) and the agent (agent/) togithub.com/coder/websocketv1.8.15 in a single PR.Backend
websocket_upgrade.gocentralizes origin checking and the upgrade. The origin rule is unchanged: noOrigin, or the origin host must equalHost/X-Forwarded-Host, otherwise 403 before upgrade. Orthrus still accepts any origin (bearer token is the boundary).log_socket.goshares read-limit, keepalive and write helpers across the logs, cerberus and hecate streams.wsNetConnis replaced bywebsocket.NetConn.AgentSession.conn).Agent
leashdials withwebsocket.Dial; wire behavior is preserved: no compression, no proxy, no HTTP/2 negotiation, binary-onlyNetConn, abrupt close, unchanged headers.Behavior changes worth reviewing
WriteJSONadded.Other
ignoreDepsentry for the old dependency so the new one is tracked; updated both ARCHITECTURE tables.//nolint:bodycloseon the threewebsocket.Dialcall sites: the library documents that the response body is nil on success and closed on error.Testing
backend/internal/api/handlers,backend/internal/orthrusandagent/leash; added tests for the upgrade/origin helper, the agentNetConnclose behavior, and the dial HTTP client.go build,go vet, and golangci-lint (fast) are clean for both modules.go testpass, andhandlers,orthrus,servicesand the agent pass under-race.Note: one test (the stalled-write test) relies on kernel socket buffers filling within a 10s budget, so it may be timing-sensitive on other hosts.