security: address medium risks in jwt, redis ordering and body limit

This commit is contained in:
Naeel
2026-04-10 19:44:34 +03:00
parent a5e9bfb15c
commit 3b4fe0bb3a
3 changed files with 61 additions and 3 deletions
+9
View File
@@ -188,6 +188,15 @@ func (h *Handler) jwtMiddleware(next http.Handler) http.Handler {
return
}
// Повторно валидируем токен в nubes API на каждый UI API запрос,
// чтобы отозванные токены не оставались валидными до повторного логина.
ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
defer cancel()
if err := auth.PingNubesAPI(ctx, h.nubesEndpoint, token); err != nil {
jsonErr(w, http.StatusForbidden, "token rejected by cloud API: "+err.Error())
return
}
// Проверяем что тенант существует (был создан при /ui/api/auth)
jwtTenant, ok := h.store.GetBySub(claims.Sub)
if !ok {