Skip to content

Do not check Azure disks from the server config against remote_url_allow_hosts - #124721

Merged
PedroTadim merged 9 commits into
ClickHouse:masterfrom
groeneai:azure-disk-remote-url-allow-hosts
Nov 5, 2026
Merged

PedroTadim merged 9 commits into
ClickHouse:masterfrom
groeneai:azure-disk-remote-url-allow-hosts

Conversation

@groeneai

@groeneai groeneai commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Closes: #124431
Related: #110290

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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 via SETTINGS disk = .... Disks created by disk(...) in a query, URLs of table functions and table engines, and redirects are still checked. An existing table on a disk(...) disk whose host is no longer allowed loads with a warning and keeps reading and writing to that host, as for S3 disks; a new disk(...) 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 with Code: 491 ... (UNACCEPTABLE_URL); 26.6.8.7 starts with it.

Since #110290, PocoAzureHTTPClient::makeRequestInternalImpl checks the host of every request against remote_url_allow_hosts, disk clients included, so the container probe at disk creation throws. The S3 transport checks only redirects (#114357).

Changes:

  • Skip the request-host check for disk clients; redirects are still checked, as for S3.
  • DataLakeConfiguration::check skips the URL check for a table on an Azure disk, as for S3 disks.
  • CreateBlobContainer returns a client without ClickhouseOptions, 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.
  • A disk created by disk(...) in a query has the hosts its clients use, including its connection-string endpoint (even with endpoint set) 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 and system.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_disks no longer allow-lists Azurite (master does not start; without the third change its cluster query fails); test_allowed_url_from_config checks that a disk(...) Azure disk with a blocked endpoint, connection-string endpoint or OneLake write host is rejected before any request; test_merge_tree_azure_blob_storage that, 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

  • Merged into: 26.11.1.1439-master (included in 26.11 and later)

groeneai and others added 2 commits October 8, 2026 18:52
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]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Oct 8, 2026
@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (2 rounds): 1 blocker fixed, 0 dismissed
Finding Verdict
❌ The disk exemption also covered disks created by disk(...) in a query, so a CREATE TABLE could reach hosts outside remote_url_allow_hosts AGREE, fixed: such a disk's endpoint is checked once when it is created, before any request. Round 2 re-review: no findings
💡 Changelog wording about query URLs was imprecise AGREE, fixed in the PR body
💡 A merge-tree test exercised only the unchanged config-time check AGREE, removed
💡 For a disk(...) on a OneLake (*.blob.fabric.microsoft.com) endpoint, writes go to the derived .dfs host, which is checked only at creation via the .blob endpoint, not per request AGREE, not blocking: the .dfs host is the allow-listed host with a fixed suffix; I can also check it at creation if wanted

@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. test_storage_iceberg_disks with remote_url_allow_hosts = blocked.invalid: on master none of the 3 nodes starts (Code: 491 ... (UNACCEPTABLE_URL) from getContainerClient <- DiskSelector::initialize). The official 26.8.18.2 image exits 235 with the same error.
b Root cause explained? Since #110290 every PocoAzureHTTPClient request is checked against remote_url_allow_hosts, disk clients included, so the container probe during disk creation throws. Siblings: DataLakeConfiguration::check exempted only S3 disks; the CreateBlobContainer client has no ClickhouseOptions, so a rebuild on the creating node yields a non-disk client.
c Fix matches root cause? Yes. The request-host check is skipped for disk clients only (redirects still checked), the disk flag is set where it was lost, and a query-created disk is checked once where the factory tells it apart (custom_disk && !attach).
d Test intent preserved / new tests added? The iceberg disks module no longer allow-lists Azurite; test_allowed_url_from_config gains a disk(...) case rejected with UNACCEPTABLE_URL before any container request.
e Both directions demonstrated? Master: iceberg servers do not start; the new disk(...) case fails. Without the query-disk check: the new case fails (Connection refused). Without the CreateBlobContainer change: 491 on the creating node. Without the data lake change: all Azure iceberg cases fail with 491. Fix: iceberg 17 passed / 2 skipped, test_allowed_url_from_config 20 passed, each twice.
f Fix is general across code paths? Covers the request check, the data lake disk path, the created-container client and query-created disks (one factory creator for all four Azure disk types). Table functions, engines, OneLake, queues and BACKUP/RESTORE URLs stay checked.
g Fix generalizes across inputs (params/datatypes/wrappers)? Config disks, cache-wrapped disks and disks added on reload share the factory; disk(...) disks are checked at creation, not on re-attach from metadata. No data-type logic.
h Backward compatible? (maintainer-approved exception only) Yes. Restores the 26.6 behaviour for config disks; disk(...) disks keep the 26.7 rejection. No setting, default or format change.
i Invariants and contracts preserved? A disk client stays a disk client on every node across rebuilds; non-disk callers get the default ClickhouseClientOptions. The redirect check is unchanged.

Session id: cron:clickhouse-impl-slot-6:20261008-183000

@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ba11ece]

Summary: ✅


AI Review

Summary

Reviewed #124721 at ba11ece4618b6f74ead8b53469fa58fd12b51a12, including all prior discussion and the current diff and surrounding code. The change restores startup and data lake access for server-configured Azure disks while checking query-created disks before client creation. Both earlier findings are addressed; the remaining open bot-authored thread was resolved. No new actionable findings.

Missing context / blind spots
  • ⚠️ Integration tests and bugfix validation are still pending for the reviewed head in the Praktika report. No local build or tests were run. Successful runs covering test_allowed_url_from_config, test_merge_tree_azure_blob_storage, and test_storage_iceberg_disks would complete runtime validation.
Final Verdict

Status: ✅ Approve. No code changes requested; required CI must still succeed before merging.

@clickhouse-gh clickhouse-gh Bot added the comp-azure Azure Blob Storage integration (credentials, multipart, Azure-specific IO). label Oct 8, 2026
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]>
@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 552c50d

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_asan_ubsan, azure, sequential) job timeout, no test failed: the 9000 s job budget expired at test 1170 of 1175 (WARNING: Job timed out ... timeout [9000]). True master is killed the same way at tests 1161 to 1175 (fa4879c6dd0d, 6c5bfc7769e5, 6a1d7a26756b, 14 master runs in 5 days) #123849 (mine, open)
PR praktika rollup of the row above, no independent failure #123849 (mine, open)
CH Inc sync - CH Inc sync (private, not actionable by me)

All 149 check runs completed. Mergeable Check passed, and both Bugfix validation (integration tests, *) jobs passed (the new cases fail on master and pass with this PR).

Session id: cron:our-pr-ci-monitor:20261009-060006

@PedroTadim

Copy link
Copy Markdown
Member

This PR makes some changes that someone with more knowledge should review

@groeneai
groeneai requested review from alesapin and scanhex12 October 9, 2026 08:12
@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks. I requested reviews from @ alesapin, who wrote the Poco transport for Azure and its for_disk_azure flag (this PR exempts disk clients from the per-request host check there), and @ scanhex12, whose #124453 merged today adds the same creation-time remote_url_allow_hosts check for S3 disks created in SQL. This PR now conflicts with #124453 in that ObjectStorageFactory code; I will resolve it before they look.

groeneai and others added 3 commits October 9, 2026 08:23
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]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing ba11ece46 with master 427747d68 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 96dc5c984; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

29 translation units recompiled, 255 s compile time in total, 29 of them have a recent master baseline.

Job report

@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - b0e24ad

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 05316_secret_arguments_declared_by_engines test regression from merged #123364, not from this PR: under DatabaseReplicated the final query_log count returns 0 2 instead of 0 1 (the password stays hidden; the CREATE DICTIONARY row is counted twice). 22/22 reruns pass; the same diff is on 33 PRs in this lane today a fix task is created (investigating at full effort, fixing-PR link to follow here)
Mergeable Check, PR praktika rollup of the row above, no independent failure a fix task is created (the row above)

Both Bugfix validation (integration tests, *) jobs passed on this head.

Session id: cron:our-pr-ci-monitor:20261009-140011

@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

Fixing PR for 05316_secret_arguments_declared_by_engines (DatabaseReplicated 0 1 -> 0 2) from the CI finish ledger above: #124928 (external, open).

@PedroTadim

Copy link
Copy Markdown
Member

@arsenmuk maybe you can help review this?

@PedroTadim

Copy link
Copy Markdown
Member

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]>
@PedroTadim PedroTadim self-assigned this Nov 4, 2026
…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]>
@PedroTadim

Copy link
Copy Markdown
Member

🕵️ @groeneai I merged master and resolved the conflicts in ObjectStorageFactory.cpp and test_allowed_url_from_config/test.py, keeping both sides.

One point in the description doesn't match the code. It says test_merge_tree_azure_blob_storage checks that a disk(...) table "fails to load after a restart once the host is not allowed". The test checks the opposite:

  • After the restart, the table loads with a warning.
  • SELECT count() still returns 10.
  • Only a new CREATE is rejected.

That follows from RemoteHostFilterCheck::Warn plus the disk exemption in PocoAzureHTTPClient. A disk(...) table that already exists keeps reading from and writing to a host that remote_url_allow_hosts no longer allows. On master, the per-request check from #110290 blocks those requests.

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 disk(...) tables keep working against a host that is no longer allowed? Reviewers of the remote_url_allow_hosts change should see that.

@groeneai

groeneai commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

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 disk(...) table keeps reading and writing to a host that is no longer allowed, while a new disk(...) with that host is rejected. For S3 the load-time warning comes from #124930 (#124453 added the creation-time check), so the description cites #124930.

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]>
@PedroTadim
PedroTadim added this pull request to the merge queue Nov 5, 2026
Merged via the queue into ClickHouse:master with commit fee38d3 Nov 5, 2026
185 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 5, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 6, 2026
…ed-object

Conflicts in WriteBufferFromAzureDataLakeStorage.{cpp,h}: master added
`getAdlsGen2Url` (ClickHouse#124721) right where this branch added
`makeAdlsGen2FileSystemClient` and `makeAdlsGen2StagingPath`; both kept.
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 6, 2026
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]>
zvonand added a commit to Altinity/ClickHouse that referenced this pull request Nov 20, 2026
Antalya 26.8 Backport of ClickHouse#124721 - Do not check Azure disks from the server config against remote_url_allow_hosts
zvonand added a commit to Altinity/ClickHouse that referenced this pull request Nov 20, 2026
Stable 26.8 Backport of ClickHouse#124721 - Do not check Azure disks from the server config against remote_url_allow_hosts
VighneshPath pushed a commit to VighneshPath/ClickHouse that referenced this pull request Nov 23, 2026
…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)
VighneshPath pushed a commit to VighneshPath/ClickHouse that referenced this pull request Nov 23, 2026
Kept the PR's Azure host check and test, and dropped the parts that depend on code antalya-26.8 doesn't have.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-azure Azure Blob Storage integration (credentials, multipart, Azure-specific IO). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure disks defined in server config are now checked against remote_url_allow_hosts (server fails to start)

3 participants