From 81e8db888bbf51cfc578588ec05bf5963e7ab379 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 18 Aug 2020 23:42:27 -0400 Subject: quietly close unauthorized sockets --- lib/sockets.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sockets.js b/lib/sockets.js index ab16e2fa..e1896b8f 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -86,8 +86,7 @@ wss.on("connection", function (ws, req) { case "login": let token = data; try { - if (!token || token === "null") - throw new Error("Unauthorized socket login"); + if (!token || token === "null") return ws.close(); const username = jwt.decode(token).username; if (!username) throw new Error("Invalid JWT token"); -- cgit v1.2.3