Repository navigation
Fix system.dictionaries returning 0 rows with partial SHOW DICTIONARIES revoke - #106105
Conversation
…ARIES` revoke `StorageSystemDictionaries::fillData` used `isGranted(SHOW_DICTIONARIES)` without database/table arguments as an all-or-nothing gate: if the user didn't have the privilege on every database and table, it returned empty results immediately. Any partial revoke (e.g. on `system.billing` in ClickHouse Cloud) caused the global check to fail, hiding all dictionaries. All other system tables (`StorageSystemTables`, `StorageSystemReplicas`, etc.) use the global check as an optimization flag to skip per-entry checks, not as an early return. Fix `StorageSystemDictionaries` and `StorageSystemCompletions` to match this pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Workflow [PR], commit [4bc8f42] Summary: ✅
AI ReviewSummaryThis PR fixes Final VerdictStatus: ✅ Approve |
| @@ -312,8 +312,7 @@ void fillDataWithPolicies(MutableColumns & res_columns, const ContextPtr & conte | |||
| void fillDataWithDictionaries(MutableColumns & res_columns, const ContextPtr & context) | |||
| { | |||
| const auto & access = context->getAccess(); | |||
| if (!access->isGranted(AccessType::SHOW_DICTIONARIES)) | |||
| return; | |||
| const bool need_to_check_access_for_dictionaries = !access->isGranted(AccessType::SHOW_DICTIONARIES); | |||
There was a problem hiding this comment.
Isn't this condition good enough. I mean, is access is not Granted checking a second condition may open potential breaches.
There was a problem hiding this comment.
access->isGranted(AccessType::SHOW_DICTIONARIES) will return false if there is a revoke on SHOW_DICTIONARIES on any of the database/table/dictionary. So we won't see all other dictionaries that we have access to. Instead, in this case we should check access to each dictionary independently in a loop. If access->isGranted(AccessType::SHOW_DICTIONARIES) returns true, it means we have access to all dictionaries.
There was a problem hiding this comment.
This was new to me too, apparently we handle this differently for AccessType::SHOW_TABLES. Here's an example: https://github.com/ClickHouse/ClickHouse/blob/master/src/Storages/System/StorageSystemTables.cpp#L518
…voke Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 18/20 (90.00%) | Lost baseline coverage: none · Uncovered code |
Cherry pick #106105 to 26.3: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
…with partial `SHOW DICTIONARIES` revoke
Cherry pick #106105 to 26.4: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
…with partial `SHOW DICTIONARIES` revoke
Cherry pick #106105 to 26.5: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
…with partial `SHOW DICTIONARIES` revoke
Backport #106105 to 26.5: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
Backport #106105 to 26.3: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
Backport #106105 to 26.4: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
|
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment. TL;DRFix ReproductionBisect
Affects
Suggested next stepManual triage of the Component: cc fix PR author: @Avogar ClickGap · Finding: |
Cherry pick #106105 to 25.8: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
…with partial `SHOW DICTIONARIES` revoke
Backport #106105 to 25.8: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
…ng 0 rows with partial `SHOW DICTIONARIES` revoke
…6105 Backport ClickHouse#106105 to 26.4: Fix `system.dictionaries` returning 0 rows with partial `SHOW DICTIONARIES` revoke
OTHER: partial SHOW DICTIONARIES revoke -> wrong (0 rows). Effect in the production build a394e92: its upstream test(s) 04268_system_dictionaries_partial_revoke fail on it and pass on official 26.8.8.8, run on isolated servers (evidence/fix_ci_20260925/upstream_repro/server_triage_PROD263_vs_UP2688.tsv). Upstream patch unchanged, with its test(s): 04268_system_dictionaries_partial_revoke. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
system.dictionariesreturning 0 rows with partialSHOW DICTIONARIESrevoke.Version info
26.6.1.24326.5.2.20,26.4.4.25,26.3.13.21,25.8.25.18