security: address medium risks in jwt, redis ordering and body limit
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user