0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-02-03 23:09:41 -05:00

logs: strip properly

This commit is contained in:
Ramkumar Chinchani 2019-10-24 14:16:41 -07:00
parent a1a05a8a41
commit 84b9194598

View file

@ -72,8 +72,13 @@ func Logger(log zerolog.Logger) mux.MiddlewareFunc {
}
clientIP := r.RemoteAddr
method := r.Method
headers := r.Header
delete(headers, "Authorization") // strip from logs
headers := map[string][]string{}
for key, value := range r.Header {
if key == "Authorization" { // anonymize from logs
value = []string{"******"}
}
headers[key] = value
}
statusCode := sw.status
bodySize := sw.length
if raw != "" {