Skip to content

feat(client): support SOCKS4/4a/5/5h proxies - #518

Merged
cathleeny merged 1 commit into
mainfrom
cathleeny/ddf-socks-proxy-kernel
Dec 2, 2026
Merged

cathleeny merged 1 commit into
mainfrom
cathleeny/ddf-socks-proxy-kernel

Conversation

@cathleeny

@cathleeny cathleeny commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds SOCKS proxy support to the kernel's shared HTTP client, so SQL requests, CloudFetch downloads and OAuth use the same tunnel.

  • ProxyConfig.url, the Rust ADBC driver's adbc.databricks.proxy.url, and HTTPS_PROXY/ALL_PROXY accept socks4://, socks4a://, socks5:// and socks5h:// next to http(s)://. socks5/socks4 resolve the target host locally; socks5h/socks4a let the proxy resolve it.
  • An explicit URL with any other scheme, including bare socks://, fails with InvalidArgument. In environment variables, an unsupported scheme is ignored, so reqwest falls back to ALL_PROXY or connects directly.
  • SOCKS5 credentials use RFC 1929. When credentials are set, only username/password authentication is offered, and a rejected login fails at once without resending the credentials.
  • SOCKS4 ignores credentials: it has no password, and the user ID isn't sent yet, because hyper-util always sends an empty one.
  • An unreachable proxy or rejected credentials fail the request, with no direct fallback. TLS is verified against the target host through the tunnel.
  • Proxy credentials are redacted from proxy URLs in errors, logs and Debug output.

ProxyConfig fields, defaults and the C ABI are unchanged.

Dependencies

Validation

  • Tests on both TLS backends against a loopback SOCKS4/4a/5 fixture that records each handshake:
    • the scheme allow-list and the DNS mode per scheme;
    • RFC 1929 credentials;
    • dead proxies and refused CONNECTs failing closed;
    • bypass hosts, and environment proxies tested in a child process;
    • CloudFetch downloads through the tunnel, and TLS hostname verification through the tunnel;
    • redaction in errors and logs.
  • ADBC config tests cover the new schemes, and the C ABI smoke test covers SOCKS URLs.
  • cargo fmt and clippy -D warnings pass on both backends, as do the workspace, napi/, pyo3/ and adbc/ tests and cargo deny.
  • Live against staging DBSQL and Reyden warehouses through the fixture:
    • all four schemes, credentials, a dead proxy, NO_PROXY and bypass_hosts, and a 200,000-row CloudFetch query;
    • an HTTP CONNECT proxy still works;
    • SELECT 1 through socks5h was within 50 ms of direct.

This pull request and its description were written by Isaac.

@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-kernel branch from 316a75a to 150a6ed Compare November 30, 2026 23:02
@cathleeny
cathleeny marked this pull request as ready for review December 1, 2026 19:42
@cathleeny
cathleeny requested a review from a team as a code owner December 1, 2026 19:42
@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-kernel branch from 150a6ed to a10f22e Compare December 1, 2026 20:25

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Looks good, with 1 low concern. The scheme allow-list, userinfo redaction, the hyper-util minimum and the test fixtures are solid, and the tests cover DNS mode, fail-closed behaviour and environment-variable precedence.

Comment thread src/client/http.rs Resolved
@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-kernel branch from 21a191b to c7fc632 Compare December 2, 2026 01:40

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Looks good, with 1 low concern. The scheme allow-list, credential redaction and non-retryable SOCKS auth failures are consistent across the kernel, ADBC and C ABI, and well tested with the loopback fixture. The one gap is the napi binding docs, which still say only http/https proxies work.

Comment thread napi/NEXT_CHANGELOG.md Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

🔀 1 finding considered and dismissed by the judge
  • 🔵 Low src/client/http.rs:791 — When url is None and HTTPS_PROXY/ALL_PROXY uses an unsupported scheme such as bare socks://, the kernel skips the proxy and connects directly without lo
    Judge's evidence: Proxy::all(proxy_url).map_err(|e| {

@aakash-saravanan-db aakash-saravanan-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates. Two non-blocking nits below.


This review was generated with GitHub MCP.

Comment thread tests/c/session_smoke.c Resolved
Comment thread NEXT_CHANGELOG.md Resolved
Enable reqwest's `socks` feature and accept socks4://, socks4a://,
socks5:// and socks5h:// proxy URLs, explicit or from HTTPS_PROXY /
ALL_PROXY, next to http(s)://. socks5/socks4 resolve the target locally
and socks5h/socks4a at the proxy; SOCKS5 credentials use RFC 1929, and a
rejected SOCKS5 authentication is not retried.
An explicit bare socks:// or other scheme is rejected; in the
environment, unsupported schemes are ignored. Proxy userinfo is redacted
in errors, logs and Debug output. The Rust ADBC driver's
adbc.databricks.proxy.url accepts the same SOCKS schemes.

Bump hyper-util 0.1.20 -> 0.1.21 in the root, napi and pyo3 lockfiles,
and require it in Cargo.toml: 0.1.20 writes a malformed SOCKS4/4a
CONNECT request. This adds base64 0.23.1 to those lockfiles; every
lockfile, adbc's included, gains the kernel's direct hyper-util entry.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Nit

Looks good — no blocking issues found. The scheme allow-list, redaction (http.rs and config.rs Debug), the non-retryable SOCKS auth classification (exercised against real hyper-util via the fixture), and the env and child-process coverage all look correct and well tested.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.

Other findings

  • ⚪ Nit — The env-proxy test table has no case for an unsupported-scheme env var such as socks://. The docs promise that value is ignored, so the kernel falls back to ALL_PROXY or connects directly, and that is untested. Add child-process cases for an unsupported HTTPS_PROXY with a valid ALL_PROXY and with none. (Found by GPT-6.1 Sol · confirmed by the judge)

@aakash-saravanan-db aakash-saravanan-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes! The shared transport implementation and focused coverage look good. Approving with the documented SOCKS4/4a USERID limitation accepted for follow-up, as noted in the existing thread.


This review was generated with GitHub MCP.

This branch was successfully deployed

1 active deployment
azure-prod — c9669d5b Deployed Dec 2, 2026 by aakash-saravanan-db via followup #5048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants