Skip to content

Commit

Permalink
Merge pull request #34 from rchincha/logs
Browse files Browse the repository at this point in the history
logs: strip properly
  • Loading branch information
hallyn authored Oct 24, 2019
2 parents a1a05a8 + 84b9194 commit 2436136
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/api/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 2436136

Please sign in to comment.