Repository navigation
Require drop privileges when restoring replacement access entities - #127136
Conversation
Cover replacement without scoped `DROP`, partial revokes cancelling independent requirements, and missing `GRANT OPTION` when restoring grants. Use the existing backup integration fixture because access backups include every entity of the requested type, making shared stateless access state unsuitable for these checks.
Require the corresponding scoped `DROP` privilege for `create_access='replace'`, matching `CREATE ... OR REPLACE` even when the target does not exist. Include `DROP_MASKING_POLICY` for the existing `CLICKHOUSE_CLOUD` branch. Build grant requirements separately and combine independent requirements with `AccessRights::makeUnion` so partial revokes cannot remove permissions required by other entities or tables. Restoring a grant requires `GRANT OPTION` even when the backed-up entity lacks it. Related: #127128
|
Workflow [PR], commit [4a4b936] Summary: ✅
AI ReviewSummaryThis PR tightens Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units11 translation units recompiled, 38 s compile time in total, 11 of them have a recent master baseline. Median compile-time ratio to the baselines is ×0.95 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
Backport #127136 to 26.10: Require drop privileges when restoring replacement access entities
The one conflict is the `MaskingPolicy::TYPE` branch of `getRequiredAccess`, which `26.9` does not have: it was added to `master` after the branch point and is therefore in the base the cherry-pick was taken from, not in what #127136 changes. The branch keeps its five cases and the throwing `default`. `MaskingPolicy` itself does exist in `26.9` (the header, `AccessEntityType::MASKING_POLICY` and the three access types), but the switch branch is `#if CLICKHOUSE_CLOUD`, so its absence does not change an open-source build. The other five entity types get the `DROP` requirement as upstream. Co-Authored-By: Claude Opus 5 <[email protected]>
…acement access entities
Backport #127136 to 26.9: Require drop privileges when restoring replacement access entities
Cherry pick #127136 to 26.3: Require drop privileges when restoring replacement access entities
…acement access entities
Cherry pick #127136 to 26.7: Require drop privileges when restoring replacement access entities
…acement access entities
Cherry pick #127136 to 26.8: Require drop privileges when restoring replacement access entities
…acement access entities
Backport #127136 to 26.8: Require drop privileges when restoring replacement access entities
Backport #127136 to 26.7: Require drop privileges when restoring replacement access entities
Backport #127136 to 26.3: Require drop privileges when restoring replacement access entities
RESTOREwithcreate_access='replace'could overwrite access entities while checking only theirCREATEprivileges. Require the correspondingDROPprivilege, including when the target does not exist, matchingCREATE ... OR REPLACE. Preserve the appropriate scope for users, roles, row policies, settings profiles, quotas, and masking policies in Cloud builds.Combine independent restoration requirements with
AccessRights::makeUnionso partial revokes in backed-up grants cannot remove privileges required to restore other entities or tables. Restoring grants also requiresGRANT OPTION, even when the backed-up entity does not have it.Regression tests cover row-policy replacement, user/role partial revokes, grant-option checks, and table restoration. They reuse the existing backup integration fixture because access backups include every entity of a requested type and need an isolated access store. The first commit contains the tests; the second contains the complete fix, including the existing
CLICKHOUSE_CLOUDmasking-policy branch.Supersedes the incomplete version below.
Related: #127128
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix insufficient privilege checks when restoring access entities. Replacement with
create_access='replace'now requires the correspondingDROPprivilege, and partial revokes in a backup cannot reduce the privileges required for restoration.Workflow [PR]
Sync PR [sync-upstream/pr/127136]
Version info
26.11.1.517-master(included in26.11and later)26.10.2.77,26.9.26.3,26.8.35.7,26.3.61.8