Skip to content

Commit 0b147a7

Browse files
committed
fix: sanitize auth error causes before sending to WebSocket clients
Previously, internal ServerAuthPairingLinksListError and ServerAuthSessionsListError objects were passed directly as the cause field in AuthAccessStreamError, which gets serialized via Schema.Defect() to WebSocket clients. This leaked internal error chains, stack traces, and backend details. Now we wrap the cause in a plain Error with only the message string, preventing internal details from reaching the client while preserving the human-readable error description.
1 parent d430f59 commit 0b147a7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apps/server/src/ws.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ const makeWsRpcLayer = (currentSession: EnvironmentAuth.AuthenticatedSession) =>
514514
(cause) =>
515515
new AuthAccessStreamError({
516516
operation: "list-pairing-links",
517-
cause,
517+
cause: new Error(cause.message),
518518
}),
519519
),
520520
),
@@ -524,7 +524,7 @@ const makeWsRpcLayer = (currentSession: EnvironmentAuth.AuthenticatedSession) =>
524524
new AuthAccessStreamError({
525525
operation: "list-client-sessions",
526526
currentSessionId,
527-
cause,
527+
cause: new Error(cause.message),
528528
}),
529529
),
530530
),

0 commit comments

Comments
 (0)