Repository navigation
Conversation
A username or password holding URL-reserved characters such as '#', '@', '/', '?' or '%' was put into the http(s)://user:password@host DSN as is, so the driver failed to parse it or read back a different password. Escape both with net/url before building the DSN. Signed-off-by: Mayank Raj <mraj602@gmail.com>
Slach
approved these changes
Oct 28, 2026
This branch has not been deployed
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.
Fixes #1822
The operator and the metrics exporter connect to ClickHouse via a DSN built in
pkg/model/clickhouse/credentials_endpoint.goasscheme://user:password@host:port,with username and password inserted as-is. mailru/go-clickhouse parses the DSN with
url.Parse, so a password containing#is cut at the#(the reportedinvalid port ":cs" after host), and@,/,?,:or%either break theparse or are read back as a different password.
This change percent-encodes username and password with
net/url(url.User(s).String())when building the DSN. Plain credentials produce the same DSN as before. The DSN used for
logging still shows
***for the password.Tests:
credentials_endpoint_test.gobuilds DSNs for several reserved-character passwordsand usernames (http and https, with and without
log_queries), parses them withgoch.ParseDSN, and checks the user and password read back unchanged. Without the fix, 5 of 7 cases fail.go test ./pkg/model/clickhouse/passes. CHANGELOG entry added under 0.28.0 / Fixed.