summaryrefslogtreecommitdiff
path: root/internal/api/handlers_admin.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-10 09:51:31 +0300
committerPaul Buetow <paul@buetow.org>2026-05-10 09:51:31 +0300
commitaf09a8ad94bfeddd1f7ccfad3aacab1332f915c9 (patch)
treea6834bd05bad571e57b03dcdb0be119b109d628c /internal/api/handlers_admin.go
parent820c1a4737949d39397394525665efd0c672bd51 (diff)
api: reject id==0 in handleDeleteUser to avoid 200 OK for invalid path
Diffstat (limited to 'internal/api/handlers_admin.go')
-rw-r--r--internal/api/handlers_admin.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/api/handlers_admin.go b/internal/api/handlers_admin.go
index 77e5b9f..6d10c67 100644
--- a/internal/api/handlers_admin.go
+++ b/internal/api/handlers_admin.go
@@ -78,6 +78,10 @@ func (s *Server) handleDeleteUser(w http.ResponseWriter, r *http.Request) {
return
}
id := pathID(r, "id")
+ if id == 0 {
+ badRequest(w, "invalid user id")
+ return
+ }
adminUser, _ := r.Context().Value(userCtxKey).(*model.User)
if adminUser != nil && adminUser.ID == id {
badRequest(w, "cannot delete self")