client-v2 HTTP auth: fix null password being sent as "null" string#2809
Merged
chernser merged 1 commit intoApr 1, 2026
Merged
Conversation
When no password is set on the v2 HTTP client, PASSWORD config returns null and Java string concatenation produces "default:null" instead of "default:" in the Authorization header. This causes authentication failures against ClickHouse servers expecting an empty password. e.g. the official docker image running with CLICKHOUSE_SKIP_USER_SETUP. Add a null check to treat missing passwords as empty string, matching the existing behavior in the v1 HTTP client. Add a WireMock-based test to verify the correct Authorization header is sent.
chernser
approved these changes
Apr 1, 2026
There was a problem hiding this comment.
Pull request overview
Fixes v2 HTTP Basic authentication when no password is configured by ensuring a missing password is treated as an empty string (so the Authorization header encodes default: instead of default:null), matching v1 behavior and preventing auth failures against servers expecting an empty password.
Changes:
- Treat
nullpassword as""when building the HTTP BasicAuthorizationheader in the v2 client. - Add a WireMock-backed integration test asserting the correct Basic auth header is sent when no password is set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| client-v2/src/main/java/com/clickhouse/client/api/internal/HttpAPIClientHelper.java | Fixes Basic auth header construction to avoid encoding a null password as the literal "null". |
| client-v2/src/test/java/com/clickhouse/client/HttpTransportTests.java | Adds an integration test validating the Basic auth header uses an empty password when unset. |
Contributor
|
Thank you for the contribution! |
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.
Summary
When no password is set on the v2 HTTP client, PASSWORD config returns
nulland Java string concatenation turns that into"null"producingdefault:nullinstead ofdefault:in theAuthorizationheader. This causes authentication failures against ClickHouse servers expecting an empty password. e.g. the official docker image running withCLICKHOUSE_SKIP_USER_SETUP.Add a
nullcheck to treat missing passwords as empty string, matching the existing behavior in the v1 HTTP client. Add a WireMock-based test to verify the correctAuthorizationheader is sent.Checklist
Delete items not relevant to your PR: