Repository navigation
Conversation
With use_kernel=True and _proxy_auth_method="negotiate", resolve the system proxy the same way as the Thrift path (getproxies + proxy_bypass) and pass the kernel the proxy URL, the NO_PROXY list and a callable that creates a fresh Kerberos token for HTTP@<proxy host> with requests-kerberos. The kernel calls it at session open and once more on a proxy 407, and fails closed if it raises. A bypassed host, no proxy, unset and basic keep today's kernel behavior. The Reyden auto-recovery path carries the setting onto the kernel. pyspnego's DEBUG records that print raw tokens are filtered out. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
There was a problem hiding this comment.
🔀 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 Negotiate wiring fails closed as described: errors go through wrap_kernel_exception to OperationalError, and NotSupportedError passes through unchanged. The tests cover routing, stripping user:password from the proxy URL, and filtering tokens out of logs.
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
- 🟠 High — Filtering only
spnego.*leaves the token exposed at DEBUG because requests-kerberos 0.15 also logs the completeNegotiateheader fromgenerate_request_header()underrequests_kerberos.kerberos_. Filter that token-bearing record too, and add a regression covering the requests-kerberos logger rather than only the mocked pyspnego output. (Found by GPT-6.1 Sol · the judge couldn't confirm it)
With _proxy_auth_method="negotiate" on use_kernel=True, the macOS and Windows system bypass lists apply only to the workspace host; for other hosts, such as CloudFetch storage, the kernel honors only NO_PROXY. Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
|
On the High finding in the review above ("requests-kerberos 0.15 also logs the complete In requests-kerberos 0.15.0, |
Brings in credentials_provider on kernel connections and the SOCKS docs. The only conflict was tests/unit/test_kernel_client.py, where both sides added tests at the same place; both are kept. KERNEL_REV follows main. Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 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: 1 low formatting issue. The negotiate wiring matches Thrift's proxy discovery, fails closed on older wheels and leaves unset/basic unchanged. I could not check the claimed OperationalError mapping for a failing callback, because that depends on kernel #526.
Other findings
- ⚪ Nit —
_HOST = ...comes right after the closing)of the previous test, with no blank lines. That breaks PEP 8 and would failblack --check. Add two blank lines before_HOST. (Found by Claude Opus 5.5 · confirmed by the judge)
Summary
With
use_kernel=True,_proxy_auth_method="negotiate"now works. Before, the kernel path ignored it, and connections through a Kerberos proxy failed with a 407 after about 17 seconds. The Thrift path already supported it and is unchanged.This is proxy authentication (Kerberos on the proxy's
CONNECT), not warehouse Kerberos. It needs the kernel change in databricks/databricks-sql-kernel#526.What changes
HTTPS_PROXY,NO_PROXY). The connector passes the proxy and a token callback to the kernel. Tokens forHTTP@<proxy host>are made withrequests-kerberos, as on Thrift.requests-kerberosinstalled,connect()raisesOperationalErrorwith the reason before sending anything. It never falls back to Basic, a direct connection or another proxy.basic, no proxy, and hosts inNO_PROXYbehave as today.NotSupportedErrorinstead of silently ignoring the option.requests-kerberosstays optional and is imported only whennegotiateis used. Raw tokens that pyspnego logs at DEBUG are filtered out.Known limit: a proxy with a Kerberos replay cache rejects the first token on each new connection after the first, so each one costs one extra round trip (see #526).
Testing
Live, through a test Kerberos KDC and a squid proxy with the replay cache on, using a kernel wheel built from #526:
negotiate: 6 sequential sessions, then 2 × 4 concurrent queriesbasicunchanged; aNO_PROXYhost sends nothing to the proxyrequests-kerberosmissingnegotiatefails with a clear error¹ One run missed by 28 ms and the next passed. The Thrift baseline itself couldn't be timed here: squid's replay cache rejects the token Thrift reuses, and urllib3 keeps retrying. So the check used the stricter of its two limits.
Also run: the unit suite (1,474 passed), the real-kernel tests,
blackandmypy.Not run yet: Windows and macOS.
Merge order
KERNEL_REV; that comes in a follow-up pin bump. Until then,negotiateon the published kernel wheel raisesNotSupportedError.CONNECTION_PARAMETERS.md, and feat(kernel): expose HTTP/2 opt-out #1070 (HTTP/2 opt-out) adds kernelSessionkwargs. Whichever lands second rebases.This pull request and its description were written by Isaac.