Repository navigation
Enforce remote_url_allow_hosts for ArrowFlight engine and table function - #108507
SmitaRKulkarni merged 1 commit into
Conversation
ArrowFlightConnection::connect() opened a gRPC connection to the user-supplied host:port without consulting RemoteHostFilter, so the <remote_url_allow_hosts> allow-list was not enforced. An authenticated user with the ARROW_FLIGHT source grant could therefore reach arbitrary internal TCP/gRPC endpoints (SSRF, internal service access, port scanning). Add the host-and-port check at the single choke point, StorageArrowFlight::getConfiguration(), which both the storage factory and the table function route through, with host/port populated for the positional and the named-collection argument forms. This mirrors TableFunctionRemote, ClickHouseDictionarySource and StoragePostgreSQL. Backward compatible: the check only enforces the existing setting, and the default empty allow-list permits all hosts, so existing setups are unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-6:20260625-151100 |
|
cc @vitlibar @yakov-olkhovskiy — could you review this? |
|
Workflow [PR], commit [ce62b5f] Summary: ❌
AI ReviewSummaryThis PR enforces the existing Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 4/4 (100.00%) | Lost baseline coverage: none · Uncovered code |
CI finish ledger - ce62b5fCI fully finished on this head (Finish Workflow pass, Mergeable Check pass). Every red has an owner; none is caused by this PR's diff (it adds one RemoteHostFilter check in Note: "Bugfix validation (integration tests)" reports 8/9 sub-test FAILs but the JOB itself is pass - that check deliberately runs the PR's tests on the no-fix base; the PR's new security case
Session id: cron:our-pr-ci-monitor:20260625-200000 |
CI finish ledger - ce62b5f (owner correction)Correcting the Not-ready Set owner line: the owner is the external open fixing PR (no separate pending fix task is needed since a fixing PR exists).
Session id: cron:our-pr-ci-monitor:20260625-200000 |
9f49403
|
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment. TL;DREnforce remote_url_allow_hosts for ArrowFlight engine and table function ClickGap verified: reproduced it with the script below on ReproductionConfigure a server whose allow-list does NOT include the target host, e.g.:
<remote_url_allow_hosts><host>allowed.example.com:443</host></remote_url_allow_hosts>
Then run (table function, engine, and named-collection forms all affected):
SELECT * FROM arrowFlight('127.0.0.1:9', 'ds');
CREATE TABLE t (x Int32) ENGINE = ArrowFlight('127.0.0.1:9', 'ds');
Observed pre-fix: the disallowed host is NOT rejected; ClickHouse opens the connection and fails with Code: 752 ARROWFLIGHT_FETCH_SCHEMA_ERROR ('Failed to connect ... Connection refused'). Fixed behavior: rejected with UNACCEPTABLE_URL (Code: 491) before any connection is opened.Bisect
Affects
Suggested next stepThe fix has landed on master; the affected release branches above still need the backport. Component: cc fix PR author: @groeneai ClickGap · Finding: Triage metadata
|
…ght engine and table function
Backport #108507 to 26.6: Enforce remote_url_allow_hosts for ArrowFlight engine and table function
Backport #108507 to 26.3: Enforce remote_url_allow_hosts for ArrowFlight engine and table function
…r ArrowFlight engine and table function
…ht-remote-host-filter Enforce remote_url_allow_hosts for ArrowFlight engine and table function
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
ArrowFlighttable engine and thearrowFlighttable function now honor the<remote_url_allow_hosts>allow-list. Previously the connection host and port were not validated, so a query could reach hosts not present in the allow-list.Description
ArrowFlightConnection::connect()opened a gRPC connection to the user-suppliedhost:portwithout consultingRemoteHostFilter, so<remote_url_allow_hosts>was never enforced for ArrowFlight. An authenticated user with theARROW_FLIGHTsource grant could reach arbitrary internal TCP/gRPC endpoints (SSRF, internal service access, port scanning).The fix adds a single host-and-port check at
StorageArrowFlight::getConfiguration(), the choke point both the storage factory (registerStorageArrowFlight) and the table function (TableFunctionArrowFlight::parseArguments) route through.host/portare populated there for both the positionalArrowFlight('host:port', ...)form and the named-collection form, so both argument styles are covered. This mirrorsTableFunctionRemote,ClickHouseDictionarySourceandStoragePostgreSQL.Backward compatible: the check only enforces the existing setting; the default empty allow-list permits all hosts, so existing setups are unaffected.
Reproduction (with
<remote_url_allow_hosts>configured to not include the target):A new integration test (
test_arrowflight_storage::test_remote_host_filter) asserts that a disallowed host is rejected withUNACCEPTABLE_URLfor the table function, the storage engine, and the named-collection forms.Version info
26.7.1.1222(included in26.7and later)26.6.5.19,26.3.33.38