Repository navigation
[CXH-2028] - Support workload identity federation - Databricks Connector - #98
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
…mselves Co-authored-by: Cursor <cursoragent@cursor.com>
…they carry databricks-token reads as a Databricks personal access token: that is what DATABRICKS_TOKEN means in Databricks' own tooling, and what a bare token field means across the connectors. This credential is an externally issued JWT, which Databricks itself calls DATABRICKS_OIDC_TOKEN, so the flags are now databricks-oidc-token and databricks-oidc-token-file. Nothing ships with the old names yet, so no deployed configuration changes. The Kubernetes example also promised a token file that nothing created: the secret pointed the token file at /var/run/secrets/databricks/token while the Deployment below mounted no such volume, so the first exchange failed unless the operator supplied the mount themselves. It now carries the matching projected serviceAccountToken volume and mount, commented out like the secret line it pairs with. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The exported config schema gave neither workload identity field an export target, so both reached the hosted web form, and neither works there. A hosted connector has no file system the tenant admin controls, and a pasted JWT is never refreshed: Token() asks for a fresh subject token on every exchange, so a static string returns the same expired JWT once its hour is up. The Hello check runs while that JWT is still valid, so the configuration validates and the sync breaks later. Field groups replace the mutually exclusive and at-least-one constraints. The client secret is the default and is required again, which the constraints had forced off. The token file is its own CLI-only group, so hosted no longer offers it. The static token field is removed: it works in neither mode. Validation skips any field the selected group does not list, so each group repeats the common fields; account-id is required and would otherwise stop being checked. Selecting the file method on the command line needs --auth-method, which the README now shows. The JWT lookup moves behind SubjectTokenSource, with the file as its only implementation. A source that reads from ConductorOne lands when CXE-1557 adds the minting, and Token() will not change. Verified against the tenant with a temporary federation policy carrying an inline JWKS: a locally signed JWT exchanged for a Databricks token, and the sync through it matched the client-secret sync exactly (322 resources, 279 entitlements, 789 grants). An expired JWT, a JWT signed by an untrusted key and a missing file are each refused, and restoring the file syncs again, which is the rotation the source exists for. The policy was deleted afterwards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…edential prepareClientAuth switched to federation whenever a token file was set, so a file left over from another deployment replaced the credential the operator had selected, and validation did not catch it: the file is not in the client secret group, so that group never checks it. The method is the explicit choice, so the branch reads it. The group names move to constants that both the group definitions and the branch share. The Kubernetes example set BATON_DATABRICKS_OIDC_TOKEN_FILE without BATON_AUTH_METHOD, which validates against the client secret group and fails on the missing secret, so copying it produced a deployment that could not start. Both variables are now shown together. docs-info.md still described the JWT as a value or a file path, and two lines still said exactly one of two credentials is supplied. The static value is gone and the method selects the credential. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…dentity-c1 method The workload-identity-c1 group selected the hosted runtime's token source, but prepareClientAuth only branched on the token file method, so the connector fell through to client credentials with an empty secret and Databricks refused it with invalid_client. The method now exchanges the JWT the runtime supplies, through a SubjectTokenSource over the runtime's oauth2.TokenSource. Constructing the connector under this method without a token source is an error, so it cannot fall back to the client secret path. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Superseded — see the current review report for commit
|
| This method runs the connector yourself: on the command line or in service mode. | ||
| A ConductorOne-hosted connector has no file system you control, so the option is | ||
| not offered there. Hosted support needs ConductorOne to issue the JWT, which is | ||
| tracked in CXE-1557. |
There was a problem hiding this comment.
🟡 Suggestion: This paragraph says hosted support is not offered and is still tracked in CXE-1557. The same PR adds the workload-identity-c1 group, which config_schema.json exposes to hosted tenants. The <Warning> in docs/connector.mdx and docs/docs-info.md say the same thing. Please document the ConductorOne method, including what the federation policy must trust (audience = OAuth client ID), and remove the "not offered" wording. (confidence: high)
Superseded — see the current review report for commit
|
There was a problem hiding this comment.
No blocking issues found — see the full review report
mateoHernandez123
left a comment
There was a problem hiding this comment.
Five notes inline: two measured against this branch, three on the documentation the hosted method still needs.
main added sql-warehouse-id (#97) while this branch added the auth field groups, so both touched the same var block in pkg/config/config.go and the import block in pkg/connector/connector.go. Both sides are kept. sql-warehouse-id joins commonFields: it applies whichever way the connector authenticates, and a field that is in no group is exported in no method's schema, so incremental sync would otherwise be unreachable from the hosted form. config_schema.json is regenerated with ./connector config. Build, vet, test and lint are clean. A full sync against the tenant matches both parents exactly: 12 resource types, 326 resources, 282 entitlements, 759 grants, 0 connector errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Superseded — see the current review report for commit
|
| Exactly one of the following credentials must be supplied. Passing more than one | ||
| is a configuration error. |
There was a problem hiding this comment.
🟡 Suggestion: This says passing more than one credential is a configuration error. The code doesn't reject it: prepareClientAuth (pkg/connector/connector.go) follows --auth-method and ignores any leftover credential field, and auth_selection_test.go checks for exactly that. Suggest rewording to something like "--auth-method selects which credential is used; fields for other methods are ignored." (confidence: high)
Superseded — see the current review report for commit
|
There was a problem hiding this comment.
No blocking issues found — see the full review report
…en, document hosted workload identity Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Superseded — see the current review report for commit
|
Connector PR Review: [CXH-2028] - Support workload identity federation - Databricks ConnectorBlocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0 Review SummaryThe new commit makes three changes:
I scanned the full PR diff for security and correctness. The scope covered:
No sync, provisioning or span code changed. The repo-local criteria were applied:
The incremental diff was complete, with no dropped paths. Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. Resolved prior findings
Reviewed commit: |
There was a problem hiding this comment.
No blocking issues found — see the full review report
|
The five notes I left are fixed on fc9dcc8. I synced this binary against our Databricks account with the client secret. Exit 0, 0 connector errors: 12 resource types, 326 resources, 282 entitlements, 759 grants. Same totals as the merge commit's run against both parents. The hosted method still needs the ConductorOne runtime. c1#29994 is merged; this command-line run covers the client-secret path. |
mateoHernandez123
left a comment
There was a problem hiding this comment.
Approving. The review notes are addressed on fc9dcc8 and the tenant sync matches the previous run.
Description
The connector can now authenticate a Databricks service principal with workload identity federation. The client secret stays the default. Existing deployments keep working, and a saved config that sets the client secret still passes validation.
This pull request carries the six commits from #84 and adds the hosted path on top of them. #84 shipped two methods: the client secret and an externally issued JWT read from a file. It left the ConductorOne-hosted method out on purpose, because ConductorOne did not mint the JWT yet. ductone/c1#29994 adds that minting under CXE-1557, so the third method lands here. #84 is closed in favor of this pull request.
This pull request closes CXH-2028 and delivers the connector half of CXE-1557.
Decision path, before:
Decision path, after:
flowchart LR id["--databricks-client-id<br/>(required)"] pick{"--auth-method"} sec["client-secret (default)<br/>--databricks-client-secret"] file["workload-identity-file<br/>CLI and service mode<br/>--databricks-oidc-token-file"] c1["workload-identity-c1<br/>hosted only<br/>JWT from ConductorOne"] id --> pick pick --> sec pick --> file pick --> c1 sec --> cc["OAuth client credentials"] file --> ex["RFC 8693 token exchange"] c1 --> ex cc --> ep["account token endpoint"] ex --> ep ep --> bearer["Bearer token"] style sec fill:#e2e3e5,stroke:#6c757d,color:#000 style file fill:#d1e7dd,stroke:#0f5132,color:#000 style c1 fill:#d1e7dd,stroke:#0f5132,color:#000 style ex fill:#d1e7dd,stroke:#0f5132,color:#000 style bearer fill:#d1e7dd,stroke:#0f5132,color:#000Where the check runs:
Sync:
Unchanged. No resource type, entitlement or grant moves. This pull request changes only how the connector obtains its token.
Provisioning:
Unchanged. Account create and delete, group membership and role assignment all keep the behaviour they have today, including the
GrantAlreadyExistsandGrantAlreadyRevokedannotations.Auth:
The connector still authenticates as the service principal named by
--databricks-client-id. That flag stays required.Three authentication methods are now available. The method selects the credential, and each method is a field group:
client-secret(default):--databricks-client-secret. The connector runs the OAuth client credentials flow. This is what every deployment uses today.workload-identity-file(command line and service mode):--databricks-oidc-token-file. The connector reads this file on every token refresh.workload-identity-c1(ConductorOne-hosted only): no credential field. ConductorOne mints the JWT and delivers it to the connector runtime.On the command line, select a method with
--auth-method. Without it the connector validates against the default method and asks for a client secret.Validation only checks the fields the selected group lists. The secret is not asked for when a workload identity method is chosen, and the other way round.
This is not a breaking change. No new flag is required, and the default group is unchanged.
Databricks must trust the JWT. The administrator creates a service principal federation policy on the same service principal. For the hosted method, ConductorOne signs the JWT and the policy must trust these values:
iss)<tenant endpoint>/auth/v1/workload-identity<issuer>/.well-known/openid-configuration<issuer>/jwkssub)c1:tenant/<tenant id>/app/<app id>/connector/<connector id>aud)WORKLOAD_IDENTITY_V1signer familySource: ductone/c1#29994,
pkg/workloadidentity/workloadidentity.goandpkg/services/vault/workload_identity.go.The hosted method also needs the
WORKLOAD_IDENTITY_OIDC_ISSUERfeature flag on the tenant. ConductorOne refuses to mint a token without it.The exchange is RFC 8693. The grant type is
urn:ietf:params:oauth:grant-type:token-exchange. The subject token type isurn:ietf:params:oauth:token-type:jwt. The scope isall-apis. The URL is the account token endpoint that the client secret already uses.Architecture highlights:
clientcredentials.Configcan overridegrant_type, but its public API caches the token before the connector can set an expiry. A missingexpires_inwould pin the first token for the life of the process.expires_infalls back to the access tokenexpclaim, then to five minutes.SubjectTokenSource.TokenFederation.Token()asks the source for a subject token on every exchange, so a rotated credential needs no restart. There are two implementations: the file and the ConductorOne token source.databricks-c1-tokenis an OAuth2-typed field that holds nothing an operator sets. The hosted runtime attaches itsoauth2.TokenSourceonly when the selected field group contains an OAuth2 field, so the field is what turns the hosted delivery on.NewConnectorreturns an error when the method is selected and the runtime supplies no token source, so the connector cannot fall back to an empty client secret.uhttpclassifies the HTTP status. An HTTP 200 with no access token returnsFailedPrecondition.Validation:
Measured on #84's branch, which carries the same six commits:
baton-uc-cxh2341, then a full sync with no client secret. The result matched the client secret sync exactly: 322 resources, 279 entitlements, 789 grants. The policy and the test key were deleted after the run.Reported on this branch by @carolinaroncaglia: a full sync against a real Databricks account works for both
client-secretandworkload-identity-file, with 0 connector errors.The
workload-identity-c1path is not validated yet. It needs this pull request and ductone/c1#29994 both merged and deployed to a publicly reachable instance.Useful links:
Dependency
This pull request and ductone/c1#29994 are independent at build time. The connector compiles and syncs without the c1 change, and the two non-hosted methods work on their own. The hosted method only works after both merge and deploy.