| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Signed-off-by: peco-engineer-bot[bot] <3815206+peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Medium · 1 Low
Targeted AUTH-013 fix that correctly forwards caller scopes/port for custom client_ids and adds two red→green tests. One medium concern: the refactor also changed the default-client_id path to honor oauth_redirect_port (and custom scopes) even without a caller oauth_client_id, which is untested and contradicts the PR's own stated principle — worth confirming this widening is intentional.
Sorry, something went wrong.
Addresses: - #3798853448 at src/databricks/sql/auth/auth.py:141 - #3798853453 at src/databricks/sql/auth/auth.py:128 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Summary
Automated fix for #909 — [coverage] Conformance findings: AUTH-013.
Fixed get_python_sql_connector_auth_provider in src/databricks/sql/auth/auth.py to honour a caller-supplied U2M OAuth bundle: it now forwards the caller's oauth_scopes verbatim (instead of hardcoding PYSQL_OAUTH_SCOPES) and, when a foreign oauth_client_id is supplied without a redirect port, falls through to the app-neutral base default [8030] rather than pinning the driver's own app-specific range (8020–8024). This is an offline-only, client-side computed artifact (resolved redirect port/scopes at provider construction) anchored in the AUTH-013 shared spec + reference PR databricks-sql-kernel#247; the interactive U2M login is never completed so the behavior is not end-to-end observable, making the unit test the correct verification. Both red→green tests and the full auth unit suite (15 passed) are green.
Root cause & plan
Root cause: In get_python_sql_connector_auth_provider (src/databricks/sql/auth/auth.py, ~lines 115–134), a caller-supplied U2M OAuth bundle is not honored when a custom oauth_client_id is given: (A) oauth_scopes is hardcoded to PYSQL_OAUTH_SCOPES and the caller's oauth_scopes kwarg is never read, so custom scopes like ["all-apis"] are silently replaced by the driver default sql offline_access; (B) the redirect port only honors oauth_redirect_port when paired with oauth_client_id, otherwise falling back to the driver's OWN app-specific PYSQL_OAUTH_REDIRECT_PORT_RANGE (8020–8024) — so a foreign client_id with no port gets pinned to the driver's default app port 8020, producing redirect_uri_mismatch (PECOBLR-4039) instead of falling through to the base default (8030). The spec principle: a caller who supplies their own client_id owns the rest of the bundle; the driver must not pin its own app-specific defaults.
Files: src/databricks/sql/auth/auth.py, tests/unit/test_auth.py
Planned coverage:
Files changed
Test plan
🤖 Generated by engineer-bot (bug-fix flow) — review before merge.