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