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.
This commit is contained in:
2025-11-02 21:56:54 +01:00
parent 46e26efe67
commit af93e418f4
+2 -2
View File
@@ -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