Skip to content

Mask the connection string in ODBC/JDBC bridge request URLs - #130576

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:mask-xdbc-connection-string-v2
Nov 11, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:mask-xdbc-connection-string-v2

Conversation

@groeneai

@groeneai groeneai commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #126223
Related: #106442

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The password in the connection string of the odbc and jdbc table functions and of the ODBC and JDBC table engines is no longer shown in cleartext in the bridge request URL quoted by errors, system.query_log, the server log and system.schema_inference_cache. The query itself already showed it as [HIDDEN].

Description

On 26.8.28.14-lts, SELECT * FROM odbc('DSN=...;PWD=<password>', 'db', 't') against a bridge that cannot connect returns an error, and writes system.query_log.exception, with the password in cleartext, while the logged query shows odbc('[HIDDEN]', 'db', 't'):

Code: 86. DB::HTTPException: Received error from remote server http://127.0.0.1:60245/columns_info?use_connection_pooling=1&version=1&connection_string=DSN%3Dnonexistent_dsn%3BPWD%3DSEKRIT_ODBC_p0&schema=db&table=t&...

The same URL reaches the server log and, after a successful read, system.schema_inference_cache.source. With a named collection, a user who cannot read system.named_collections gets its password this way.

The server sends the connection string to the bridge in the connection_string query parameter, and maskPresignedURLParameters, which these URL renders call, does not treat it as secret. As asked in #126223, the change is one more name in its is_secret_parameter. A url() URL with a connection_string parameter is now also shown with that value as [HIDDEN]; requests are unchanged.

05617_xdbc_connection_string_masked checks the client error, system.query_log and an ODBC engine insert, and fails on master. It uses a DSN that does not exist, so the external bridge never loads the driver.


Workflow [PR]
Sync PR [sync-upstream/pr/130576]

Version info

  • Merged into: 26.11.1.1913-master (included in 26.11 and later)

A request to the ODBC/JDBC bridge carries the connection string, password
included, in its `connection_string` query parameter. `maskPresignedURLParameters`
now treats that parameter as secret, so the URL quoted in errors, `system.query_log`,
the server log and `system.schema_inference_cache` shows it as `[HIDDEN]`, as the
query text already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: 0 blocker, 0 major, 2 nits (click to expand)
Finding Verdict
💡 maskURICredentials doc comment still names only userinfo and presigned parameters Agreed, not changed: that comment is untouched by this PR, and maskPresignedURLParameters' own comment names connection_string
💡 ODBC dictionary sources send the same parameter and get the same masking, unmentioned Agreed, not measured, so not claimed in the description

@clickhouse-gh

clickhouse-gh Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7921cf1]

Summary: ✅


AI Review

Summary

The PR hides the connection_string query parameter when formatting URLs, covering the shared diagnostic paths used by the odbc and jdbc table functions and the ODBC and JDBC engines. Requests retain their original credentials. The regression test checks client errors, system.query_log.exception, and insert errors. No actionable correctness, security, compatibility, or performance findings remain.

Missing context / blind spots
  • ⚠️ The new regression test was not run locally because this checkout has no ClickHouse binary or bridge. Its functional CI result was unavailable at review time; the successful fast-test job excludes this test. Confirm the functional and bugfix-validation results before merging.
Final Verdict

Status: ✅ Approve. No code changes requested; runtime validation remains subject to the pending CI results.

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default can be tested Allows running workflows for external contributors comp-foreign-db Connectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.). labels Nov 10, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 7921cf1ae with master da9125b5e (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse ×0.88, programs/clickhouse-keeper ×1.11 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse DB::registerFunctionConversion(DB::FunctionFactory&) 7.1 s 16.4 s +10.1 s (+163%)
programs/clickhouse _ZN6detail10static_forITk7is_enumN2DB23AttributeUnderlyingTypeEZNS1_29callOnDictionaryAttributeType… 3.9 s 8.6 s +5.2 s (+154%)
Compile time of recompiled translation units

27 translation units recompiled, 129 s compile time in total, 27 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×1.07 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost +9.8 s (+8%) in total before that adjustment.

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial.

@alexey-milovidov alexey-milovidov self-assigned this Nov 10, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 10, 2026
Merged via the queue into ClickHouse:master with commit 6f16625 Nov 11, 2026
368 of 370 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-foreign-db Connectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.). pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants