Skip to content

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

Draft
blau-ai wants to merge 2 commits into
stable-26.8from
backports/stable-26.8/131963
Draft

blau-ai wants to merge 2 commits into
stable-26.8from
backports/stable-26.8/131963

Conversation

@blau-ai

@blau-ai blau-ai commented Nov 19, 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)

…ptions-from-command-line

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

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [2ef7eb2]

@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 8215aa9

Verdict: 3 failing checks. 2 are caused by this PR and share one root cause. 1 (DCO) is a process check, not a code problem.

Check Failing test Classification
Stateless tests (amd_debug, parallel) 05813_clear_credentials_from_command_line (5 failed runs: the original plus reruns) PR-caused
Stateless tests (amd_asan_ubsan, distributed plan, parallel, selected tests) 05813_clear_credentials_from_command_line PR-caused (same issue)
DCO n/a Not a code issue. The cherry-picked upstream merge commit has no Signed-off-by trailer.

The DROPPED jobs (sequential, s3 storage, stress, AST fuzzer, BuzzHouse, SQLLogic, install, compatibility) did not run because the workflow stopped after these failures. They are not failures in their own right. The arm, tsan and msan jobs were skipped on purpose (excluded tags).


05813_clear_credentials_from_command_line (new test added by this PR)

The praktika report says the failure reproduces every time, with or without randomized settings:

05813_clear_credentials_from_command_line.sh: line 59: /proc/58782/cmdline: No such file or directory
05813_clear_credentials_from_command_line.sh: line 59: /proc/58801/cmdline: No such file or directory
05813_clear_credentials_from_command_line.sh: line 59: /proc/58820/cmdline: No such file or directory
05813_clear_credentials_from_command_line.sh: line 59: /proc/58839/cmdline: No such file or directory
05813_clear_credentials_from_command_line.sh: line 59: /proc/67592/cmdline: No such file or directory

Only the last case (keeper-client, values after :) printed its expected lines.

Root cause: the test uses --oauth-client-secret, which clickhouse-client on stable-26.8 does not have.

  • Upstream (eb82d5647e8) defines it in programs/client/Client.cpp: ("oauth-client-secret", po::value<std::string>(), ...).
  • On this branch, git grep oauth-client-secret -- programs src/Client returns nothing, so the option was never backported to 26.8.
  • Cases 1–3 (separate values, values after =, values after spaced =) all pass --oauth-client-secret. The client rejects it as an unknown option and exits before connecting, so /proc/<pid>/cmdline is gone by the time the test reads it. The PIDs 58782, 58801, 58820 are about 19 apart, which fits processes that exited immediately.
  • Cases 4 and 5 fail as a knock-on effect. show_credential_options increments CONNECTIONS for every case, whether or not that case connected. After three cases that never connected, case 4 waits for accepted >= 4 while only 1 connection has arrived. It keeps waiting until the client gives up on the silent listener and exits, then hits the same missing /proc/<pid> error. Case 5 (keeper-client) goes the same way. Case 6 passes only because keeper-client's reconnect attempts eventually push the accepted count up to 6.

The rest of the backport matches upstream. clearPasswordFromCommandLine.{h,cpp}, the test and the reference are byte-identical to upstream eb82d5647e8. KeeperClient.cpp differs only in unrelated context (DNS resolver and config path changes that 26.8 doesn't have). Clearing an option that doesn't exist (oauth-client-secret) is harmless, so the C++ change can stay as it is.

Suggested fix (test only, no C++ change): remove --oauth-client-secret from the test and its reference.

--- a/tests/queries/0_stateless/05813_clear_credentials_from_command_line.sh
+++ b/tests/queries/0_stateless/05813_clear_credentials_from_command_line.sh
@@
 echo "client, separate values"
 show_credential_options ${CLICKHOUSE_CLIENT_BINARY} --host 127.0.0.1 --port "$PORT" --query "SELECT 1" \
-    --jwt "$JWT" --password SECRET --ssh-key-passphrase SECRET --one-time-password SECRET --oauth-client-secret SECRET
+    --jwt "$JWT" --password SECRET --ssh-key-passphrase SECRET --one-time-password SECRET
 
 echo "client, values after ="
 show_credential_options ${CLICKHOUSE_CLIENT_BINARY} --host 127.0.0.1 --port "$PORT" --query "SELECT 1" \
-    --jwt="$JWT" --password=SECRET --ssh-key-passphrase=SECRET --one-time-password=SECRET --oauth-client-secret=SECRET
+    --jwt="$JWT" --password=SECRET --ssh-key-passphrase=SECRET --one-time-password=SECRET
 
 echo "client, values after spaced ="
 show_credential_options ${CLICKHOUSE_CLIENT_BINARY} --host 127.0.0.1 --port "$PORT" --query "SELECT 1" \
-    --jwt = "$JWT" --password = SECRET --ssh-key-passphrase = SECRET --one-time-password = SECRET --oauth-client-secret = SECRET
+    --jwt = "$JWT" --password = SECRET --ssh-key-passphrase = SECRET --one-time-password = SECRET
--- a/tests/queries/0_stateless/05813_clear_credentials_from_command_line.reference
+++ b/tests/queries/0_stateless/05813_clear_credentials_from_command_line.reference
@@ (remove the three lines)
---oauth-client-secret
---oauth-client-secret=
---oauth-client-secret

(The # no-fasttest: comment that mentions --oauth-client-secret can be updated as well. --jwt is defined unconditionally on 26.8, so the tag itself is still fine.)

Optional hardening: have show_credential_options count a connection only when one actually happened. For example, read the accepted count before starting the program and wait for > before, instead of using a running total. Then one failing case no longer causes the following cases to fail. This would ideally go upstream first.

DCO

The only commit is upstream's merge commit Merge pull request #131963 ... by Pedro Ferreira, and it has no Signed-off-by: line. This is expected for a backport that cherry-picks an upstream merge. It says nothing about the code and does not need a code fix. If DCO is required to merge, a maintainer can mark it as passed or add a signed-off commit.


Evidence: result_pr.json for this SHA in the Altinity CI artifact bucket, plus git grep at the PR head versus upstream eb82d5647e8. I did not re-run the test locally because the CI failure is deterministic and its cause is clear from the code. I have not pushed anything. Ask me if you'd like me to commit the test fix to this branch.

@zvonand

zvonand commented Nov 20, 2026

Copy link
Copy Markdown
Member

@blau-ai fix the fails caused by this PR here

…26.8 clickhouse-client

Signed-off-by: blau-ai <blau-ai@users.noreply.github.com>
@blau-ai

blau-ai commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

CI failures fixed: 05813_clear_credentials_from_command_line

What failed: the only test failing in both red stateless suites (amd_debug, parallel and amd_asan_ubsan, distributed plan, parallel, selected tests) was this PR's new test 05813_clear_credentials_from_command_line. It failed every time, with or without randomized settings:

05813_clear_credentials_from_command_line.sh: line 59: /proc/<pid>/cmdline: No such file or directory   (x5)

The other red checks are PR (the summary of these two) and DCO.

Root cause: the test is copied unchanged from upstream, and it passes --oauth-client-secret to clickhouse-client. stable-26.8's client doesn't have that option (programs/client/Client.cpp only has --oauth-url, --oauth-client-id and --oauth-audience). So in the first three cases the client exits right away with an unrecognized-option error, before the test can read /proc/<pid>/cmdline.

Cases 4 and 5 then fail as a knock-on effect. The test waits until the listener has accepted as many connections as cases run so far. Since cases 1–3 never connected, that count is never reached, so cases 4–5 wait until the client gives up and exits. The C++ change itself is fine.

Fix: 2ef7eb2 is pushed to this branch. It's a test-only change:

  • removes --oauth-client-secret from the three client cases in the .sh and from the .reference;
  • adds a comment explaining why.

I left --oauth-client-secret in the list in clearPasswordFromCommandLine.cpp. It does nothing on 26.8, and keeping it means the code still matches upstream.

Validation: I ran the tests on the builder using this PR's CI amd_debug binary.

  • Original test: reproduced the CI failure exactly, with the same 5 missing-/proc errors and the same stdout.
  • Fixed test (run reason: "Verify 05813 passes after dropping --oauth-client-secret (absent in stable-26.8 client)"): 05813_clear_credentials_from_command_line [ OK ] 1.38 sec.

CI on the new commit still has to confirm, including the asan job.

Note: DCO was already failing on the backport commits. My commit is signed off, but this PR is still waiting for a DCO decision from a maintainer.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants