Skip to content

Hide queue engine secrets written with the legacy s3queue_ prefix - #123060

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai-s3queue-legacy-prefix-secret-masking
Sep 30, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai-s3queue-legacy-prefix-secret-masking

Conversation

@groeneai

@groeneai groeneai commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #122997

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):

Fixed secret settings of S3Queue and AzureQueue tables written with the legacy s3queue_ prefix, such as s3queue_after_processing_move_secret_access_key, being shown in cleartext in SHOW CREATE TABLE, system.tables, system.query_log and the server log. They are now hidden as they are without the prefix.

Description

On 26.8.15.10-lts, this statement is accepted and SHOW CREATE TABLE, system.tables and system.query_log show the secret in cleartext, while the same statement with after_processing_move_secret_access_key shows '[HIDDEN]':

CREATE TABLE q (a String) ENGINE = S3Queue('http://host/bucket/data/*', NOSIGN, 'CSV')
SETTINGS mode = 'unordered', s3queue_after_processing_move_secret_access_key = 'secret';

The queue engines accept every setting with the documented legacy s3queue_ prefix, but the masking of a SETTINGS clause looks the rule up by the name as written, and every rule is keyed on the canonical name. s3queue_after_processing_move_connection_string (also on AzureQueue) and s3queue_format_avro_schema_registry_url leak the same way, and so does ALTER TABLE ... MODIFY SETTING s3queue_... in system.query_log.

renderSecretChangeValue now drops the prefix before both lookups. No masking rule is keyed on an s3queue_ name, and the query-level s3queue_* settings strip to names no rule holds, so only the prefixed spelling of a masked name renders differently.

The new test fails on master with the three legacy values in cleartext and passes with the fix (50/50 randomized runs).

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.1093-master (included in 26.10 and later)
  • Backported to: 26.9.9.18, 26.8.15.23, 26.7.20.7, 26.3.39.6

`S3Queue` and `AzureQueue` accept every setting with the legacy `s3queue_`
prefix: `ObjectStorageQueueSettings::loadFromQuery` renames the setting through
`adjustSettingName`, which strips the prefix from any name, and `alter()` does
the same. The masking of a `SETTINGS` clause looks the rule up by the name as
written, and every rule is keyed on the canonical name, so a secret written as
`s3queue_after_processing_move_secret_access_key`,
`s3queue_after_processing_move_connection_string` or
`s3queue_format_avro_schema_registry_url` matched no rule and was printed in
cleartext by `SHOW CREATE TABLE`, `system.tables` and, through
`hasSecretParts`, `system.query_log` and the server log.

`renderSecretChangeValue` now drops the prefix once and gives the unprefixed
name to both the query-level rules and the engine rules. No key of any masking
map starts with `s3queue_`, and the four query-level settings that do
(`s3queue_default_zookeeper_path`, `s3queue_migrate_old_metadata_to_buckets`,
`s3queue_enable_logging_to_s3queue_log`, `s3queue_keeper_fault_injection_probability`)
strip to names no map holds, so the only changes that render differently are
the `s3queue_`-prefixed spellings of a masked name.

Requested in ClickHouse#122997 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 30, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings), plus my own review (1 nit).

# Sev Finding Verdict Evidence / action
1 💡 Only the unprefixed name is looked up, so a masking rule keyed on an s3queue_ name would be unreachable AGREE, noted, not blocking No rule in the query-level map or the six engine maps is keyed on an s3queue_ name, so nothing renders differently today. Looking up both names is the drop-in if preferred.

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20260930-105700

@clickhouse-gh

clickhouse-gh Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b2fdac5]

Summary: ❌

job_name test_name status info comment
Upgrade check (amd_release) FAIL
Logical error: Part A intersects previous part B. It is a bug or a result of manual intervention (STID: 3562-39cd) FAIL cidb IGNORED

AI Review

Summary

This PR fixes secret masking for queue-engine SETTINGS written with the legacy s3queue_ prefix by canonicalizing the setting name before the shared masking lookup in ASTSetQuery. That matches the existing queue-setting normalization path, and the new stateless regression covers the user-visible leak surfaces in SHOW CREATE TABLE, system.tables, and system.query_log; I did not find any unresolved correctness, coverage, or metadata issues in the current diff.

Final Verdict

Status: ✅ Approve

LLVM Coverage Report

Measured on commit b2fdac5.

Metric Baseline Current Δ
Lines 88.20% 88.20% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 79.60% 79.60% +0.00%

Changed lines: Changed C/C++ lines covered: 8/8 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 30, 2026
@Algunenano Algunenano self-assigned this Sep 30, 2026
@Algunenano Algunenano added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Sep 30, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-s3queue S3Queue/AzureQueue engines (queue-based ingestion from object storage). label Sep 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b2fdac556 with master 1af19c2f5 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 09baa85ae; 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.

Compile time of recompiled translation units

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

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - b2fdac5

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Upgrade check (amd_release) / Logical error: Part A intersects previous part B (STID 3562-39cd) after the upgrade, the new server aborted while loading a table left behind by the stress phase: Part all_5_10_1 intersects previous part all_5_5_1 in PartLoadingTree::add at startup. The same STID failed on 24 other PRs in the last 30 days (20 of them in this same check). This PR changes only secret masking in ASTSetQuery.cpp, nothing on the part loading path #121708 (mine, open)
Mergeable Check, PR rollups, red only because of the row above #121708 (mine, open)

146 of 146 check runs completed (106 passed, 39 not selected, 1 red: the job above), Finish Workflow is green and CH Inc sync passed. CIDB has no other FAIL or ERROR test row on this head.

Session id: cron:our-pr-ci-monitor:20260930-160147

@Algunenano
Algunenano added this pull request to the merge queue Sep 30, 2026
Merged via the queue into ClickHouse:master with commit dc5b030 Sep 30, 2026
147 of 149 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 30, 2026
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR labels Sep 30, 2026
clickhouse-gh Bot added a commit that referenced this pull request Oct 1, 2026
Backport #123060 to 26.8: Hide queue engine secrets written with the legacy `s3queue_` prefix
clickhouse-gh Bot added a commit that referenced this pull request Oct 1, 2026
Backport #123060 to 26.7: Hide queue engine secrets written with the legacy `s3queue_` prefix
Algunenano added a commit that referenced this pull request Oct 1, 2026
Backport #123060 to 26.3: Hide queue engine secrets written with the legacy `s3queue_` prefix
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Oct 2, 2026
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Oct 2, 2026
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Oct 2, 2026
Algunenano added a commit that referenced this pull request Oct 2, 2026
Backport #123060 to 26.9: Hide queue engine secrets written with the legacy `s3queue_` prefix
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Oct 9, 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-s3queue S3Queue/AzureQueue engines (queue-based ingestion from object storage). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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