modelcontextprotocol / modelcontextprotocol/python-sdk
Bug: validate_scope rejects client scopes when required scopes in None
未關閉
適合新手
還沒有人認領這個 Issue。
auth
bug
P2
ready for work
- 主要語言
- Python
- 星號
- 24.3k
- 分支
- 4k
- 平均合併
- 1 天 1 小時
- 30 天內合併 PR
- 31
描述
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
The validate_scope() function in the Python SDK incorrectly handles cases where there are no required scopes from the client. Instead of treating None as no restrictions, it interprets it as an empty list of allowed scopes. This causes scopes in the token to be rejected with InvalidScopeError, even if the client should be allowed to request them.
Example Code
Python & MCP Python SDK
1.26.0
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
在 Python SDK 中定位 validate_scope,並追蹤當值為 None 時必要 scope 的處理方式。重現 client scope 缺少而 token scope 存在的情況,然後驗證有效 scope 不再因 InvalidScopeError 被拒絕,並為此行為補充覆蓋測試。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- authentication, authorization
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 64/100