Skip to content

Remove CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD and DROP RESOURCE from the CREATE and DROP privilege groups - #129772

Merged
serxa merged 1 commit into
ClickHouse:masterfrom
groeneai:workload-resource-privileges-not-in-create-drop
Nov 11, 2026
Merged

serxa merged 1 commit into
ClickHouse:masterfrom
groeneai:workload-resource-privileges-not-in-create-drop

Conversation

@groeneai

@groeneai groeneai commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #129033

Changelog category (leave one):

  • Backward Incompatible Change

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD and DROP RESOURCE are no longer part of the CREATE and DROP privilege groups and have to be granted explicitly (GRANT ALL still includes them). Previously GRANT CREATE ON *.* was enough to create a default workload that throttles the queries of every user. Users who manage workloads and resources through GRANT CREATE or GRANT DROP need GRANT CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD, DROP RESOURCE ON *.*. This includes grants saved before the upgrade: GRANT CREATE, CREATE WORKLOAD was saved as GRANT CREATE, and GRANT ALL ON *.* followed by a revoke on *.* as a list of groups. A users.xml grant list that revokes CREATE or DROP from ALL should revoke these privileges as well.

Description

On 26.3, 26.8, 26.9 and 26.10, a user whose only privilege is GRANT CREATE ON *.* can run CREATE RESOURCE cpu (MASTER THREAD, WORKER THREAD), CREATE WORKLOAD all and CREATE WORKLOAD default IN all SETTINGS max_concurrent_threads = 1. The workload setting defaults to default, so the queries of every other user are then scheduled through that workload. Measured on master: the same query of the default user went from 10 threads / 439 ms to 3 threads / 3538 ms, and system.scheduler showed its 355 CPU requests passing through the new /all/default/semaphore node. GRANT DROP ON *.* likewise allows dropping the administrator's workloads and resources.

Cause: in AccessType.h the four privileges are children of the CREATE and DROP groups, and a group grant includes its children.

Change: the four privileges become direct children of ALL, like KILL QUERY. The interpreters, ON CLUSTER, RESTORE of system.workloads / system.resources and the readonly / allow_ddl checks already check the individual privileges, so nothing else changes. No new privilege keyword is added, so every grant an upgraded server saves is still parsed by older servers; a WORKLOAD ADMIN group can be added on top later. An older replica of a replicated access storage keeps the old meaning of CREATE until it is upgraded.

Requested by @ nikitamikhaylov.

Validation: the new test 05564_workload_resource_privileges_not_in_create_drop fails on master and passes 50/50 with randomized settings; 01271_show_privileges is updated.


Workflow [PR]
Sync PR [sync-upstream/pr/129772]

Version info

  • Merged into: 26.11.1.2002-master (included in 26.11 and later)

`CREATE WORKLOAD`, `CREATE RESOURCE`, `DROP WORKLOAD` and `DROP RESOURCE`
were children of the `CREATE` and `DROP` privilege groups, so a user holding
only `GRANT CREATE ON *.*` (the usual grant for an application that creates
databases and tables) could create a CPU resource and a workload named
`default` with `max_concurrent_threads = 1`. The `workload` setting defaults
to `default`, so every other user's queries were then scheduled through that
workload, server-wide, until an administrator dropped it.

The four access types become direct children of `ALL`, like `KILL QUERY` and
`MOVE PARTITION BETWEEN SHARDS`: they are granted only explicitly or through
`GRANT ALL`. The interpreters already check the individual flags, so only the
access-type tree changes. No new privilege keyword is introduced, so every
grant an upgraded server writes is still parsed by an older one.

The embedded grant documentation and the workload scheduling docs are updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (round 1): no code findings
  • Gate B (cold review of the whole diff): 0 findings.
  • 💡 Changelog entry did not say that grants saved by an older server (GRANT CREATE, CREATE WORKLOAD is saved as GRANT CREATE) lose the four privileges on upgrade -> the entry now says so.

@mintlify

mintlify Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit f24239a.

Approve preview

@groeneai

groeneai commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

cc @pufit @serxa, could you review this and add the can be tested label so CI runs? CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD and DROP RESOURCE were children of the CREATE and DROP groups, so GRANT CREATE ON *.* was enough to create a default workload that schedules the queries of every user; they are now direct children of ALL, with no new privilege keyword (same class as #129033).

@clickhouse-gh

clickhouse-gh Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f24239a]

Summary: ✅


AI Review

Summary

PR #129772 removes CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD, and DROP RESOURCE from the CREATE and DROP privilege groups while retaining explicit grants and ALL. No actionable findings at head f24239a1684309acbbbe59d49e94c0ff9e30f26f. The backward-incompatible changelog describes migration of stored grants and configured revokes. The new privilege regression test and updated SHOW PRIVILEGES test both pass in Fast test.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added pr-backward-incompatible Pull request with backwards incompatible changes can be tested Allows running workflows for external contributors comp-rbac Authorization: roles, grants, quotas, row-level security, access checks. labels Nov 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f24239a16 with master e1e15a9d0 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 7ebd87aa0; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

9 translation units recompiled, 13 s compile time in total, 9 of them have a recent master baseline.

Job report

@serxa serxa self-assigned this Nov 6, 2026
@nikitamikhaylov

Copy link
Copy Markdown
Member

@serxa WDYT? This change was requested by me.

@serxa
serxa added this pull request to the merge queue Nov 11, 2026
@serxa

serxa commented Nov 11, 2026

Copy link
Copy Markdown
Member

This is good. I was thinking of making more granular RBAC for workloads specifically (that respects hierarchy for multi-tenancy and also introduces a grant for accessing workloads from queries - it can only be covered by read-only setting constraints currently).

But this PR at least closes an obvious gap. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-rbac Authorization: roles, grants, quotas, row-level security, access checks. pr-backward-incompatible Pull request with backwards incompatible changes pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants