Check for mismatched token in API.

This commit is contained in:
Juliusz Chroboczek
2024-05-02 18:14:51 +02:00
parent b883171f62
commit d7a2a2e8e0
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -660,6 +660,10 @@ func tokensHandler(w http.ResponseWriter, r *http.Request, g, pth string) {
http.Error(w, "wrong group", http.StatusBadRequest)
return
}
if newtoken.Token != t {
http.Error(w, "token mismatch", http.StatusBadRequest)
return
}
_, err = token.Update(&newtoken, etag)
if err != nil {
httpError(w, err)