Skip to content

feat(kernel): route the proxy option through SOCKS on the kernel backend - #653

Merged
cathleeny merged 1 commit into
mainfrom
cathleeny/ddf-socks-proxy-nodejs
Dec 3, 2026
Merged

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

Conversation

@cathleeny

@cathleeny cathleeny commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On Thrift, the proxy connection option already supports socks, socks4, socks4a, socks5 and socks5h. This PR makes the same option work on the kernel backend (useKernel: true), using the kernel's SOCKS support (databricks/databricks-sql-kernel#518).

  • protocol: 'socks' maps to socks5h, so the proxy resolves DNS as with socks-proxy-agent on Thrift. Other protocols pass through unchanged, and auth stays as separate username/password fields.
  • Known gap: the kernel doesn't send a SOCKS4/4a user ID yet, while Thrift sends proxy.auth.username. A SOCKS4 proxy that checks the user ID refuses kernel connections, so CONNECTION_PARAMETERS.md marks kernel proxy support as partial.
  • Without a proxy option, the kernel honors HTTPS_PROXY, ALL_PROXY and NO_PROXY, including SOCKS URLs, while Thrift ignores them. This is documented in CONNECTION_PARAMETERS.md.

No option is added or renamed.

Dependencies

  • KERNEL_REV pins the merged kernel commit a29235c (feat(client): support SOCKS4/4a/5/5h proxies databricks-sql-kernel#518), so kernel-e2e builds a binding with SOCKS support.
  • Regenerating the binding from that commit changes only the ProxyInput doc comment in native/kernel/index.d.ts, which now lists the SOCKS schemes; native/kernel/index.js is unchanged.
  • The published @databricks/databricks-sql-kernel-* packages (1.5.0, which rejects SOCKS URLs) move to the next kernel release.

Validation

  • Unit tests: the table-driven buildKernelProxyOptions tests cover every protocol and credential forwarding. The full suite (1891 tests), lint, type-check and prettier pass.
  • Live against staging DBSQL and Reyden warehouses with a binding built from a29235c, through a loopback SOCKS fixture that records each handshake, with same-session Thrift rows:
    • SELECT 1 through each scheme, with the same DNS mode as Thrift.
    • RFC 1929 credentials accepted, or rejected after one attempt, and a dead proxy failing closed.
    • A 200,000-row CloudFetch query downloading through the proxy.
    • Env HTTPS_PROXY/ALL_PROXY/NO_PROXY, and an HTTP CONNECT proxy still working.
    • SELECT 1 through socks5h stayed within the agreed max(+25 %, +150 ms) of direct on both engines.

This pull request and its description were written by Isaac.

@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-nodejs branch from d080867 to 0c4d22b Compare December 1, 2026 19:41
@cathleeny
cathleeny marked this pull request as ready for review December 1, 2026 19:42
@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-nodejs branch from 0c4d22b to d20691d Compare December 1, 2026 20:26

@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 High

The mapping change looks correct, with 1 medium and 1 low docs concern. The socks→socks5h mapping and its table-driven tests are good. But the native package pins (1.5.0) do not include the SOCKS kernel change yet, so the changelog and docs claim support that does not ship.

Comment thread lib/kernel/KernelAuth.ts Resolved

@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 PR! The socks to socks5h mapping preserves Thrift's DNS behavior with a small adapter change, and keeping credentials in separate fields avoids URL-encoding problems. The option-conversion tests are focused and readable.

The inline comment is about the full-support claim while the shared kernel still drops SOCKS4 user IDs. The adapter mapping itself looks correct; the transport correction belongs in the kernel. The compatible native-package release remains a separate prerequisite, as already planned.

Please also shorten the PR description to the public behavior, dependencies, and relevant validation, removing internal tracking details and prior-review history.


This review was generated with GitHub MCP.

Comment thread CONNECTION_PARAMETERS.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).

Verdict: 1 High · 1 Low

Looks good, with one low concern. The socks → socks5h mapping matches the default DNS mode of Thrift's socks-proxy-agent, and the table-driven tests cover every declared protocol plus credential and bypass forwarding.

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

Comment thread lib/kernel/KernelAuth.ts Resolved
Comment thread CHANGELOG.md Resolved
@cathleeny
cathleeny force-pushed the cathleeny/ddf-socks-proxy-nodejs branch 2 times, most recently from f53207b to 1813d9b Compare December 2, 2026 02:34

@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! The proxy mapping and focused option-conversion tests look good. LGTM.


This review was generated with GitHub MCP.

@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 High

Looks good: 1 medium concern. The protocol mapping and its tests are correct, and socks → socks5h matches Thrift's socks-proxy-agent DNS behavior. The only problem is that the shipped binding pins (1.5.0) don't support SOCKS yet.

Comment thread CHANGELOG.md Resolved
With a kernel build that supports SOCKS proxies, the existing `proxy`
connection option now works on the kernel backend (useKernel: true) for
socks4, socks4a, socks5 and socks5h, as it already does on Thrift.

buildKernelProxyOptions maps protocol 'socks' to 'socks5h', so the proxy
resolves DNS as socks-proxy-agent does on Thrift. The kernel rejects a bare
socks:// URL. Other protocols pass through verbatim, and credentials stay
separate fields. No option is added or renamed.

KERNEL_REV points at a29235c, the merged kernel SOCKS commit
(databricks/databricks-sql-kernel#518), so kernel-e2e builds the binding
that supports it; native/kernel/index.d.ts picks up that kernel's ProxyInput
doc update. The published 1.5.0 binding still rejects SOCKS URLs, so the
@databricks/databricks-sql-kernel-* package pins must move to the kernel
release that includes it. The kernel does not send a SOCKS4 user ID yet, so
CONNECTION_PARAMETERS.md marks kernel proxy support as partial.

Table-driven unit tests cover the protocol mapping and credential and
bypass forwarding. CONNECTION_PARAMETERS.md describes the kernel support,
including the kernel's HTTPS_PROXY/ALL_PROXY/NO_PROXY handling when no
proxy option is set (Thrift ignores those variables). CHANGELOG.md has a
short entry.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@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 High · 1 Nit

Needs changes: 1 high, 1 medium. The SOCKS mapping and its tests look right, but the shipped native pins and KERNEL_REV don't match the feature being announced.

Other findings

  • ⚪ Nit — KERNEL_REV is a29235cb…, but the PR description says it points at the kernel PR commit c9669d5. So the regenerated index.d.ts and the live validation may not match the pinned build. Fix whichever is wrong, the pin or the description, and regenerate native/kernel/index.d.ts from that exact commit. (Found by Claude Opus 5.5 · the judge couldn't confirm it)

Comment thread CHANGELOG.md Resolved
@cathleeny

Copy link
Copy Markdown
Collaborator Author

On the latest review's nit (description vs. KERNEL_REV): the description now matches. It says KERNEL_REV pins the merged kernel commit a29235c (databricks/databricks-sql-kernel#518, whose head was c9669d5), and native/kernel/index.d.ts and the live validation both use a binding built from a29235c.

@cathleeny
cathleeny added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 7d34172 Dec 3, 2026
31 of 35 checks passed
cathleeny added a commit that referenced this pull request Dec 3, 2026
Brings in the kernel SOCKS proxy routing (#653) and #651. KERNEL_REV now pins kernel 159a2ff0b69d, which carries both SOCKS and the External header-provider bridge, and native/kernel/index.d.ts matches a binding built from it. CONNECTION_PARAMETERS.md keeps both features' notes.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>

Co-authored-by: Isaac <no-reply@databricks.com>

This branch was previously deployed

1 inactive deployment
azure-prod — f6178cc6 Deployed Dec 3, 2026 by cathleeny via e2e-test (24.22.1, 24_22_1) #2287
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