Repository navigation
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
Closed
robot-clickhouse-ci-2 wants to merge 14 commits into
robot-clickhouse-ci-2 wants to merge 14 commits into
Conversation
…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`.
`DatabaseReplicated` replays mutations with an internal context, which can otherwise bypass row policies on `Set` operands. Check those operands with the submitting context before enqueueing the mutation. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120312&sha=b7a2906a123003ca929ace0092959bb287543826&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%203%2F3%29 PR: #120312
Run the `Set` row-policy precheck with the submitting context before local background mutation dispatch and before replicated enqueue. Cover ALTER, standalone DELETE, and standalone UPDATE syntaxes. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120312&sha=b7a2906a123003ca929ace0092959bb287543826&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%203%2F3%29 PR: #120312 Related: #120312 (comment) Related: #120312 (comment)
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-picklocally.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:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job