0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

Merge pull request #34 from rchincha/logs

logs: strip properly
This commit is contained in:
Serge Hallyn 2019-10-24 18:45:00 -05:00 committed by GitHub
commit 24361364a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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 != "" {