Skip to content

fix(exporter): use url.Hostname() to get hostname - #95

Open
gsilvapt wants to merge 1 commit into
ClickHouse:masterfrom
gsilvapt:fix-credential-leak
Open

gsilvapt wants to merge 1 commit into
ClickHouse:masterfrom
gsilvapt:fix-credential-leak

Conversation

@gsilvapt

@gsilvapt gsilvapt commented Aug 17, 2026 •

Copy link
Copy Markdown

This Printf call logs an informational message when starting the script which is useful, but leaks credentials when users feed a full DSN in clickhouse://<user>:<password>@<host>:<port>/blabla format.

Since the URI is previously parsed into a built-in net.URL struct, this change makes sure we use url.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

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.
@CLAassistant

CLAassistant commented Aug 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants