Skip to content

feat(kernel): support custom credentials providers on the kernel backend - #656

Open
cathleeny wants to merge 5 commits into
mainfrom
cathleeny/ddf-custom-credential-provider-nodejs
Open

cathleeny wants to merge 5 commits into
mainfrom
cathleeny/ddf-custom-credential-provider-nodejs

Conversation

@cathleeny

@cathleeny cathleeny commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enable custom, token-provider and external-token authentication on the kernel backend, including token federation and the deprecated injected-provider argument. The kernel calls the same client provider used by Thrift for each request.

Kernel-managed headers, including User-Agent and SEA routing headers, cannot be overridden by the provider; null and undefined values are skipped. Invalid credentials return HTTP 403.

Testing

Live case (SELECT 1) DBSQL Reyden
Custom provider ✅ ✅
Token provider ✅ ✅
External token with federation fallback ✅ ✅
Invalid credentials rejected ✅ ✅
GitHub OIDC federation (AUTH-033) ✅ ✅

These live cases were run before the merged-kernel re-pin. Windows and macOS were not run locally.

Merge order

This PR pins merged kernel commit 6d6c1e4 (databricks/databricks-sql-kernel#527). Native packages move at the joint kernel and driver release.

This pull request and its description were written by Isaac.

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>
@cathleeny
cathleeny marked this pull request as ready for review December 3, 2026 00:51

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

Comment thread CHANGELOG.md Resolved
Comment thread lib/kernel/KernelBackend.ts Resolved
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>

@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

Looks good, with 1 low concern. The provider modes reuse the client's own IAuthentication, which is created before backend.connect, so caching and federation behave as they do on Thrift. Follow-up: nothing checks binding support before connect, so on the published 1.5.0 packages External fails with an opaque native error.

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 changelog entry doesn't name the kernel PR or say that the published 1.5.0 packages reject External. The neighbouring port entry cites its kernel PR. Add the kernel PR reference and the minimum package version. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread lib/kernel/KernelBackend.ts Resolved
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.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

Looks good apart from 1 medium concern: the PR ships source-only support while the native package pins are still 1.5.0. Auth wiring, header conversion and tests look correct. KernelBackend reuses the client's IAuthentication and fails fast at connect when there is no provider.

Comment thread CHANGELOG.md 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.

The three provider modes map cleanly onto the kernel's External auth and reuse the client's own IAuthentication, so caching and federation behave as they do on Thrift. One gap inline that I think should be fixed before merge, plus a small description note.

Description: nothing in this PR tests the "auto-recovery: now works for these modes" bullet. It follows from the fallback building a KernelBackend on the same client context. Either cite the test that covers it, or reword it to say why it works, e.g. "The auto-recovery fallback reuses the client's provider, so these modes also open on the kernel there."

Comment thread lib/kernel/KernelBackend.ts Resolved
Honor the deprecated injected provider for direct kernel connections and Reyden recovery, matching Thrift.

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

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. The description now explains that Reyden fallback reuses the client provider, and links the Node nightly AUTH-033 run and its temporary-branch / driver-test#2423 context. In e259152, the deprecated second-argument provider also takes precedence on direct kernel and Reyden fallback connections, with regression tests for both.

@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

Looks good, with 1 low concern. The precedence of the deprecated second-argument provider, the External mapping, the provider guard and the header conversion all trace correctly through both the direct kernel path and the Reyden fallback. The shipped 1.5.0 native pins still need a bump before this works for users; the PR's merge-order notes already track that.

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 changelog entry says a release "that adds custom credentials providers" is needed, but it doesn't cite the kernel change or a version. package.json pins 1.5.0, and the port entry cites databricks/databricks-sql-kernel#505. Cite the kernel PR and name the minimum package version. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread lib/kernel/KernelBackend.ts Resolved
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.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 Low

Looks good, with 1 medium concern. Routing, the deprecated-provider precedence, header conversion and the tests all hold up. The one gap is that the docs don't say this needs newer published native packages.

Comment thread CHANGELOG.md Resolved

This branch was successfully deployed

1 active deployment
azure-prod — 15c76d93 Deployed Dec 3, 2026 by cathleeny via e2e-test (22.23.4, 22_23_4) #2314
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