From d31c96067cb1b0986a3f6e3dc2a5a84f214478d4 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 28 Apr 2026 23:38:43 +0200 Subject: [PATCH] Cleanup 403 on websockets --- api/src/websockets.ts | 7 ++++++- front/src/ui/login/form.tsx | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/websockets.ts b/api/src/websockets.ts index 7b45016e..bb9327a8 100644 --- a/api/src/websockets.ts +++ b/api/src/websockets.ts @@ -92,7 +92,12 @@ export const appWs = baseWs.ws("/ws", { const handler = actionMap[action as keyof typeof actionMap]; for (const perm of handler.permissions ?? []) { if (!ws.data.jwt.permissions.includes(perm)) { - return ws.close(3000, `Missing permission: '${perm}'.`); + ws.send({ + action: action, + status: 403, + message: `Missing permission: '${perm}'.`, + }); + return; } } await handler.message(ws as any, body as any); diff --git a/front/src/ui/login/form.tsx b/front/src/ui/login/form.tsx index bf447665..f06b7cfd 100644 --- a/front/src/ui/login/form.tsx +++ b/front/src/ui/login/form.tsx @@ -38,7 +38,7 @@ export const FormPage = ({ return (