Skip to content

fix: send the token federation exchange through the connection agent - #611

Open
vuanhphung wants to merge 1 commit into
mainfrom
fix/federation-uses-connection-agent
Open

vuanhphung wants to merge 1 commit into
mainfrom
fix/federation-uses-connection-agent

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

With enableTokenFederation (Thrift static-token, token-provider or external-token auth), FederationProvider posts the /oidc/v1/token exchange with node-fetch and no agent (FederationProvider.ts:169-181). The connection's proxy, checkServerCertificate, customCaCert and clientCert/clientKey therefore don't apply to it, unlike the SQL connection and the OAuth flows, which use connectionProvider.getAgent(). Behind a required proxy the exchange fails, and with the default returnOriginalTokenOnFailure the driver silently sends the unexchanged token.

Found by databricks-driver-test AUTH-011 (service-principal workload identity federation): on Thrift the proxy never sees the exchange. The test now runs on Node.js Thrift as an xfail tripwire.

Change

FederationProvider takes an optional getAgent(url) and passes the agent to the exchange request. DBSQLClient wires it to the connection provider's agent for the exchange URL. Without getAgent the behavior is unchanged.

Verification

  • Unit tests: the exchange uses the agent from getAgent, and DBSQLClient wires getAgent to the connection's agent. npm test (1753 passing), npm run lint, npm run prettier.
  • Integration, databricks-driver-test#2072 live (AUTH-011 needs GitHub OIDC, so CI only):
    • On main, the proxy records no OAuth calls for the Thrift exchange (run).
    • On this commit (cb8f5cf), the Thrift AUTH-011 tripwire throws XPASS. The proxy sees the RFC 8693 token exchange with the service-principal client_id, the exchanged token is workspace-issued, and SELECT CURRENT_USER() returns one row (run). The rest of the Thrift suite passes; the only SEA failures there are TELEMETRY-001/004, warehouse-timing tests that also fail on main.

This pull request and its description were written by Isaac.

FederationProvider posted the `/oidc/v1/token` exchange with node-fetch and
no agent, so `proxy`, `checkServerCertificate`, `customCaCert` and
`clientCert`/`clientKey` did not apply to it. Behind a required proxy the
exchange failed and the driver silently fell back to the original token.
Pass the connection's agent for the exchange URL, as OAuth already does.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-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.

✅ No issues identified by the review bot.

This branch was previously deployed

1 inactive deployment
azure-prod — cb8f5cf4 Deployed Nov 13, 2026 by vuanhphung via e2e-test (22.23.4, 22_23_4) #2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant