lab7: TLS/mTLS по trust matrix, OpenBao (cert auth, KV, policies), роли БД, Argon2id+rehash, лимит входа, hardening, secprobe и тесты

This commit is contained in:
2026-11-12 12:39:15 +03:00
parent 20afc2c790
commit c063b15869
138 changed files with 18136 additions and 4 deletions
@@ -0,0 +1,25 @@
package middleware
import (
"log/slog"
"net/http"
"github.com/charawein/mtusi2026lab7/internal/transport/httputil"
)
func Recovery(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer func() {
if rec := recover(); rec != nil {
slog.Error("panic in handler",
"panic", rec,
"request_id", httputil.RequestIDFrom(r.Context()),
"method", r.Method,
"path", r.URL.Path,
)
httputil.WriteError(w, r, nil)
}
}()
next.ServeHTTP(w, r)
})
}