Skip to content

Cherry pick #129033 to 26.9: Move the handler privileges out of CREATE, ALTER and DROP into a new HANDLER ADMIN group - #132625

Merged
robot-ch-test-poll4 merged 4 commits into
backport/26.9/129033from
cherrypick/26.9/129033
Nov 20, 2026
Merged

robot-ch-test-poll4 merged 4 commits into
backport/26.9/129033from
cherrypick/26.9/129033

Conversation

@robot-ch-test-poll4

Copy link
Copy Markdown
Contributor

Original pull-request #129033

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

groeneai and others added 3 commits November 3, 2026 14:53
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]>
…lege-group

# Conflicts:
#	src/Parsers/Access/ParserGrantQuery.cpp
Move the handler privileges out of `CREATE`, `ALTER` and `DROP` into a new `HANDLER ADMIN` group
@robot-ch-test-poll4 robot-ch-test-poll4 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Nov 18, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

The conflicts are context only. In src/Access/Common/AccessType.h and 01271_show_privileges.reference, master has SHOW CONNECTIONS (#99702) right after SHOW HANDLERS, and 26.9 does not. In the privilege hierarchy in ParserGrantQuery.cpp, 26.9 still lists DROP RESOURCE and DROP WORKLOAD under DROP (#129772 is not on 26.9), so the new HANDLER ADMIN group goes after that subtree, before INSERT. The resolution changes exactly the lines this PR changes.

On a 26.9 debug build of the resolved tree, 05493_handler_admin_privilege and 01271_show_privileges pass in 50 of 50 runs, and both fail on the official 26.9.32.8 build. As on master, this changes what GRANT CREATE, GRANT ALTER and GRANT DROP give on 26.9: they no longer include the handler privileges.

I cannot push to cherrypick/26.9/129033. The branch on my fork has this PR's head a33dd5a8b140 as an ancestor, so applying it is a fast-forward:

git fetch https://github.com/groeneai/ClickHouse.git resolve-26.9-cherrypick-129033
git push origin FETCH_HEAD:cherrypick/26.9/129033

# Conflicts:
#	src/Access/Common/AccessType.h
#	src/Parsers/Access/ParserGrantQuery.cpp
#	tests/queries/0_stateless/01271_show_privileges.reference
@robot-ch-test-poll4
robot-ch-test-poll4 merged commit 342da73 into backport/26.9/129033 Nov 20, 2026
2 checks passed
@robot-ch-test-poll4
robot-ch-test-poll4 deleted the cherrypick/26.9/129033 branch November 20, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants