Repository navigation
Move the handler privileges out of CREATE, ALTER and DROP into a new HANDLER ADMIN group - #129033
Conversation
CREATE_HANDLER, ALTER_HANDLER and DROP_HANDLER were children of the CREATE, ALTER and DROP groups, so GRANT CREATE ON *.* (or GRANT ALTER) was enough to define or rewrite a SQL-defined HTTP handler. The handler query runs with the privileges of whoever calls the URL, so a user with only CREATE could plant e.g. `AS GRANT SELECT ON secret.* TO me` behind METHODS (POST) and gain it the next time a privileged user posts there. Add a HANDLER_ADMIN group under ALL and re-parent all four handler privileges (including SHOW_HANDLERS) to it, the same layout as NAMED_COLLECTION_ADMIN. ALL holders and explicit grants of the individual privileges are unaffected; the readonly and allow_ddl checks are keyed on the individual privileges and do not change. A GROUP takes no flag bit, so AccessFlags::SIZE stays 256; AccessType now has 256 values, the full range of uint8_t. Update 01271_show_privileges, add 05493_handler_admin_privilege, and document the group in the CREATE HANDLER and GRANT documentation sources. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 4 findings over 3 passes on the same tree; the last pass had 0 findings). None needed a code change; three changed the PR description.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261103-145800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261103-140200 |
|
cc @pufit @alexey-milovidov, could you review this and add the |
|
Workflow [PR], commit [150cec2] Summary: ✅
AI ReviewSummaryThe change moves the four handler privileges into Findings❌ Blockers
Tests
Performance & SafetyConsumers of the newly grouped
Final VerdictStatus: ❌ Block. Preserve compatibility of persisted existing handler grants and cover the mixed-version update case. No new inline comments were posted: the remaining issue was already explicitly dismissed in the author's discussion and is retained here only. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units693 translation units recompiled, 5509 s compile time in total, 693 of them have a recent master baseline. |
CI finish ledger - 8484806Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The first two runs of this head stopped at Session id: cron:our-pr-ci-monitor:20261103-200006 |
…lege-group # Conflicts: # src/Parsers/Access/ParserGrantQuery.cpp
|
@groeneai @alexey-milovidov — this PR looks backward incompatible but is categorized as Why: Re-parenting Suggested category: |
|
I changed the changelog category to |
Cherry pick #129033 to 26.8: Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
Cherry pick #129033 to 26.9: Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
Cherry pick #129033 to 26.10: Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
…`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
Backport #129033 to 26.10: Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
Backport #129033 to 26.9: Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
Backport #129033 to 26.8: Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
Related: #106231
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
CREATE HANDLER,ALTER HANDLER,DROP HANDLERandSHOW HANDLERSnow form the newHANDLER ADMINprivilege group and are no longer part of theCREATE,ALTERandDROPgroups. PreviouslyGRANT CREATE ON *.*orGRANT ALTER ON *.*was enough to define or rewrite an HTTP handler, whose query runs with the privileges of the user who calls it. Users who manage handlers must now be grantedHANDLER ADMINor the individual handler privileges, including users whose stored grants name only the old groups: for example,GRANT CREATE, CREATE HANDLERis stored asGRANT CREATE, andGRANT ALLfollowed byREVOKE SYSTEMis stored as a list of groups. RevokingCREATE,ALTERorDROPno longer revokes them, so a configured grant list that revokes one of these fromALLshould also revokeHANDLER ADMIN.Description
On 26.8, 26.9 and 26.10 (
system.privilegeschecked on 26.8.18.2, 26.9.11.2 and 26.10.2.103), a user whose only privilege isGRANT CREATE ON *.*can runCREATE HANDLER. The handler's query runs with the privileges of whoever calls its URL, soCREATE HANDLER h URL '/h' METHODS (POST) AS GRANT SELECT ON secret.* TO megives that userSELECT ON secret.*the next time a privileged user sends a POST to/h.GRANT ALTER ON *.*can rewrite an existing handler the same way throughALTER HANDLER.Cause: in
AccessType.hthe handler privileges are children of theCREATE,ALTERandDROPgroups, and a group grant includes its children.Change: a new
HANDLER ADMINgroup underALLholds all four handler privileges, the same layout asNAMED COLLECTION ADMIN.ALLand standalone grants of the individual privileges keep working, and thereadonly/allow_ddlchecks are unchanged (they check the individual privileges). This PR narrows who may define a handler; what a stored handler query may do when it is invoked will be addressed in a separate PR.Requested by @ nikitamikhaylov.
Validation: the new test
05493_handler_admin_privilegefails on master (a user withCREATE, ALTER, DROP ON *.*can create, alter and drop handlers, andGRANT HANDLER ADMINdoes not parse) and passes 50/50 with randomized settings.01271_show_privilegesis updated.Grants holding all four handler privileges are now saved as
HANDLER ADMIN, which servers without this change do not parse (relevant for a replicated access storage during a rolling upgrade).Workflow [PR]
Sync PR [sync-upstream/pr/129033]
Version info
26.11.1.2183-master(included in26.11and later)26.10.9.12,26.9.34.23,26.8.43.11