Skip to content

Skip the log entries of test_mask_sensitive_info's own system.query_log probes in its server log checks - #124691

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-mask-sensitive-info-probe-log-entries
Oct 9, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-mask-sensitive-info-probe-log-entries

Conversation

@groeneai

@groeneai groeneai commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #124507

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

...

Description

test_mask_sensitive_info/test.py::test_iceberg_cluster_function fails on #124507 (Integration tests (amd_llvm_coverage, 4/8), again on its head c23830da) with assert not node.contains_in_log('Eby8...', exclusion_substring='SELECT COUNT() FROM system.query_log WHERE query LIKE ').

The secret in the log is the test's own probe, not a server leak. check_logs() greps the whole server log and skips only lines containing the probe's SQL prefix, but the probe ... WHERE query LIKE '%<secret>%' AND query NOT LIKE '<prefix>%' logs <secret> itself. With apply_string_filters_during_scan = 1 (the new default in #124507) the LIKE half alone is moved to PREWHERE, and the PREWHERE trace lines and the multi-line Original PREWHERE DAG: dump print <secret> without the prefix. The Azurite account key is shared by several tests, so the connection-string probe of test_table_functions_object_storage_cluster fails the later test_backup_table_azure_named_collection and test_iceberg_cluster_function.

The probes now run with a mask_sensitive_info_probe_ query id prefix, and the server log checks drop every log entry of such a query, including the continuation lines of multi-line messages, before grepping. The probes also run with apply_string_filters_during_scan = 1, so the module exercises this path on every run.

Validation with a master debug build, whole module: the new test passes (3 runs), and with the old log check it fails exactly those two tests. A wrong prefix in the filter brings both failures back, and a non-probe query that logs the key is still caught.


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

Version info

  • Merged into: 26.10.1.1981-master (included in 26.10 and later)

groeneai and others added 2 commits October 8, 2026 14:59
check_logs() grepped the whole server log for each checked string and
skipped only lines containing the probe's SQL prefix. The probe itself
logs the string, and with apply_string_filters_during_scan = 1 the LIKE
conjunct alone is moved to PREWHERE: the PREWHERE trace lines and the
multi-line "Original PREWHERE DAG:" dump print it without the prefix
(continuation lines carry no query id at all). The Azurite account key
is shared by several tests, so the connection-string probe of
test_table_functions_object_storage_cluster failed the later
test_backup_table_azure_named_collection and test_iceberg_cluster_function
(seen on ClickHouse#124507).

Run the probes with a fixed query id prefix and drop every log entry of
such a query, header and continuation lines, before grepping. All other
log lines are still checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ters_during_scan = 1

The probe-entry log filter only matters when the probe's LIKE conjunct is
moved to PREWHERE alone, which needs apply_string_filters_during_scan = 1
(default false). Without it the module passes with or without the filter,
so a revert of the filter would stay green. Pin the setting on the probe
query only (client flag, the probe's SQL is unchanged), so every run of the
module exercises the path the filter guards.

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 Oct 8, 2026
@groeneai

groeneai commented Oct 8, 2026

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

Pre-publication review by an independent model (engine: codex; 2 rounds, 1 finding) plus my own review (2 rounds, 1 finding).

# Sev Finding Verdict Evidence / action
1 ⚠️ The module never enabled apply_string_filters_during_scan, so on master it passed even with the old log check (test.py, system_query_log_contains_search_pattern) AGREE, fixed The probes now pin the setting. With the old log check, the module fails test_backup_table_azure_named_collection and test_iceberg_cluster_function on the CI assertion; with the new check it passes 18/18 (3 runs).
2 💡 contains_in_log's exclusion_substring in helpers/cluster.py loses its only caller AGREE, not changed Shared helper, left as is

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

Session id: cron:clickhouse-review-slot-11:20261008-164700

@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Master debug build, whole module, no config override: with the old log check, test_backup_table_azure_named_collection and test_iceberg_cluster_function fail on every run, same assertion as CI, because the probes pin apply_string_filters_during_scan = 1.
b Root cause explained? The probe ... WHERE query LIKE '%<secret>%' AND query NOT LIKE '<prefix>%' logs the secret itself; with the setting on, the LIKE half alone goes to PREWHERE and its trace lines and multi-line DAG dump print the secret without the prefix the log check excludes. The Azurite key is shared across tests.
c Fix matches root cause? Yes. The log check now skips the probe's own log entries by query id (header and continuation lines) instead of by text. The probe pins apply_string_filters_during_scan = 1 so the path is exercised on every run; the exclusion itself is keyed on the query id. No tag or log-level change.
d Test intent preserved / new tests added? Yes. All non-probe log lines are still checked: a non-probe SELECT '<key>' added to test_iceberg_cluster_function still fails it. Test-only change.
e Both directions demonstrated? Yes. New test: 18 passed (3 runs). Same tree with the old log check: 2 failed / 16 passed. Wrong filter prefix: the same 2 failures. Non-probe query logging the key: caught.
f Fix is general across code paths? Yes. All three probe call sites go through system_query_log_contains_search_pattern, both log loops of check_logs go through the new filter; exclusion_substring had no other caller.
g Fix generalizes across inputs (params/datatypes/wrappers)? Single-line and multi-line log messages are both handled; pattern escaping and grep -a semantics are unchanged; background entries are still checked.
h Backward compatible? (maintainer-approved exception only) N/A (test-only).
i Invariants and contracts preserved? A log assertion never sees a line of the test's own probe, and every other line is still scanned (measured on a run log: all 23965 non-probe entry headers kept, all 16036 probe headers dropped).

Session id: cron:clickhouse-impl-slot-5:20261008-155600

@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a746958]

Summary: ✅


AI Review

Summary

This test-only PR fixes test_mask_sensitive_info by excluding the module’s own system.query_log probe entries from server-log scans via a dedicated query_id prefix and by forcing apply_string_filters_during_scan = 1 on those probes so the regression path stays exercised. I reviewed the current diff together with the existing PR discussion and did not find an unresolved correctness, safety, or coverage issue in the updated approach.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 8, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 8, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 9, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 9, 2026
Merged via the queue into ClickHouse:master with commit 4d49969 Oct 9, 2026
152 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
@clickhouse-gh clickhouse-gh Bot added comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). and removed comp-testing Test content only (no production code). labels Nov 22, 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-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-ci 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