fix: stop sending websocket auth key in URL#32
fix: stop sending websocket auth key in URL#32DeoJin wants to merge 1 commit intodreamwing:masterfrom
Conversation
Greptile SummaryThis PR addresses a security concern (issue #29) by removing the long-lived access key from browser WebSocket upgrade URLs, where it was visible in browser history, server access logs, and network proxies. The fix is sound: because Key changes:
One area worth addressing: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser
participant HTTP as Express (authMiddleware)
participant Static as express.static
participant WS as WebSocket Server
Note over Browser,WS: Initial page load
Browser->>HTTP: GET / (unauthenticated)
HTTP-->>Browser: 302 redirect and sets session cookie
Browser->>HTTP: GET / (with session cookie)
HTTP->>Static: next() — authenticated
Static-->>Browser: dashboard.js
Note over Browser,WS: WebSocket — BEFORE this PR
Browser->>WS: Upgrade request with access key in URL query string
WS-->>Browser: 101 Switching Protocols
Note over Browser,WS: WebSocket — AFTER this PR
Browser->>WS: Upgrade request (session cookie sent automatically)
WS-->>Browser: 101 Switching Protocols
Note over Browser,WS: Programmatic access (unchanged)
Browser->>WS: Upgrade request with auth header
WS-->>Browser: 101 Switching Protocols
|
Summary
Validation
npx jest --runInBand --config jest.ws.config.cjsFixes #29