Repository navigation
Do not check Azure disks from the server config against remote_url_allow_hosts - #124721
Conversation
Since ClickHouse#110290 every request of `PocoAzureHTTPClient` is checked against `remote_url_allow_hosts`, including the requests of Azure disks, so a server whose Azure disk endpoint is not in the list fails to start (ClickHouse#124431). S3 disks are not checked; only their redirects are. Skip the request-host check for disk clients; redirects are still checked. Let data lake tables on an Azure disk skip the URL check, as S3 disks do. Keep the disk flag on the client returned by `CreateBlobContainer`, which the SDK builds without `ClickhouseOptions`: otherwise the node that created the container rebuilds its disk client as a non-disk one on the next config reload, or on the first query of a data lake table on that disk. A disk created by `disk(...)` in a query still has its endpoint checked, once when it is created (not when it is loaded from existing metadata), so the exemption does not reach hosts a query could not. Closes ClickHouse#124431 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the cross-file S3 parity note from the disk exemption comment in PocoHTTPClient.cpp. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (2 rounds): 1 blocker fixed, 0 dismissed
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261008-183000 |
|
Workflow [PR], commit [ba11ece] Summary: ✅
AI ReviewSummaryReviewed #124721 at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; required CI must still succeed before merging. |
A disk created by `disk(...)` in a query is checked against `remote_url_allow_hosts` once, when it is created, and its requests are not checked. For a OneLake endpoint (`*.blob.fabric.microsoft.com`) the writes and deletes go to another host: the `.dfs` one, or for a connection string its `DfsEndpoint` (or `<AccountName>.dfs.<EndpointSuffix>`). That host was not checked, so a query could write to a host outside the allowlist through an allowed `.blob` host. Check the URL that `makeAdlsGen2FileClient` uses as well. `DataLakeFileClient::GetUrl` returns the URL of the inner blob client, so the URL is computed with the same branches as `makeAdlsGen2FileClient` instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 552c50dEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
All 149 check runs completed. Session id: cron:our-pr-ci-monitor:20261009-060006 |
|
This PR makes some changes that someone with more knowledge should review |
|
Thanks. I requested reviews from @ alesapin, who wrote the Poco transport for Azure and its |
After the master merge, a query-created Azure disk is checked against `remote_url_allow_hosts` through `run_remote_host_filter_check`, the flag S3 disks use since ClickHouse#124453, so the check also runs when the table is loaded from metadata. Before, it was keyed on `run_local_paths_check`, which is false on FORCE_ATTACH: after a restart, a table whose disk host had been removed from the allowlist loaded and wrote to that host. The checked URL now keeps only the scheme, host and port. The connection URL of a SAS connection string carries the token in its query, and ClickHouse#124453 removed the `While processing disk(...)` suffix that used to quote it anyway, so without this the error and the server log would be the only place still showing `sig=`. The message now matches the one the request-time check in `PocoAzureHTTPClient` uses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The table is created while its endpoint host is allowed; after a restart with the host removed from `remote_url_allow_hosts`, the table must fail to load. The node gets `stay_alive` so that it can be restarted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units29 translation units recompiled, 255 s compile time in total, 29 of them have a recent master baseline. |
CI finish ledger - b0e24adEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Both Session id: cron:our-pr-ci-monitor:20261009-140011 |
|
Fixing PR for |
|
@arsenmuk maybe you can help review this? |
|
cc @zlareb1 should you review it or me? |
…rl-allow-hosts Resolve the conflict with ClickHouse#124930, which replaced the `bool` remote host filter flag with `RemoteHostFilterCheck`. Query-created Azure disks now follow the same policy as S3 disks: a rejection throws for `Enforce` (a query) and is only reported for `Warn` (existing metadata at server start or `UNDROP`), through the same log line and `system.warnings` entry, generalized to name an `<s3_bucket>` or `<host>` entry. `test_endpoint_host_filter_on_restart` now expects the table to load with the warning after a restart, and a new disk on the same host to be rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rl-allow-hosts Resolve two conflicts, keeping both sides: - `ObjectStorageFactory.cpp`: the endpoint host check of a `disk(...)` Azure disk runs first, then master's `checkOrDropServerManagedCredentials` handling; both includes are kept. - `test_allowed_url_from_config/test.py`: `test_azure_disk_onelake_write_host` and master's `test_object_storage_queue_move_destination_host_filter` are both kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵️ @groeneai I merged master and resolved the conflicts in One point in the description doesn't match the code. It says
That follows from This matches what S3 disks do since #124453, so it may well be intended. Could you correct that line and say explicitly, in the description and the changelog entry, that existing |
|
Thanks, corrected. The Tests sentence now says that after the restart the table loads with a warning and still returns its rows. The changelog entry and the fourth bullet of the description now say explicitly that an existing |
When a `disk(...)` has both `endpoint` and `connection_string`, `processEndpoint`
takes the URL from `endpoint`, while `getAuthMethod` picks the connection string,
and the container and service clients are created from it. `getConnectionURL()`
parsed `endpoint.storage_account_url`, so the creation-time
`remote_url_allow_hosts` check validated a host the clients never contact, and
disk requests are not checked again:
disk(type = azure_blob_storage,
endpoint = 'BlobEndpoint=http://host:80/account/container',
connection_string = 'BlobEndpoint=http://127.0.0.1:1')
With only `host:80` allowed, the previous head sent the container probe and
blob uploads to 127.0.0.1; master rejects them with UNACCEPTABLE_URL at the
request-time check. Both URL getters now parse the connection string of
`auth_method`, so the check, the clients and Delta Kernel (`azure_endpoint`)
use the same host. The default-constructed, empty connection string of the SAS
and catalog paths keeps using `storage_account_url`; everywhere else the two
strings are equal, so only such mixed disks change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed-object
Conflicts in WriteBufferFromAzureDataLakeStorage.{cpp,h}: master added
`getAdlsGen2Url` (ClickHouse#124721) right where this branch added
`makeAdlsGen2FileSystemClient` and `makeAdlsGen2StagingPath`; both kept.
Master armed an `HTTPConnectionInfoScope` around every request that writes a `system.blob_storage_log` row (ClickHouse#116361), including this writer's `runWithRetries`. This branch sends the guarded flush and the publishing rename through `runOnceRetryingForbidden` instead, which had no scope, so after the merge those two rows always reported no connection. Arm it there too, on the same `blob_log != nullptr` condition. The cleanup delete writes no row, as on master, so it needs none. The new test records, in the fake transport, whether each request went out inside an armed scope: with a blob log the Flush and the Rename were uncaptured before this change (Create and Append were), and with `scope(true)` the no-blob-log arm fails instead. `getAdlsGen2Url` (ClickHouse#124721) is what a query-created disk's host is checked against; its comment now names `makeAdlsGen2FileSystemClient` too, since the writer's requests come from that builder here. Checked with a throwaway probe: for token, SAS and connection-string auth (including a `DfsEndpoint` on another host) every Create, Append, Flush and Rename goes to the host `getAdlsGen2Url` returns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Antalya 26.8 Backport of ClickHouse#124721 - Do not check Azure disks from the server config against remote_url_allow_hosts
Stable 26.8 Backport of ClickHouse#124721 - Do not check Azure disks from the server config against remote_url_allow_hosts
…url-allow-hosts Do not check Azure disks from the server config against remote_url_allow_hosts Conflicts committed as-is; the next commit resolves them: - src/Disks/DiskObjectStorage/ObjectStorages/ObjectStorageFactory.cpp (both modified) - tests/integration/test_merge_tree_azure_blob_storage/test.py (both modified)
Kept the PR's Azure host check and test, and dropped the parts that depend on code antalya-26.8 doesn't have.
Closes: #124431
Related: #110290
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix server startup failure when an Azure Blob Storage disk from the server configuration has an endpoint that is not listed in
remote_url_allow_hosts(since 26.7). Such disks are no longer checked against this list, like S3 disks, also when a data lake table uses one viaSETTINGS disk = .... Disks created bydisk(...)in a query, URLs of table functions and table engines, and redirects are still checked. An existing table on adisk(...)disk whose host is no longer allowed loads with a warning and keeps reading and writing to that host, as for S3 disks; a newdisk(...)with that host is rejected. Closes #124431.Description
On 26.8.18.2, a server whose
<storage_configuration>has an Azure disk and whose<remote_url_allow_hosts>does not list the disk's host exits at startup withCode: 491 ... (UNACCEPTABLE_URL); 26.6.8.7 starts with it.Since #110290,
PocoAzureHTTPClient::makeRequestInternalImplchecks the host of every request againstremote_url_allow_hosts, disk clients included, so the container probe at disk creation throws. The S3 transport checks only redirects (#114357).Changes:
DataLakeConfiguration::checkskips the URL check for a table on an Azure disk, as for S3 disks.CreateBlobContainerreturns a client withoutClickhouseOptions, so on the node that created the container a config reload (or a data lake query on that disk) rebuilt the disk client as a non-disk one. The disk flag is now set on it.disk(...)in a query has the hosts its clients use, including its connection-string endpoint (even withendpointset) and ADLS Gen2 (OneLake) write host, checked before any request; the error quotes no SAS token. When its table is loaded from existing metadata (server start,UNDROP), a host that is no longer allowed is only reported (log andsystem.warnings), as for S3 disks since Fix ATTACH for S3 disks created without 'remote_url_allow_hosts #124930, and the table keeps reading and writing to it, while master rejects those requests.Tests:
test_storage_iceberg_disksno longer allow-lists Azurite (master does not start; without the third change its cluster query fails);test_allowed_url_from_configchecks that adisk(...)Azure disk with a blocked endpoint, connection-string endpoint or OneLake write host is rejected before any request;test_merge_tree_azure_blob_storagethat, once the host is no longer allowed, its table loads after a restart with a warning and returns its rows, while a new disk on that host is rejected.Workflow [PR]
Sync PR [sync-upstream/pr/124721]
Version info
26.11.1.1439-master(included in26.11and later)