Skip to content

Add test that Remote/RemoteSecure storage engines respect remote_url_allow_hosts - #111140

Merged
PedroTadim merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/remote-engine-allow-hosts-test
Jul 21, 2026
Merged

PedroTadim merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/remote-engine-allow-hosts-test

Conversation

@groeneai

@groeneai groeneai commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #106189

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

Follow-up to #106189 (Remote/RemoteSecure storage engines): add a regression test proving the engines honor remote_url_allow_hosts, requested in that PR.

The engines already enforce it: registerStorageRemote and the remote/remoteSecure table functions share parseRemoteFunctionArguments, whose ad-hoc-cluster branch calls getRemoteHostFilter().checkHostAndPort(...) for every parsed host. For the engines this runs during CREATE, so a disallowed host is rejected with UNACCEPTABLE_URL before the table is created. There was no test covering this, so this PR adds one.

test_allowed_url_from_config/test.py::test_storage_engine_remote reuses the existing node6 (restrictive remote_url_allow_hosts) and, for both Remote and RemoteSecure, asserts that a disallowed host, a glob expanding to a disallowed host, and a disallowed port are all rejected, while an allowed host creates the table. It is an integration test because remote_url_allow_hosts is a server-config setting and cannot be set per query.

Version info

  • Merged into: 26.7.1.1268 (included in 26.7 and later)

…allow_hosts

Follow-up to ClickHouse#106189. The Remote/RemoteSecure storage engines build a cluster
on the fly from user-supplied addresses via the same parseRemoteFunctionArguments
as the remote/remoteSecure table functions, which calls
RemoteHostFilter::checkHostAndPort for every parsed host. For the engines this
runs during CREATE, so a host outside <remote_url_allow_hosts> is rejected with
UNACCEPTABLE_URL before the table is created. This adds a regression test that
locks in that behavior for both Remote and RemoteSecure (disallowed bare host,
glob expanding to a disallowed host, disallowed port; allowed host succeeds).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Under a restrictive <remote_url_allow_hosts> (example01-01-1, example01-02-1, localhost:PORT), CREATE TABLE ... ENGINE = Remote('example01-03-1', system, one) fails on demand with Code 491, UNACCEPTABLE_URL. Not intermittent.
b Root cause explained? This is a verification request, not a bug. The engines and the remote/remoteSecure table functions share parseRemoteFunctionArguments; its ad-hoc-cluster branch calls getRemoteHostFilter().checkHostAndPort(host, port) per host. For the engines this runs at CREATE time, so a disallowed host is rejected before the table is created. Verdict: already enforced.
c Fix matches root cause? Yes. No source change is warranted (enforcement verified present); the deliverable is the missing regression test, mirroring the enforcement+test pattern of #108507.
d Test intent preserved / new tests added? New test added (test_storage_engine_remote). No existing test weakened or removed.
e Demonstrated both directions? Yes. Restrictive list -> disallowed host rejected (Code 491); no list (control) -> same host accepted (Distributed table created); allowed host -> succeeds.
f General, not a narrow patch? Yes. Covers both Remote and RemoteSecure; a single shared parser is the only enforcement site (no sibling code path unguarded). The config-cluster path intentionally skips the filter for both engines and table functions (admin-trusted) - consistent, not a gap.
g Generalizes across inputs? Yes. Bare host, glob expansion (example01-01-{1,3} - every expanded host is checked), and explicit disallowed port; RemoteSecure exercised (secure default port 9440).
h Backward compatible? Yes. Test-only, no behavior change. RemoteHostFilter permits all hosts when the allow-list is empty/absent, so default installs are unaffected.
i Invariants / contracts preserved? Yes. No source touched; the engine already upholds the same host-filter contract as the table functions via the shared parser.

Validated locally: test_storage_engine_remote passed via the integration runner (1 passed in 93.70s, Integration tests amd_tsan 1/6, Failures 0/1). Server build id matched the built binary; ruff clean, black-stable.

Session id: cron:clickhouse-author-slot-2:20260720-194300

@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review — adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 substantive finding;
bounded: 1 full pass + 1 fix round + 1 delta recheck).

# Sev Finding Verdict Evidence / action
1 💡 Introductory comment on test_storage_engine_remote is verbose and restates what the assertions already show AGREE — fixed @ 8c9dbc6 Trimmed the 5-line comment to 2 lines stating only the contract (engines must enforce remote_url_allow_hosts, check runs at CREATE time).
2 ⚠️ Delta recheck claimed "the diff does not add the regression test, only shortens a comment" DISAGREE Delta-scope artifact: the recheck was intentionally scoped to only the comment-trim commit, so it saw 2 ins / 5 del. The full test IS present at HEAD (def test_storage_engine_remote, all query_and_get_error assertions + Distributed check + DROP), and the full-diff review pass reviewed the complete +36-line test. Test passed locally: 1 passed in 93.70s.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

Session id: cron:clickhouse-author-slot-2:20260720-194300

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov — could you review? Follow-up to #106189 adding an integration test that the Remote/RemoteSecure engines reject a host outside remote_url_allow_hosts at CREATE (they already do, via the shared parseRemoteFunctionArguments); requested by @ PedroTadim on that PR.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jul 20, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8c9dbc6]

Summary: ✅


AI Review

Summary

This PR adds an integration regression test for the Remote and RemoteSecure storage engines under remote_url_allow_hosts. I did not find a correctness or coverage issue in the current diff: the new test exercises the shared parseRemoteFunctionArguments host-filter path for a disallowed host, an expansion that includes a disallowed host, a disallowed explicit port, and an allowed host that successfully creates the table.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 20, 2026
@PedroTadim PedroTadim self-assigned this Jul 21, 2026
@PedroTadim
PedroTadim added this pull request to the merge queue Jul 21, 2026
Merged via the queue into ClickHouse:master with commit 4ebce80 Jul 21, 2026
178 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 21, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…gine-allow-hosts-test

Add test that Remote/RemoteSecure storage engines respect remote_url_allow_hosts
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 pr-ci 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.

4 participants