Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redact.URL uses (*URL).Redacted to omit basic-auth password #1947

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}
Loading