Repository navigation
Fix table engine grants - #98984
Merged
Merged
Fix table engine grants#98984
Conversation
Contributor
|
Workflow [PR], commit [bf67746] Summary: ❌
AI ReviewSummaryThis PR replaces a hardcoded source-engine mapping with ClickHouse Rules
Final Verdict
|
pufit
marked this pull request as ready for review
March 8, 2026 16:39
1 task
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 100.00% (56/56, 1 noise lines excluded) |
Merged
via the queue into
ClickHouse:master
with commit Mar 23, 2026
48c3107
146 of 148 checks passed
zlareb1
added a commit
that referenced
this pull request
Mar 25, 2026
…rants PR #98984 replaced a hardcoded source engine list with `getAllStorages()`, which incorrectly included database engines (e.g. `Shared` in ClickHouse Cloud) in the `TABLE ENGINE` grant check. This caused `CREATE DATABASE` to fail with `ACCESS_DENIED` even when `table_engines_require_grant = false`. Adds `test_create_database_does_not_require_table_engine_grant` to both `test_with_table_engine_grant.py` and `test_without_table_engine_grant.py` to verify that `CREATE DATABASE` (with default `Atomic` engine or explicit `ENGINE = Atomic`) succeeds with only `CREATE DATABASE` privilege and no `TABLE ENGINE` grants, regardless of the `table_engines_require_grant` setting. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 task
zlareb1
added a commit
that referenced
this pull request
Mar 25, 2026
With `table_engines_require_grant = true`, `TABLE ENGINE ON Atomic` was never implicitly granted — before PR #98984, after it, or after the revert. The test would fail on all three states, so it tests behaviour that was never supported and adds no regression signal. The test in `test_without_table_engine_grant.py` (setting=false) is the correct regression test: before PR #98984 the wildcard `TABLE_ENGINE ON *` grant covered database engines like `Atomic`; after PR #98984 only StorageFactory engines are granted individually, leaving `Atomic` uncovered. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
pufit
added a commit
that referenced
this pull request
Mar 25, 2026
Re-introduce dynamic engine lookup from StorageFactory (replacing the hardcoded source_table_engines list) and additionally grant database engines from DatabaseFactory when table_engines_require_grant=false. The previous attempt (#98984) missed database engines (Atomic, Shared, Replicated, etc.) which are registered in DatabaseFactory, not StorageFactory. CREATE DATABASE checks TABLE_ENGINE access in InterpreterCreateQuery, so omitting them caused ACCESS_DENIED on CREATE DATABASE. Closes #71544
1 task
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Replace the hardcoded
source_table_engineslist with a runtime lookup viaStorageFactory::getAllStorages().This adds access checks for some missing table engines and closes #71544
Note
Medium Risk
Touches privilege/authorization logic by changing how
TABLE_ENGINEis implicitly granted based on sourceREAD/WRITE, which could unintentionally broaden or restrict engine usage if misapplied. Adds integration coverage, but behavior changes affect security-sensitive access checks.Overview
Fixes implicit
TABLE_ENGINEprivilege derivation by removing the hardcodedsource_table_engineslist and instead iteratingStorageFactory::getAllStorages()to map each engine’s registeredsource_access_typetoREAD/WRITEsource grants.Adjusts the sync logic to only add grants (no revokes) to avoid stripping
WITH GRANT OPTIONstate when computing implicit rights (regression noted in #71544).Extends integration tests to cover source-grant→engine access bridging, source revocation blocking engine usage, and preserving
GRANT TABLE ENGINE ... WITH GRANT OPTIONbehavior under both table-engine-grant enabled/disabled configs.Written by Cursor Bugbot for commit e47a373. This will update automatically on new commits. Configure here.
Version info
26.4.1.155