Repository navigation
Require the DROP privilege for CREATE ... OR REPLACE of an access entity - #117960
Conversation
`CREATE USER OR REPLACE`, `CREATE ROLE OR REPLACE`, `CREATE QUOTA OR REPLACE`, `CREATE SETTINGS PROFILE OR REPLACE` and `CREATE ROW POLICY OR REPLACE` overwrite an existing entity of the same name, but they only required the corresponding `CREATE` privilege. A user holding just `CREATE USER` could therefore replace any other user - including a privileged one - resetting its authentication methods, its granted roles and its settings, and then log in as that user. `CREATE ... OR REPLACE` is a drop followed by a create, so it now requires the privileges of both, the same way `REPLACE TABLE`, `CREATE OR REPLACE VIEW`, `CREATE OR REPLACE FUNCTION`, `CREATE OR REPLACE WORKLOAD` and `CREATE OR REPLACE RESOURCE` already do. The `DROP` privilege is required whether or not the entity currently exists, mirroring `REPLACE TABLE`, so the check cannot be used to find out which entities exist either. Closes: #90833 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [335d081] Summary: ✅
AI ReviewSummaryThis PR closes the public-tree privilege gap in Final Verdict
LLVM Coverage ReportMeasured on commit 335d081.
Changed lines: Changed C/C++ lines covered: 58/59 (98.31%) · Uncovered code |
…-replace-access-check
The Fast test build has no SSL library, so `IDENTIFIED WITH sha256_password` fails there with `SUPPORT_IS_DISABLED`. Use `plaintext_password` instead: the test only needs a password that the replaced user can no longer log in with, not a specific hashing scheme. Also renumber the test from 05060 to 05078, because master already has ten other tests with the 05060 prefix. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117960&sha=8d554168ea280f118ccf995446e7350d591ee79c&name_0=PR&name_1=Fast%20test PR: #117960 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/CMakeFiles/dbms.dir/Processors/QueryPlan/Optimizations/Cascades/Rules/AggregationPushdown.cpp.o |
new | 278.38 KiB | +278.38 KiB |
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units
339 translation units recompiled, 2730 s compile time in total, 338 of them have a recent master baseline.
Translation units without a recent master baseline:
src/Processors/QueryPlan/Optimizations/Cascades/Rules/AggregationPushdown.cpp: 7.4 s
|
🕵 The sole red so far, |
…-replace-access-check
|
🕵 The second red, |
…ial index When the in-region mirror withholds a suite's `InRelease` (a `503` for `jammy`, `jammy-updates` and `jammy-security` on 2026-09-05), `apt-get update` only warns and carries on with the suites it did get, so the failure surfaces on `apt-get install` as `E: Package 'ca-certificates' has no installation candidate` or `E: Unable to correct problems, you have held broken packages`. `is_apt_mirror_failure` did not know either shape, so every arm64 keeper image build on the fleet reded without ever trying Canonical. Both lines are still required to be apt `E:` output inside the terminal buildx failure block, so a recovered `apt-get update` warning or a step header naming apt still does not trigger a rebuild. Example: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117960&sha=e523443dea969b125df53bdba9f23e04c37cc19b&name_0=PR&name_1=Docker%20keeper%20image (PR: ClickHouse#117960) Co-Authored-By: Claude Fable 5.1 <[email protected]>
Cherry-pick of #117960 to 26.3. The parser files conflicted only on the in-source statement documentation (`registerStatement*`), which does not exist in 26.3, so the doc hunks were dropped and the parsers kept identical to 26.3. The interpreter changes and the test apply unchanged.
Cherry pick #117960 to 26.3: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
…R REPLACE of an access entity
Cherry pick #117960 to 26.6: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
…R REPLACE of an access entity
Cherry pick #117960 to 26.7: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
…R REPLACE of an access entity
Cherry pick #117960 to 26.8: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
…R REPLACE of an access entity
Backport #117960 to 26.7: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
Backport #117960 to 26.6: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
Backport #117960 to 26.8: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
Backport #117960 to 26.3: Require the DROP privilege for CREATE ... OR REPLACE of an access entity
CREATE USER OR REPLACE,CREATE ROLE OR REPLACE,CREATE QUOTA OR REPLACE,CREATE SETTINGS PROFILE OR REPLACEandCREATE ROW POLICY OR REPLACEoverwrite an existing entity of the same name, but they only required the correspondingCREATEprivilege. A user holding justCREATE USERcould therefore replace any other user - including a privileged one - resetting its authentication methods, its granted roles and its settings, and then log in as that user:CREATE ... OR REPLACEis a drop followed by a create, so it now requires the privileges of both. This is whatREPLACE TABLE,CREATE OR REPLACE VIEW,CREATE OR REPLACE FUNCTION,CREATE OR REPLACE WORKLOADandCREATE OR REPLACE RESOURCEalready do; the access entities were the only object kind missing it. As withREPLACE TABLE, theDROPprivilege is required whether or not the entity currently exists, so the check cannot be used to find out which entities exist either.Plain
CREATEandALTERare unaffected, and so is any user holdingACCESS MANAGEMENT(which covers both theCREATEand theDROPprivileges). Only a grant ofCREATE <entity>without the matchingDROP <entity>changes behaviour.Closes: #90833
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
CREATE USER OR REPLACEand theOR REPLACEform ofCREATE ROLE,CREATE QUOTA,CREATE SETTINGS PROFILEandCREATE ROW POLICYnow require the correspondingDROPprivilege in addition toCREATE, because they overwrite an existing entity. PreviouslyCREATE USERalone was enough to reset the password of any other user, including a privileged one.Workflow [PR]
Sync PR [sync-upstream/pr/117960]
Version info
26.9.1.784(included in26.9and later)26.8.3.49,26.7.7.35,26.6.5.61,26.3.33.3