Skip to content

Do not echo dictionary source file content in YAMLRegExpTree error - #128978

Merged
alesapin merged 3 commits into
ClickHouse:masterfrom
hanfei1991:fix-yaml-dictionary-source-info-leak
Nov 5, 2026
Merged

alesapin merged 3 commits into
ClickHouse:masterfrom
hanfei1991:fix-yaml-dictionary-source-info-leak

Conversation

@hanfei1991

@hanfei1991 hanfei1991 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

When the YAML document of a YAMLRegExpTree dictionary source is not a list of match rules, loading failed with a message that interpolated node.as<String>() - the parsed file content - back into the exception shown to the querying user. For a source file in user_files, this echoed file bytes to any user able to load the dictionary, an information disclosure.

Drop the file content from the message. The error now states only that the configuration must be a yaml list of match rules.
Close https://github.com/ClickHouse/clickhouse-private/issues/69082

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Do not echo dictionary source file content in YAMLRegExpTree error


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

Version info

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

When the YAML document of a `YAMLRegExpTree` dictionary source is not a
list of match rules, loading failed with a message that interpolated
`node.as<String>()` - the parsed file content - back into the exception
shown to the querying user. For a source file in `user_files`, this
echoed file bytes to any user able to load the dictionary, an
information disclosure.

Drop the file content from the message. The error now states only that
the configuration must be a yaml list of match rules.

Add a stateless test that points a source at a file whose content is a
scalar holding a marker and asserts the marker never reaches the client.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5108f37]

Summary: ✅


AI Review

Summary

This PR removes source-file contents from the exception raised when a YAMLRegExpTree document is not a list of match rules. The change addresses that disclosure path, but regression coverage for this security behavior was removed, so changes are requested.

Missing context / blind spots
  • ⚠️ The linked private issue returned HTTP 404; its original reproduction could not be compared with the fix.
Findings

⚠️ Majors

  • src/Dictionaries/YAMLRegExpTreeDictionarySource.cpp:337: Source-content redaction has no regression coverage. The dedicated 05493_regexp_dictionary_yaml_source_no_content_leak test was deleted. Existing 02504_regexp_dictionary_yaml_source error cases retain a sequence at the document root and would pass if the content interpolation were restored. Add a focused stateless regression test.
Tests
  • ⚠️ Load a valid dictionary, replace its source with a scalar containing a distinctive marker, and capture the failing SYSTEM RELOAD DICTIONARY. Assert that the expected configuration error appears and the marker does not. This avoids depending on eager versus lazy initial loading; demonstrate that it fails before the fix and passes afterward.
  • ⚠️ No local execution was possible: this checkout has neither a build directory nor a clickhouse executable. Existing CI results do not exercise the removed regression case.
Final Verdict

Status: ⚠️ Request changes. Restore focused regression coverage proving that invalid scalar YAML contents do not reach the client.

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default comp-dictionary Dictionaries (in-memory key-value, periodically refreshed from sources). labels Nov 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 5108f3719 with master a754f41d2 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 4d0396be8; 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

hanfei1991 and others added 2 commits November 3, 2026 15:45
With eager dictionary loading (`dictionaries_lazy_load=0`, as in CI), the
`YAMLRegExpTree` parse error fires at `CREATE DICTIONARY`, not at the
first `dictGet`. The previous test only inspected the `dictGet` output,
which in that case was only `Dictionary ... not found`, so the expected
error was reported missing.

Run `CREATE`, `SYSTEM RELOAD DICTIONARY` and `dictGet`, and inspect their
combined output, so the assertions hold under both lazy and eager
loading. Verified locally against a server in each mode.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@hanfei1991 hanfei1991 added pr-not-for-changelog This PR should not be mentioned in the changelog and removed pr-bugfix Pull request with bugfix, not backported by default labels Nov 3, 2026
@alesapin alesapin self-assigned this Nov 5, 2026
@alesapin
alesapin added this pull request to the merge queue Nov 5, 2026
Merged via the queue into ClickHouse:master with commit 92ae37b Nov 5, 2026
185 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 5, 2026
@rschu1ze rschu1ze added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Nov 11, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Nov 11, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Nov 11, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 11, 2026
Backport #128978 to 26.8: Do not echo dictionary source file content in YAMLRegExpTree error
clickhouse-gh Bot added a commit that referenced this pull request Nov 11, 2026
Backport #128978 to 26.10: Do not echo dictionary source file content in YAMLRegExpTree error
clickhouse-gh Bot added a commit that referenced this pull request Nov 11, 2026
Backport #128978 to 26.9: Do not echo dictionary source file content in YAMLRegExpTree error
alexey-milovidov added a commit that referenced this pull request Nov 11, 2026
Backport #128978 to 26.3: Do not echo dictionary source file content in YAMLRegExpTree error
groeneai pushed a commit to groeneai/ClickHouse that referenced this pull request Nov 12, 2026
groeneai pushed a commit to groeneai/ClickHouse that referenced this pull request Nov 12, 2026
groeneai pushed a commit to groeneai/ClickHouse that referenced this pull request Nov 12, 2026
leshikus pushed a commit that referenced this pull request Nov 13, 2026
leshikus pushed a commit that referenced this pull request Nov 13, 2026
leshikus pushed a commit that referenced this pull request Nov 13, 2026
leshikus pushed a commit that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-dictionary Dictionaries (in-memory key-value, periodically refreshed from sources). pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore 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-not-for-changelog This PR should not be mentioned in the changelog 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.

6 participants