Skip to content

Commit

Permalink
Redact password from URL in infof logging (#1559)
Browse files Browse the repository at this point in the history
The `Infof` call that logs requests currently leaks the
basic auth password through the URL.

By using URL.Redacted(), we can replace the
password with "xxxxx" in the log message.

Close #1459
  • Loading branch information
igorwwwwwwwwwwwwwwwwwwww committed Dec 17, 2021
1 parent b8e6745 commit 66fa8f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Expand Up @@ -1502,7 +1502,7 @@ func (c *Client) PerformRequest(ctx context.Context, opt PerformRequestOptions)
duration := time.Now().UTC().Sub(start)
c.infof("%s %s [status:%d, request:%.3fs]",
strings.ToUpper(opt.Method),
req.URL,
req.URL.Redacted(),
resp.StatusCode,
float64(int64(duration/time.Millisecond))/1000)

Expand Down

0 comments on commit 66fa8f9

Please sign in to comment.