From d8bdce51c336f3693121202402ee38ff3f12c0e2 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 31 May 2023 20:52:19 +0200 Subject: send bad request status if the websocket connection has a bad UUID cookie --- main.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index f962a76..0539e1a 100644 --- a/main.go +++ b/main.go @@ -208,11 +208,15 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) { uuidCookie, err := r.Cookie("UUID") if err != nil { llog.Error("websocket connection has no set UUID cookie") + http.Error(w, "websocket connection has no set UUID cookie", http.StatusBadRequest) + return } id, err := uuid.Parse(uuidCookie.Value) if err != nil { llog.Error("Invalid UUID set in cookie") + http.Error(w, "Invalid UUID set in cookie", http.StatusBadRequest) + return } defer func() { -- cgit v1.2.3