Skip to content

Cherry pick #120080 to 26.8: Fix privilege check bypass in text index transform expressions - #130393

Merged
robot-ch-test-poll3 merged 68 commits into
backport/26.8/120080from
cherrypick/26.8/120080
Nov 10, 2026
Merged

robot-ch-test-poll3 merged 68 commits into
backport/26.8/120080from
cherrypick/26.8/120080

Conversation

@robot-clickhouse-ci-1

Copy link
Copy Markdown
Contributor

Original pull-request #120080

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

alexey-milovidov and others added 19 commits November 5, 2026 02:35
`countmin` sketches need the `datasketches` library, which the Fast test
build lacks, so the test failed there with `Unknown statistic type 'CountMinSketch'`.
`minmax` is always available and exercises the same implicit-statistics path.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120080&sha=882c0069c412492821ef30f9d69cff26d4ccc683&name_0=PR&name_1=Fast%20test
#120080

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since the hosts of an `ON CLUSTER` query do not run it as the initiating user
unless `distributed_ddl_use_initial_user_and_roles` is enabled, a text index
transform is now refused with `INCORRECT_QUERY` before the per-function
privilege check. Update the expectations in
`02346_text_index_transform_access_replicated_database` accordingly, and drop the
missing-table case, whose check was removed together with the binding.

Cases 3 and 4 of `02346_text_index_transform_alter_segments` tested how an
`ON CLUSTER` transform is bound for the hosts, which is no longer reachable;
the refusal is covered by `02346_text_index_transform_on_cluster`. The test no
longer uses ZooKeeper, so its tags are removed.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120080&sha=dfd5282fd456ecfbd0a600e8160317804ee28074&name_0=PR&name_1=Fast%20test
PR: #120080

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eclared

The check refusing subqueries, table references, table/set `IN` operands and
non-deterministic functions in a text index `preprocessor` / `postprocessor`
ran inside `buildActionsDAGFromAST`, i.e. on every construction of the index:
on server start, on `ATTACH` of stored metadata, and on the revalidation of
existing indices during unrelated `ALTER`s. Metadata written by older releases
with such transforms would then fail to load.

Move it into `checkTextIndexPreAndPostProcessorPermissions`, which runs only
where a user declares an index (`CREATE`, full-definition `ATTACH`, `AS src`,
and indices added by `ALTER ... ADD INDEX`), alongside the function permission
checks it complements.

Address review: #120080 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fix privilege check bypass in text index transform expressions
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Nov 9, 2026
Resolve conflicts for the 26.8 tree:
- 26.8 has no `DDLQueryOnClusterParams::additional_access_check`, so the `ON CLUSTER`
  rejection of text index transforms in `InterpreterAlterQuery` and
  `InterpreterCreateQuery::executeQueryOnCluster` is done inline before
  `executeDDLQueryOnCluster`, using `distributed_ddl_use_initial_user_and_roles` and
  `distributed_ddl_entry_format_version` >= `DDLLogEntry::INITIATOR_USER_VERSION`.
- Drop master-only context (`normalizeLegacyToTime*`, constraint row-count checks,
  `checkNoRowPolicyForSetOperands`, the `settings_defaults` parameter of
  `AlterCommands::apply`) that the conflict hunks pulled in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robot-ch-test-poll3
robot-ch-test-poll3 merged commit 115c58b into backport/26.8/120080 Nov 10, 2026
2 checks passed
@robot-ch-test-poll3
robot-ch-test-poll3 deleted the cherrypick/26.8/120080 branch November 10, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants