Repository navigation
Do not bypass row policies in the mergeTreeIndex table function - #115304
Conversation
|
Workflow [PR], commit [ac57378] Summary: ✅
AI ReviewSummaryThis PR closes the direct Findings
Final Verdict
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 10/10 (100.00%) · Uncovered code |
|
@yariks5s from my research, the mergeTreeProjection function also bypasses row policies. Can you confirm that? |
|
@PedroTadim it should be covered by #112329 |
|
@CurtizJ FYI^^ |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units7 translation units recompiled, 13 s compile time in total, 7 of them have a recent master baseline. |
…nges, not values; used for distributed index analysis)
Backport #115304 to 26.6: Do not bypass row policies in the mergeTreeIndex table function
Backport #115304 to 26.7: Do not bypass row policies in the mergeTreeIndex table function
Cherry pick #115304 to 26.3: Do not bypass row policies in the mergeTreeIndex table function
…Index table function
Backport #115304 to 26.3: Do not bypass row policies in the mergeTreeIndex table function
Backport #115304 to 26.5: Do not bypass row policies in the mergeTreeIndex table function
Cherry pick #115304 to 25.8: Do not bypass row policies in the mergeTreeIndex table function
…Index table function
… mergeTreeIndex table function
… mergeTreeIndex table function
…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: ClickHouse#115304
Master decided in ec411d7 (ClickHouse#115304) that `mergeTreeAnalyzeIndexes` returns mark ranges, not values, and is used for distributed index analysis, so the row policy is intentionally not enforced there. `04891_mergetree_index_respects_row_policy` pins that. Restore master's behaviour and drop the conflicting test. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=103402&sha=9c0eb6b85de088b3b50641c2e633ee4f3b124e27&name_0=PR&name_1=Fast%20test
…CESS_DENIED` The check in `CREATE ROW POLICY` protected nothing: `ON db.*`, a policy created before the table, and a table created after the policy all bypassed it, while it broke `ALTER ROW POLICY` on an existing policy and ran per node under `ON CLUSTER`. The query-time rejection in `JOIN` and `joinGet` is the actual boundary, and persisted policies never went through the interpreter anyway. The error code follows the `mergeTreeIndex` fix in #115304. Related: ClickHouse/clickhouse-private#70504 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a row policy bypass where the mergeTreeIndex table function exposed primary key and minmax index values of the rows hidden by a SELECT row policy on the source table; reading mergeTreeIndex for a table with a row policy is now denied.
Closes #115230
Workflow [PR]
Sync PR [sync-upstream/pr/115304]
Version info
26.7.6.5,26.6.4.10,26.5.8.18,26.3.22.6