Skip to content

Fix auth profiles misclassifying SPOG hosts as workspace configs#4929

Open
mihaimitrea-db wants to merge 3 commits intomainfrom
mihaimitrea-db/fix-profiles-spog-classification
Open

Fix auth profiles misclassifying SPOG hosts as workspace configs#4929
mihaimitrea-db wants to merge 3 commits intomainfrom
mihaimitrea-db/fix-profiles-spog-classification

Conversation

@mihaimitrea-db
Copy link
Copy Markdown
Contributor

@mihaimitrea-db mihaimitrea-db commented Apr 10, 2026

Summary

  • The SDK's ConfigType() classifies hosts by URL prefix (accounts.* → account, everything else → workspace). SPOG hosts don't match the accounts.* prefix, so they were misclassified as WorkspaceConfig and validated with CurrentUser.Me, which fails on account-scoped SPOG hosts.
  • Use the resolved DiscoveryURL from /.well-known/databricks-config to detect SPOG hosts with account-scoped OIDC (contains /oidc/accounts/), matching the routing logic in auth.AuthArguments.ToOAuthArgument() and the approach from Fix auth logout failing to clear token for workspace profiles with account ID #4853.
  • Add a fallback for legacy profiles with experimental_is_unified_host where .well-known is unreachable.

Why not just check account_id?

Since #4809, runHostDiscovery populates account_id on every workspace profile from the .well-known endpoint. A regular workspace profile now routinely carries account_id. The only reliable discriminator is the oidc_endpoint shape from .well-known, resolved at runtime (as established in #4853).

Test plan

  • Unit tests: TestProfileLoadSPOGConfigType — table-driven with mock HTTP servers covering SPOG account, SPOG workspace, SPOG with workspace_id=none, and classic workspace with discovery-populated account_id.
  • Unit test: TestProfileLoadUnifiedHostFallbackexperimental_is_unified_host profile with unreachable .well-known falls back to account validation.
  • Unit test: TestProfileLoadClassicAccountHost — classic account-scoped OIDC host.
  • Acceptance test: cmd/auth/profiles/spog-account — end-to-end: SPOG profile with workspace_id=none shows valid:true.
  • go test ./cmd/auth and go test ./acceptance -run TestAccept/cmd/auth/profiles pass.

SPOG hosts (e.g. db-deco-test.gcp.databricks.com) don't match the
accounts.* URL prefix, so ConfigType() classifies them as
WorkspaceConfig. This causes `auth profiles` to validate with
CurrentUser.Me instead of Workspaces.List, which fails for
account-scoped SPOG profiles.

Use the resolved DiscoveryURL from .well-known/databricks-config to
detect SPOG hosts with account-scoped OIDC, matching the routing
logic in auth.AuthArguments.ToOAuthArgument(). Also add a fallback
for legacy profiles with Experimental_IsUnifiedHost where .well-known
is unreachable.
@github-actions
Copy link
Copy Markdown

Waiting for approval

Based on git history, these people are best suited to review:

Eligible reviewers: @andrewnester, @anton-107, @denik, @shreyas-goenka

Suggestions based on git history. See OWNERS for ownership rules.

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