urllib.request.HTTPDigestAuthHandler crashes on a malformed WWW-Authenticate digest challenge
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug description:
urllib.request.AbstractDigestAuthHandler.retry_http_digest_auth parses a
server-controlled WWW-Authenticate: Digest ... challenge without guarding the
parse, so a malformed challenge raises a bare ValueError or IndexError out
of urlopen() instead of being declined:
import urllib.request
h = urllib.request.HTTPDigestAuthHandler(None)
req = urllib.request.Request("http://example.invalid/")
h.retry_http_digest_auth(req, "Digest realm") # ValueError
h.retry_http_digest_auth(req, "Digest realm=") # IndexError
h.retry_http_digest_auth(req, "Digest") # ValueError
Digest realm / Digest realm= fail in parse_keqv_list; Digest fails in
auth.split(' ', 1). The handler should decline a challenge it cannot
parse (return None), as it already does for a 40x it cannot handle.
CPython versions tested on:
3.12, 3.13, 3.14, 3.15
Operating systems tested on:
macOS
Linked PRs
- gh-153793
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 urllib.request.AbstractDigestAuthHandler.retry_http_digest_auth 開始,重現 issue 中所示的三個格式錯誤的 WWW-Authenticate challenge。完成的標準是,格式錯誤的 Digest challenge 返回 None,而不是引發 ValueError 或 IndexError;關聯的 PR gh-153793 表明相關工作已經在進行中。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- networking
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100