[coverage] Conformance findings: AUTH-019

未关闭 适合新手
#1,034 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

从 backend/kernel/auth_bridge.py::_normalize_scopes 和 coverage PR diff 中 tests/ 下的 xfail 测试 test_oauth_m2m_token_request_uses_configured_scopes 开始。检查配置的 scope 条目如何处理空白和重复项,然后运行该测试。完成标准是:配置的 scope 生成唯一的 sql token,而空白或未设置的 scope 回退到 all-apis,并且 session 断言通过。

由索引模型根据 Issue 内容生成。

描述

Summary

Surfaced by the multi-language coverage fan-out while conformance-testing these SPEC-IDs against databricks/databricks-sql-python. Each finding is committed as an expected-failure (xfail) test in the coverage PR — the test asserts the CORRECT (post-fix) behavior and stays red until THIS driver (databricks/databricks-sql-python) is fixed, then flips green as a tripwire.

Findings

  • AUTH-019 [sea]: kernel/SEA OAuth M2M does not normalize oauth_scopes: list entries are forwarded verbatim, so a padded/duplicated entry sends a repeated scope token and a whitespace-only entry sends a blank scope the token endpoint rejects (HTTP 400 invalid_scope) instead of falling back to all-apis (backend/kernel/auth_bridge.py::_normalize_scopes)
    • failing test: test_oauth_m2m_token_request_uses_configured_scopes (see the coverage PR diff under tests/)
  • AUTH-019: kernel/SEA OAuth M2M does not normalize oauth_scopes: list entries are forwarded verbatim, so a padded/duplicated entry ([" sql sql "]) sends a repeated scope token and a whitespace-only entry ([" "]) sends a blank scope that the workspace token endpoint rejects with HTTP 400 invalid_scope instead of falling back to the all-apis default (backend/kernel/auth_bridge.py::_normalize_scopes)

Reproduce & Expected

AUTH-019 — Verifies that the driver's OAuth scopes option decides what the client-credentials (M2M) token request asks for, instead of always requesting all-apis, so a service principal whose secret is scoped…

Reproduce:

SELECT CURRENT_USER() AS user
SELECT CURRENT_USER() AS user
SELECT CURRENT_USER() AS user
SELECT CURRENT_USER() AS user

Expected (per the shared spec):

  • result has exactly 1 row(s)
  • result has exactly 1 row(s)
  • result has exactly 1 row(s)
  • result has exactly 1 row(s)
  • full assertion contract:
result:
- label: configured_scopes
  oauth_token_request_scope_tokens:
    grant_type: client_credentials
    equals:
    - sql
- label: configured_scopes
  row_count: 1
- label: sloppy_scopes
  oauth_token_request_scope_tokens:
    grant_type: client_credentials
    equals:
    - sql
- label: sloppy_scopes
  row_count: 1
- label: blank_scopes
  oauth_token_request_scope_tokens:
    grant_type: client_credentials
    equals:
    - all-apis
- label: blank_scopes
  row_count: 1
- label: unset_scopes
  oauth_token_request_scope_tokens:
    grant_type: client_credentials
    equals:
    - all-apis
- label: unset_scopes
  row_count: 1
protocol:
  thrift:
  - call_min:
      method: OpenSession
      min: 1
  sea:
  - call_min:
      operation: CreateSession
      min: 1

Context

主要语言
Python
星标
236
派生
162
平均合并
13 小时 13 分钟
30 天内合并 PR
23

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

databricks/databricks-sql-python 的其他 Issue

查看 databricks/databricks-sql-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。