Skip to content

Stable 25.8 Backport of #131963 - Clear --jwt and the other credential options from the command line of clickhouse-client and clickhouse-keeper-client - #2936

Merged
zvonand merged 3 commits into
stable-25.8from
backports/stable-25.8/131963
Nov 21, 2026
Merged

zvonand merged 3 commits into
stable-25.8from
backports/stable-25.8/131963

Conversation

@blau-ai

@blau-ai blau-ai commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Improvement

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

clickhouse-client now clears the values of --jwt, --ssh-key-passphrase, --one-time-password and --oauth-client-secret from its command line, as it already did for --password, so they are no longer visible in ps and /proc/<pid>/cmdline. clickhouse-keeper-client now does the same for --password and --identity. Closes ClickHouse#131191. (ClickHouse#131963 by @groeneai)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

PedroTadim and others added 2 commits November 20, 2026 12:53
…ptions-from-command-line

Clear `--jwt` and the other credential options from the command line of `clickhouse-client` and `clickhouse-keeper-client`

Conflicts committed as-is, conflict markers included:
- programs/keeper-client/KeeperClient.cpp (both modified)
Kept the minimal `KeeperClient.cpp` include and call; reduced the test and reference to options that exist in stable-25.8.
@blau-ai blau-ai added 25.8 25.8 Altinity Stable backport Backport stable stable-25.8 labels Nov 20, 2026
@blau-ai

blau-ai commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Port-AL: cherry-pick conflicts resolved by AI

Conflicted files:

  • programs/keeper-client/KeeperClient.cpp (both modified)

Commits:

  • 4a00a87: cherry-pick with the conflicts committed as-is

  • 5351183: resolution

  • programs/keeper-client/KeeperClient.cpp conflicted because the surrounding includes differ in stable-25.8. The resolution adds only Common/clearPasswordFromCommandLine.h and the clearPasswordFromCommandLine(argc, argv) call after client.init.

  • The test 05813_clear_credentials_from_command_line.sh and its reference no longer use --one-time-password and --oauth-client-secret, which stable-25.8's clickhouse-client does not have.

  • The helper's secret_options list keeps the two missing names. They are harmless there and avoid drift from master.

  • I could not run the test or check stable-25.8 for another test numbered 05813.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [ba2e03d]

@zvonand

zvonand commented Nov 20, 2026

Copy link
Copy Markdown
Member

@blau-ai

@blau-ai

blau-ai commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

CI triage for 5351183

Verdict: 3 distinct failures. 1 is caused by the PR, 1 is a flaky stress-test failure, and 1 is a known DCO failure.

Check(s) Cause PR-caused?
7 × Stateless tests (asan/ubsan/debug/binary variants) + Stateless tests (amd_asan, flaky check, 50/50 failed) new test 05813_clear_credentials_from_command_line ✅ yes, but the test is the problem, not the C++ change
Stress test (amd_debug) Cannot start clickhouse-server: the server was too slow to start after the stress run ❌ flaky / infra
DCO expected on backport PRs (#2853 and #2854 fail it the same way) ❌ not relevant

Every failing stateless shard has exactly one failure, and it is this test. Nothing else failed.


1. 05813_clear_credentials_from_command_line: PR-caused (the test doesn't fit stable-25.8)

Decisive output (Stateless tests (amd_debug, parallel)):

05813_clear_credentials_from_command_line.sh: line 59: /proc/794093/cmdline: No such file or directory
05813_clear_credentials_from_command_line.sh: line 59: /proc/794121/cmdline: No such file or directory
... (5 times)
stdout:
client, separate values
client, values after =
client, values after spaced =
client, --password without a value
keeper-client
keeper-client, values after :
--password:
--identity:

Root cause: every clickhouse-client case passes --jwt. On stable-25.8, USE_JWT_CPP is never set to 1. contrib/jwt-cpp-cmake exists, but src/configure_config.cmake has no set(USE_JWT_CPP 1). Upstream only added that line later, in the IdP-login work (a388b1cac6d / 969d9fd8c7b). So on this branch ConnectionParameters throws:

SUPPORT_IS_DISABLED: JWT is disabled, because ClickHouse is built without JWT or SSL support

The client then exits before it connects to the listener. The while ... kill -0 loop stops, and /proc/$pid/cmdline no longer exists. The test's own header (--jwt needs a build with jwt-cpp and SSL) states this dependency.

The first keeper-client case fails as a knock-on effect. CONNECTIONS assumes every earlier invocation connected exactly once. With the 4 client cases never connecting, the counter is 4 ahead. The keeper case keeps waiting until its process dies, and then /proc is gone again.

The C++ change itself looks fine. The client and keeper cases that actually ran printed the expected cleared output (--password: / --identity:).

Suggested fix (test only, no code change). Drop --jwt from the client cases:

  • Cases 1–3: remove --jwt "$JWT" / --jwt="$JWT" / --jwt = "$JWT". In the .reference, delete the --jwt and --jwt= lines from those three blocks.
  • Case 4 (--password without a value): replace --jwt "$JWT" with --ssh-key-passphrase SECRET. The expected output stays --password. Clearing runs backwards, so it zeroes SECRET first, then --password (which has no value) zeroes the next argument, --ssh-key-passphrase. That is the same thing this case checks today with --jwt.
  • Remove the unused JWT= variable and update the no-fasttest comment.
  • The keeper-client cases need no change; they pass once the counter is right.

Without jwt-cpp, --jwt clearing can't be tested on this branch. The client rejects --jwt there anyway, so nothing is lost. I haven't run this modified test. If you want, I can push it to this branch and run it against this PR's CI binary first.

2. Stress test (amd_debug): flaky, not PR-related

+ clickhouse start --user root
Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
Cannot start clickhouse-server

3. DCO: ignore

DCO fails on the merge commit of the upstream PR, the same way it does on other stable-25.8 backports (#2853, #2854). It isn't related to the change.

@zvonand

zvonand commented Nov 20, 2026

Copy link
Copy Markdown
Member

@blau-ai fix the fail coused by this PR here

…d spaced = cases

On stable-25.8 the client is built without JWT support (USE_JWT_CPP is never
set), so any --jwt makes it exit with SUPPORT_IS_DISABLED before connecting,
and the client does not accept the '--option = value' form. Exercise the
remaining credential options instead.
@blau-ai

blau-ai commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

@zvonand I fixed the failure this PR caused and pushed it to the PR branch as ba2e03d.

What failed

The new test 05813_clear_credentials_from_command_line failed in every stateless job: all 50 runs of amd_asan, flaky check and one run each in amd_debug, amd_ubsan, amd_binary (two variants), distributed plan and AsyncInsert. Every client case printed nothing, plus:

05813_clear_credentials_from_command_line.sh: line 59: /proc/3601/cmdline: No such file or directory

In other words, clickhouse-client exited before it connected to the dummy listener. The keeper-client cases passed.

Root cause (only the test is wrong, not the backported code)

Two things in the upstream test don't hold on stable-25.8:

  1. --jwt: stable-25.8 never sets USE_JWT_CPP (src/configure_config.cmake has no line for it), so ConnectionParameters throws SUPPORT_IS_DISABLED ("JWT is disabled…") whenever --jwt is passed. Upstream builds have JWT enabled.
  2. --option = value (spaced =): the 25.8 client doesn't support this form. Upstream added it later.

Fix (test only, no C++ changes)

  • Removed --jwt from the client cases. They now check --password and --ssh-key-passphrase.
  • The "--password without a value" case now uses --password --ssh-key-passphrase SECRET. It still checks that a valueless --password doesn't stop the following secret from being cleared.
    • A valueless --password makes the client prompt for a password. The test runs without a terminal (clickhouse-test uses start_new_session=True), and stdin is now explicitly /dev/null, so the client reads an empty password and goes on to connect.
  • Dropped the "values after spaced =" case and updated .reference to match.
  • clearPasswordFromCommandLine still clears --jwt, --one-time-password and --oauth-client-secret; this branch's test just can't exercise them through the client.

Validation (builder, against this PR's CI binaries, no rebuild needed)

  • Reason given for the run: "Final check: fixed 05813 test passes on PR 2936 asan CI binary". Result on build_amd_asan/clickhouse: 1 tests passed. 0 tests skipped.
  • An earlier diagnostic run on build_amd_release confirmed the valueless --password case: stderr showed only Password for user (default):, the output matched the reference, and the client connected.
  • I ran the test once per binary. The 50× flaky check and the sanitizer jobs on the PR still have to confirm it.

Not addressed: Stress test (amd_debug), "Cannot start clickhouse-server"

I don't think this PR causes it. The PR only touches clickhouse-client, clickhouse-keeper-client and benchmark argument handling (clearPasswordFromCommandLine), and the server never calls that code. clickhouse-server.final.log ends in a normal shutdown. I didn't dig further; if it fails again on the new run, it needs a separate look.

@zvonand

zvonand commented Nov 21, 2026

Copy link
Copy Markdown
Member

@blau-ai

@blau-ai

blau-ai commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

CI triage for ba2e03d5eb

Verdict: 3 failing checks. None are caused by this PR: 1 known server crash that comes and goes, 1 infra timeout, 1 DCO check that doesn't block merging. I found nothing to fix in this PR.

All builds passed. Every other stateless suite passed too, including amd_ubsan, sequential and amd_asan, flaky check (the flaky check repeats the new test 05813_clear_credentials_from_command_line many times).


1. Stateless tests (amd_ubsan, parallel): server crashed (not this PR)

The report lists 03246_json_simd_rapid_parsers as failing with Reason: server died / ConnectionRefusedError. That test just happened to be running when the server went down. The other entries are the automatic follow-up checks: Killed by signal, Fatal messages, Logical error thrown.

The real cause, from clickhouse-server.err.log:

<Fatal> : Logical error: 'Part all_42_42_0 from table test_mhvr75ot.alter_table1 (...) remains in ZooKeeper after DROP_RANGE all_0_42_999999999_999999999'.
12. src/Storages/StorageReplicatedMergeTree.cpp:2713: DB::paranoidCheckForCoveredPartsInZooKeeper(...)
13. src/Storages/StorageReplicatedMergeTree.cpp:2782: DB::StorageReplicatedMergeTree::executeDropRange(...)
...
<Fatal> Application: Child process was terminated by signal 6.

2. GrypeScanServer / Grype Scan (infra)

##[error]The action 'Parse grype results' has timed out after 60 minutes.

The scan itself finished: the status reads "Grype Scan Completed with 0 high/critical vulnerabilities". Only the parsing step hit the 60‑minute job limit.

  • Classification: infra timeout. No vulnerability was found.
  • Next step: re-run if a green check is needed. It doesn't say anything about this PR.

3. DCO (not blocking)

None of the three commits on the branch have a Signed-off-by trailer: the cherry-picked upstream merge 4a00a8774e and the two backport commits 5351183394 and ba2e03d5eb. DCO reports action_required on recent stable-25.8 backport PRs too; for example #2774 had the same result and was still merged.

  • Next step: none needed, by the usual practice for backport PRs. If you want this check green, the maintainer has to override it in the DCO app; adding sign-offs would mean rewriting history.

Summary: the PR's own changes look healthy in CI. Re-running Stateless tests (amd_ubsan, parallel) (and Grype, if you need it green) should clear the red checks.

@zvonand
zvonand marked this pull request as ready for review November 21, 2026 13:57
@zvonand
zvonand merged commit ef6028a into stable-25.8 Nov 21, 2026
236 of 242 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

25.8 25.8 Altinity Stable backport Backport stable stable-25.8

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants