Repository navigation
Dynamic disk restricting settings - #99138
Conversation
|
Workflow [PR], commit [df020e2] Summary: ✅ AI ReviewSummaryThis PR adds Findings❌ Blockers
Final VerdictStatus: Minimum required actions:
|
0fd1284 to
fc06e03
Compare
For the `privileged_user` cases in `test_dynamic_disk_security_settings`,
replace the `query_and_get_error` + `ACCESS_DENIED not in error` pattern
with plain `node.query()` so the test verifies that `CREATE TABLE` truly
succeeds (no exception at all) when the profile permits the substitution.
To make the queries work end-to-end:
- Add `include_from_path.xml` / `include_from.xml` to node5 (needed for
the `include` substitution test).
- Add `env_variables={"MINIO_SECRET": minio_secret_key}` to node5 (needed
for `from_env`).
- Add `with_zookeeper=True` to node5 and pre-populate
`/test_security_minio_secret` in ZooKeeper (needed for `from_zk`).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| DECLARE(Bool, allow_drop_detached, false, R"( | ||
| Allow ALTER TABLE ... DROP DETACHED PART[ITION] ... queries | ||
| )", 0) \ | ||
| DECLARE(Bool, dynamic_disk_allow_from_env, false, R"( |
There was a problem hiding this comment.
dynamic_disk_allow_from_env (and the related toggles) are declared as regular query settings (DECLARE(..., 0)), so a user with CREATE TABLE can typically bypass the intended restriction by enabling them in session/query (SET dynamic_disk_allow_from_env = 1) before CREATE TABLE ... disk(...). That makes this security gate ineffective unless every user profile has explicit immutable constraints. Please move these toggles to a server-level setting or enforce non-overridable profile constraints, and add a negative test for restricted_user that tries to override the setting in-session.
There was a problem hiding this comment.
I re-checked this on the current HEAD, and the bypass is still possible.
dynamic_disk_allow_* are still regular query settings (DECLARE(..., 0)), and there is still no source restriction for them in SettingsConstraints (the SETTINGS_SOURCE_RESTRICTIONS map still only contains max_sessions_for_user). So a user can still do:
SET dynamic_disk_allow_from_env = 1;
CREATE TABLE ... SETTINGS disk = disk(... 'from_env ...');and bypass the intended default-deny behavior.
Could you please make these settings profile-only / non-overridable from query/session (or move them to a server-level setting), then add a negative test that explicitly checks SET dynamic_disk_allow_from_env=1 fails for a restricted user?
There was a problem hiding this comment.
I re-checked this on current HEAD; this issue is still live.
dynamic_disk_allow_from_env, dynamic_disk_allow_include, and dynamic_disk_allow_from_zk are still regular query settings in src/Core/Settings.cpp, and SETTINGS_SOURCE_RESTRICTIONS in src/Access/SettingsConstraints.cpp still only contains max_sessions_for_user.
So a restricted user can still do:
SET dynamic_disk_allow_from_env = 1;
CREATE TABLE ... SETTINGS disk = disk(endpoint = 'from_env HOME', ...);which bypasses the intended default-deny security gate. Please add these three settings to SETTINGS_SOURCE_RESTRICTIONS with {SettingSource::PROFILE} (or move them to non-query settings) and add an explicit negative test that SET ... = 1 is rejected for a restricted user.
There was a problem hiding this comment.
dynamic_disk_allow_from_env, dynamic_disk_allow_include, and dynamic_disk_allow_from_zk are still bypassable from a query/session context.
At HEAD, SETTINGS_SOURCE_RESTRICTIONS still only restricts max_sessions_for_user (src/Access/SettingsConstraints.cpp), while the three dynamic-disk toggles remain regular query settings in src/Core/Settings.cpp. That means a restricted user can still run:
SET dynamic_disk_allow_from_env = 1;
CREATE TABLE ... SETTINGS disk = disk(endpoint = 'from_env HOME', ...);and bypass the default-deny protection.
Please add these three settings to SETTINGS_SOURCE_RESTRICTIONS with {SettingSource::PROFILE} (or make them non-query settings), and add a regression test that SET dynamic_disk_allow_from_env = 1 is rejected for a restricted user.
There was a problem hiding this comment.
I re-checked this on current HEAD; the bypass is still present.
dynamic_disk_allow_from_env, dynamic_disk_allow_include, and dynamic_disk_allow_from_zk are still regular query settings in src/Core/Settings.cpp, while SETTINGS_SOURCE_RESTRICTIONS in src/Access/SettingsConstraints.cpp still only restricts max_sessions_for_user.
So a restricted user can still do:
SET dynamic_disk_allow_from_env = 1;
CREATE TABLE ... SETTINGS disk = disk(endpoint = 'from_env HOME', ...);and bypass the intended profile-controlled default-deny behavior.
Please add these three settings to SETTINGS_SOURCE_RESTRICTIONS with {SettingSource::PROFILE} (or make them non-query settings), and add a regression check that SET dynamic_disk_allow_from_env = 1 is rejected for restricted_user.
…_metadata The parameter was renamed to is_server_startup_attach in d86eca8, but 37a246d then established that the correct name for the concept is isLoadingFromExistingMetadata (UNDROP TABLE also sets FORCE_ATTACH/ FORCE_RESTORE, not only server startup). Align the parameter names in all loadFromQuery overloads and in getDiskConfigurationFromASTImpl to match the helper. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
eccd8c0 to
4efc892
Compare
Cherry pick #99138 to 26.4: Dynamic disk restricting settings
Cherry pick #99138 to 26.3: Dynamic disk restricting settings
Backport #99138 to 26.3: Dynamic disk restricting settings
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add a setting
dynamic_disk_allow_from_env,dynamic_disk_allow_from_zk,dynamic_disk_allow_includeto disallow usage offrom_env,from_zk,includein dynamic disks. Backward Incompatible Change because prohibits by default the behaviour which used to be allowed by default.Documentation entry for user-facing changes
Note
Medium Risk
Adds new access controls around dynamic disk configuration (
from_env,from_zk,include) and changes MergeTree settings loading to use per-user query context; misconfiguration could block table creation or unexpectedly allow/deny storage configuration features.Overview
Introduces three new settings—
dynamic_disk_allow_from_env,dynamic_disk_allow_from_zk, anddynamic_disk_allow_include—to block dynamic disk config features by default and prevent reading env/ZooKeeper values or processing includes when definingdisk()in table settings.Enforces these checks in
getDiskConfigurationFromASTImpl, returningACCESS_DENIEDunless explicitly enabled, while skipping the checks during ATTACH/server restart (is_attach=true) to keep existing tables loadable.Updates MergeTree creation/attach to evaluate disk settings using the local (query) context so user settings profiles can control access, and adds stateless + integration tests covering default-deny and profile-enabled behavior.
Written by Cursor Bugbot for commit 3e4d90d. This will update automatically on new commits. Configure here.
Version info
26.5.1.605(included in26.5and later)26.3.17.69