Repository navigation
Conversation
The kernel backend rejected `authType: 'custom'`, `'token-provider'` and `'external-token'`, so applications that supply and refresh credentials through a provider could only use Thrift. These three modes now map to the kernel's `External` auth mode. KernelBackend passes the client's own `IAuthentication` (the chain `DBSQLClient` already builds for Thrift) as the napi `headerProvider`, and the kernel calls it for the headers of every request, retries included: - `custom` calls `provider.authenticate()` per request, as Thrift does per RPC. - `token-provider` and `external-token` keep `CachedTokenProvider`, plus `FederationProvider` when `enableTokenFederation` is set, so caching, `federationClientId` and the exchange fallback match Thrift. The kernel's own federation does not wrap `External`. - Provider headers reach the kernel with the values node-fetch sends on Thrift: every `HeadersInit` shape, array and non-string values stringified, repeated names combined. `undefined`/`null` values are skipped. - A provider rejection fails the operation as `AuthenticationError` with the provider's message. A missing provider fails `connect()`. `static-token`, PAT and OAuth mappings are unchanged. KERNEL_REV pins the kernel commit that adds `External`, and native/kernel/index.d.ts carries its `openSession(options, headerProvider)` typing. 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 High · 1 Low
Looks good, with one low concern. I traced the provider from DBSQLClient.createAuthProvider through getAuthProvider to the kernel headerProvider: caching, federation and the missing-provider error all behave correctly. As the PR says, merging still depends on published native packages that include the bridge.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
|
|
||
| ## Unreleased | ||
|
|
||
| - Kernel backend: `authType: 'custom'`, `'token-provider'` and `'external-token'` now work, so applications can supply and refresh credentials through their providers, including `enableTokenFederation`. Requires `@databricks/databricks-sql-kernel-*` native packages from a release that adds custom credentials providers. |
There was a problem hiding this comment.
🔵 Low — The changelog says a newer native release is needed but doesn't name the kernel change, unlike the neighbouring port entry, which cites databricks/databricks-sql-kernel#505. Add the kernel PR reference so the required package bump can be identified.
🔀 Found by Claude Opus 5.5 · confirmed by the judge
| )) as KernelConnection; | ||
| const nativeOpts = sessionOptions as unknown as Parameters<KernelNativeBinding['openSession']>[0]; | ||
| nativeConnection = (await (headerProvider | ||
| ? this.binding.openSession(nativeOpts, headerProvider) |
There was a problem hiding this comment.
🟠 High — The optionalDependency pins stay at 1.5.0, which reject authMode: 'External', so an npm install can't use the new modes until the packages are bumped. The changelog does flag this follow-up and the port entry did the same, so this is a release-ordering note, not a code bug. Bump the pins, lockfile and router once the kernel release is published.
🔀 Found by GPT-6.1 Sol · confirmed by the judge
Summary
authType: 'custom','token-provider'and'external-token'now work on the kernel backend; until now, it rejected these modes.KernelBackendpasses the client's ownIAuthentication, the same chainDBSQLClientbuilds for Thrift, to the kernel, and the kernel calls it for the headers of every request.What changes
Externalauth mode.static-token, PAT, M2M and U2M are unchanged.customcallsauthenticate()on every kernel request (Thrift does so on every RPC).token-providerandexternal-tokenkeepCachedTokenProvider, plusFederationProviderwithenableTokenFederation.federationClientId, the exchange and the fallback on refusal are unchanged.authenticate()are converted the way node-fetch does on Thrift. Arrays and numbers become strings, and repeated names are joined with,.KERNEL_REVpins the kernel commit that adds the bridge. The typings addAuthMode.ExternalandopenSession(options, headerProvider?).Differences from Thrift on the kernel path:
User-Agentis ignored.undefinedandnullheader values are skipped (Thrift sends the text).Known limit: a live successful token-federation exchange against a real federation policy was not tested, because the staging workspace has none. Exchange success is covered against a local mock
/oidc/v1/token.Testing
SELECT 1on the kernel)customprovidertoken-provider(getToken()once per connection)external-token+enableTokenFederation(exchange refused, falls back)Unit and lint: these all pass.
Not run: Windows, macOS, and CI jobs that need a push.
Merge order
@databricks/databricks-sql-kernel-*packages that include it.KERNEL_REVto the merged kernel commit before merging. The published 1.5.0 packages rejectauthMode: 'External'.This pull request and its description were written by Isaac.