Skip to content

Commit

Permalink
fix: redact.URL uses (*URL).Redacted to omit basic-auth password (#1947)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmoylan committed Aug 26, 2024
1 parent 00f182b commit a07d1ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/redact/redact.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Error(err error) error {
if perr != nil {
return err // If the URL can't be parsed, just return the original error.
}
uerr.URL = URL(u).String() // Update the URL to the redacted URL.
uerr.URL = URL(u) // Update the URL to the redacted URL.
return uerr
}

Expand All @@ -73,7 +73,7 @@ var paramAllowlist = map[string]struct{}{
}

// URL redacts potentially sensitive query parameter values from the URL's query string.
func URL(u *url.URL) *url.URL {
func URL(u *url.URL) string {
qs := u.Query()
for k, v := range qs {
for i := range v {
Expand All @@ -85,5 +85,5 @@ func URL(u *url.URL) *url.URL {
}
r := *u
r.RawQuery = qs.Encode()
return &r
return r.Redacted()
}

0 comments on commit a07d1ca

Please sign in to comment.