Skip to content

Commit 43b9f4b

Browse files
dirkwatkurki
authored andcommitted
fix(security): remove per-message token override in WebSocket handler
Clients could inject a token in any WebSocket message body to override the connection's authentication identity. Remove this non-standard pattern and rely solely on connection-level authentication, matching the approach used by Socket.IO, GraphQL-WS, Phoenix Channels, and recommended by OWASP. The login-over-WS flow is unaffected as it manages its own token via processLoginRequest.
1 parent 7db2b21 commit 43b9f4b

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

src/interfaces/ws.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ interface Spark {
102102
}
103103

104104
interface WsMessage {
105-
token?: string
106105
updates?: Delta['updates']
107106
subscribe?: Array<{ path: string }> | string
108107
unsubscribe?: Array<{ path: string }>
@@ -570,10 +569,6 @@ function wsInterface(app: WsApp): WsApi {
570569
debug.enabled && debug('<' + JSON.stringify(parsedMsg))
571570

572571
try {
573-
if (parsedMsg.token) {
574-
spark.request.token = parsedMsg.token
575-
}
576-
577572
if (parsedMsg.updates) {
578573
processUpdates(app, pathSources, spark, parsedMsg)
579574
}

0 commit comments

Comments
 (0)