Repository navigation
Reject named collection DDL in readonly mode and with allow_ddl = 0 - #130952
Conversation
`CREATE NAMED COLLECTION`, `ALTER NAMED COLLECTION` and `DROP NAMED COLLECTION` were allowed with `readonly = 1`, `readonly = 2` and `allow_ddl = 0`, unlike the DDL of tables, dictionaries, functions, workloads and resources. Add the named collection DDL access types to the flags checked in `ContextAccess`. The fix comes from chDB (https://github.com/chdb-io/chdb-core), which carries it as a patch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [75958db] Summary: ✅
AI ReviewSummaryThe PR makes Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes3 object files changed (+21.88 KiB total), 0 added.
711 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units7 translation units recompiled, 12 s compile time in total, 7 of them have a recent master baseline. |
Backport #130952 to 26.8: Reject named collection DDL in readonly mode and with `allow_ddl = 0`
Backport #130952 to 26.9: Reject named collection DDL in readonly mode and with `allow_ddl = 0`
Backport #130952 to 26.10: Reject named collection DDL in readonly mode and with `allow_ddl = 0`
…adonly mode and with `allow_ddl = 0`
…adonly mode and with `allow_ddl = 0`
…eadonly mode and with `allow_ddl = 0`
…de and with `allow_ddl = 0`
Cherry pick #130952 to 26.3: Reject named collection DDL in readonly mode and with `allow_ddl = 0`
…e and with `allow_ddl = 0`
Backport #130952 to 26.3: Reject named collection DDL in readonly mode and with `allow_ddl = 0`
…eadonly mode `readonly` and `allow_ddl` are enforced in `ContextAccess::checkAccessImplHelper` by a deny-list of requested access types. Three statements that change persistent state were missing from it: - `ALTER DATABASE ... MODIFY COMMENT` / `MODIFY SETTING` request the children of `ALTER_DATABASE`, which `table_ddl` did not contain, so they ran at `readonly = 1`, `readonly = 2`, over HTTP GET and with `allow_ddl = 0`. `ALTER_DATABASE` is now part of `table_ddl`, like `ALTER_TABLE` and `ALTER_VIEW`. - `KILL TRANSACTION` requests `KILL_TRANSACTION`, which was not in `not_readonly_flags` (`KILL_QUERY` is), so a read-only session could roll back another user's transaction. - `INSERT INTO FUNCTION` never requests `INSERT`; its only gated flag is `CREATE_TEMPORARY_TABLE` (forced for inserts by ClickHouse#44290), which `readonly = 2` allows on purpose for session temporary tables. So at `readonly = 2`, which is what HTTP GET runs with, `file()` wrote and overwrote files and `url()` sent the POST. The source `WRITE` flag is not added to the deny-list because it is also requested by `BACKUP` destinations (documented as not restricted by `readonly`), by `SELECT` from a `DatabaseS3` table and by `file()` reads with `rename_files_after_processing`, and a filtered `WRITE` grant does not reach the gate at all. Instead `InterpreterInsertQuery::getTable` refuses a table function insert under any `readonly`, with the gate's error text, before anything is resolved or written. Every table function insert (synchronous, asynchronous, parallel replicas) goes through it. The English documentation of these settings is updated, including two stale sentences (named collection management and `UNDROP TABLE` have been gated since ClickHouse#130952 and ClickHouse#131892). Related: ClickHouse#132330 Co-Authored-By: Claude Opus 5.5 <[email protected]>
CREATE NAMED COLLECTION,ALTER NAMED COLLECTIONandDROP NAMED COLLECTIONwere allowed withreadonly = 1,readonly = 2andallow_ddl = 0, unlike the DDL of tables, dictionaries, functions, workloads and resources. This adds the named collection DDL access types to the flags checked inContextAccess.This is one of the patches that chDB (https://github.com/chdb-io/chdb-core) carries on top of ClickHouse; upstreaming them brings chDB closer to building from ClickHouse master.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
CREATE NAMED COLLECTION,ALTER NAMED COLLECTIONandDROP NAMED COLLECTIONare now rejected in readonly mode and withallow_ddl = 0, like other DDL queries.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/130952]
Version info
26.11.1.2095-master(included in26.11and later)26.3.65.6