From af93e418f44a7d6ced9390ac1bd69aa87ad2207e Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Sun, 2 Nov 2025 21:56:54 +0100 Subject: [PATCH] fix: change to write lock for thread safety in json unmarshal Replace read lock with write lock in client.go to ensure thread safety during the unmarshalling of JSON data. This prevents concurrent read access and potential data races, improving the integrity of the privileges data structure. --- client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index e18f558..6ff38c9 100644 --- a/client.go +++ b/client.go @@ -67,8 +67,8 @@ func (h *PrivilegeHandler) Fetch() error { return err } - h.RLock() - defer h.RUnlock() + h.Lock() + defer h.Unlock() err = json.Unmarshal(buff, &h.privileges) if err != nil { return err -- 2.52.0