Skip to content

Fix feature flags, U2M OAuth, and add SPOG header support#347

Open
msrathore-db wants to merge 2 commits intomainfrom
spog-fixes
Open

Fix feature flags, U2M OAuth, and add SPOG header support#347
msrathore-db wants to merge 2 commits intomainfrom
spog-fixes

Conversation

@msrathore-db
Copy link
Copy Markdown

Summary

Three fixes for SPOG (Single Panel of Glass) support and pre-existing bugs:

Fix 1 — Feature flags endpoint (pre-existing bug)

  • Wrong endpoint: /api/2.0/feature-flags (404 everywhere) → /api/2.0/connector-service/feature-flags/GOLANG/{version} (200)
  • Wrong response format: Expected {"flags": {"name": bool}} → actual {"flags": [{"name": "...", "value": "..."}]}
  • No auth headers: Feature flag requests had no authentication — now uses the connection's HTTP client
  • SPOG routing: Added extraHeaders parameter to pass x-databricks-org-id from ?o= in httpPath

Fix 2 — U2M OAuth empty client secret (pre-existing bug)

  • ClientSecret: "" was always set on oauth2.Config for U2M (public app using PKCE)
  • Go's oauth2 library sends Authorization: Basic base64(clientID:) via AuthStyleInHeader
  • OIDC server rejects: "Public app should not use a client secret"
  • Fix: Don't set ClientSecret when empty + force AuthStyleInParams for public apps

Fix 3 — SPOG header extraction

  • Extract ?o=<workspaceId> from httpPath using url.ParseQuery
  • Inject x-databricks-org-id header into feature flag requests for SPOG routing

Test plan

  • All existing telemetry unit tests pass (go test ./telemetry/...)
  • E2E: PAT on AWS SPOG + Legacy — PASS
  • E2E: Databricks M2M on AWS SPOG + Legacy — PASS
  • E2E: Databricks M2M on Azure prod — PASS
  • E2E: U2M on AWS SPOG — PASS (with browser login)
  • E2E: Feature flags return HTTP 200 on SPOG and Legacy
  • E2E: Telemetry returns HTTP 200

NO_CHANGELOG=true

This pull request was AI-assisted by Isaac.

The U2M flow uses PKCE (public app) and should not send a client secret.
Previously, ClientSecret was always set to "" on the oauth2.Config, which
caused Go's oauth2 library to send an empty client_secret via Basic auth.
The OIDC server rejects this with "Public app should not use a client
secret".

Only set ClientSecret when it's non-empty, so public apps use the "none"
token endpoint auth method as intended.

Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
Feature flags:
- Fix endpoint path: /api/2.0/feature-flags -> /api/2.0/connector-service/feature-flags/GOLANG/{version}
- Fix response parsing: map format -> array of {name, value} entries
- Add extraHeaders for SPOG routing (x-databricks-org-id)
- Extract ?o=<workspaceId> from httpPath in connector

U2M OAuth:
- Don't set ClientSecret for public apps (PKCE)
- Force AuthStyleInParams to prevent Basic auth with empty password
- Server rejects "Public app should not use a client secret" otherwise

Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
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