Conversation
This function logs an informational message when starting the script which is useful, but leaks credentials when users feed a URL in `<user>:<password>@<host>:<port>` format. Since the URI is previously parsed into a built-in `net.URL` struct, this change makes sure we use `uri.Hostname()` method instead of using the raw DSN provided by the customer, which leaks usernames and passwords into logs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This
Printfcall logs an informational message when starting the script which is useful, but leaks credentials when users feed a full DSN inclickhouse://<user>:<password>@<host>:<port>/blablaformat.Since the URI is previously parsed into a built-in
net.URLstruct, this change makes sure we useurl.Hostname()method instead of using the raw DSN provided by the customer, to only write out the hostname instead of everything the user provides, avoiding leaking credentials into logs.Edit: This brief go playground snippet captures this change in effect: https://go.dev/play/p/BVYBJIfGKGV