Skip to content

Cherry pick #120312 to 26.8: Refuse a Set table on the right side of IN when a row policy applies to it - #121985

Closed
robot-clickhouse-ci-2 wants to merge 14 commits into
backport/26.8/120312from
cherrypick/26.8/120312
Closed

robot-clickhouse-ci-2 wants to merge 14 commits into
backport/26.8/120312from
cherrypick/26.8/120312

Conversation

@robot-clickhouse-ci-2

Copy link
Copy Markdown
Contributor

Original pull-request #120312

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

harikrishnan94 and others added 14 commits September 15, 2026 22:31
…ies to it

A row policy on a `Set`-engine table was accepted and listed in `system.row_policies`, but
the only consumer of such a table, the right-hand side of `IN`, reads the prebuilt set directly
and never sees the filter, so every hidden element stayed testable. The engine has no read path
that could apply the policy, so such a query now fails with `ACCESS_DENIED`, the same way
`mergeTreeIndex` fails closed for a policed source table. The check runs in the planner, in the
legacy expression analyzer that mutations still use, and when a replica materializes a set
from a serialized plan. `ExpressionAnalyzer::isPlainStorageSetInSubquery` had no callers and
is removed.

Closes: ClickHouse/clickhouse-private#70502
Related: #115304
The legacy `IN` path tested the `StorageSet` cast twice around the Cloud `SharedSet` block. One
block now runs the row-policy check and both dispatches. The comments and the error message drop
the invented wording and read as short sentences. No behaviour change.
Cover serialized query plans when only the remote worker has a row policy. The control query proves the initiator can plan it before the worker rejects it with `ACCESS_DENIED`.
…ne-row-policy

# Conflicts:
#	src/Interpreters/MutationsInterpreter.cpp
Run the initiator-side policy check before `ALTER` and `UPDATE` queries are enqueued for `ON CLUSTER` execution.

PR: #120312
Review: #120312 (comment)
Resolve mutation `Set` operands through the analyzer access path and defer clustered policy checks until the standard cluster and target privileges pass.

#120312
#120312 (comment)
Run the source-table policy check after the standard cluster and target access checks. Reject unresolved source operands and require both update and delete privileges for an ambiguous remote `_row_exists` assignment.

#120312

#120312 (comment)

#120312 (comment)
Check full-column `SELECT` access before evaluating row policies whenever a prebuilt `Set` is used by `IN`.

#120312

#120312 (comment)

#120312 (comment)
`IgnoreSet` functions return their dry-run value without reading the RHS. Do not prepare or authorize the RHS, but keep the dummy set column expected by the analyzer action builder.

Related: #120312
Related: #120312 (comment)
Refuse a `Set` table on the right side of `IN` when a row policy applies to it
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 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 Sep 24, 2026
@maxknv
maxknv deleted the cherrypick/26.8/120312 branch November 13, 2026 13:24
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.

4 participants