Repository navigation
Cherry pick #123133 to 26.8: Require permission to override named collections - #125390
Merged
robot-clickhouse-ci-1 merged 14 commits intoOct 15, 2026
Merged
Conversation
Check stored keys and aliases before applying query arguments, backup arguments, or `SETTINGS`. Allow adding missing keys and preserve explicit `NOT OVERRIDABLE` restrictions. Dictionary sources may only add missing keys because background loading does not retain the caller's access context. Make `allow_named_collection_override_by_default` obsolete. Update the documentation and affected tests, and add regression coverage for scoped grants, roles, revocation, aliases, headers, XML paths, and engine settings. Validated with a debug build, five functional tests, and three dictionary integration tests. Closes: ClickHouse/clickhouse-private#53768 Related: ClickHouse/clickhouse-private#53768 (comment)
…std::array` Add parameter-name comments to the bare `true` / `nullptr` arguments in the calls that pass `settings`, and declare the equivalent keys table with `std::to_array` instead of a C array. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…base` / `url_base` resolution ClickHouse appends the inferred `format` and `structure` to named collection arguments (for example in `addInferredEngineArgsToCreateQuery` and for `*Cluster` secondary queries) and parses them again. Replacing a stored `'auto'` value of these keys neither hides a stored value nor redirects credentials, so it no longer requires `SHOW NAMED COLLECTIONS SECRETS`. The `NOT OVERRIDABLE` lock still applies. Resolving a relative `url` stored in a named collection against the `s3_base` or `url_base` session setting replaces the stored `url`, and could send the stored credentials to another host. It now goes through the same check as an explicit `url` override, which also keeps the materialized `url` argument consistent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… locks at load Dictionary sources are loaded in the background with the global context, so the previous code rejected every override of a stored key there. This broke trusted config-defined dictionaries (`MongoDB` reads a named collection from the XML config) and DDL dictionaries created before the upgrade. Use the same model as table engines: the `SHOW NAMED COLLECTIONS SECRETS` privilege is checked with the user's context when the dictionary is created, attached or restored (in `registerStorageDictionary`), and loading the source only enforces `NOT OVERRIDABLE`. The lock check is now a separate function, so a null context no longer means "reject" implicitly. Restore the integration cases with dictionary overrides that were removed, and add a test for dictionary overrides and for tables whose override was locked after creation, which are rejected on `ATTACH`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`KafkaConfigLoader` sets librdkafka properties from nested named collection keys (`kafka.<property>`, `kafka.consumer.<property>`, `kafka.producer.<property>`) and then overwrites them with the non-empty flat settings such as `kafka_security_protocol` or `kafka_sasl_password`. The override check did not relate the two forms, so a flat setting in `SETTINGS` could replace a stored nested value without `SHOW NAMED COLLECTIONS SECRETS`, even when the nested key was `NOT OVERRIDABLE`. `areEquivalentKeys` now maps both forms to the librdkafka property for the flat settings that overwrite nested values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The `postgresql` table function applies its `SETTINGS` clause after the settings loaded from a named collection, but did not pass the clause to `StoragePostgreSQL::getConfiguration`. So a user without `SHOW NAMED COLLECTIONS SECRETS` could replace a stored setting such as `postgresql_connection_pool_size`, also when it was `NOT OVERRIDABLE`. Pass the clause, as the `PostgreSQL` table engine does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ride stored keys These tests intentionally override keys stored in a named collection, which now requires the `SHOW NAMED COLLECTIONS SECRETS` privilege: - `test_dictionaries_ddl::test_secure` overrides `secure` of `nc_secure_0`. - `test_s3_client_refresh` overrides `url` of `refresh_env`. - `test_storage_dict` overrides `format` of `urldict2`. - `test_storage_iceberg_schema_evolution`, `test_storage_iceberg_concurrent` and `test_storage_iceberg_with_spark_cache` use `iceberg_utils`, which overrides `url` of the `s3` collection. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123133&sha=52e14f769c75857c59b6c9e2ea76da124c516a57&name_0=PR PR: #123133 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dictionary sources can override stored keys with the `SHOW NAMED COLLECTIONS SECRETS` privilege, which is checked when the dictionary is created, attached, or restored. When the dictionary is loaded, only keys marked `NOT OVERRIDABLE` are enforced. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…::test_secure` `default` has `allow_databases`, which makes the users config parser revoke all non-global flags, including the `NAMED_COLLECTION`-level ones. So `show_named_collections_secrets` in its config had no effect and overriding the stored `secure` key of `nc_secure_0` was denied. Remove the ineffective settings from `default`, enable them for `admin` (which has no `allow_databases`), check that `default` is denied, and create the dictionary as `admin`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123133&sha=1d125f8813382e5ff74b6819cfe25295d6dbaa14&name_0=PR PR: #123133 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ide-permissions Require permission to override named collections
…icts Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #123133
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-picklocally.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:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job