http.cookies: parser accepts key characters that Morsel.set then rejects
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
SimpleCookie.load() extracts cookie names using _LegalKeyChars, which deliberately admits characters RFC 6265 forbids in a token — the comment above it cites MSIE non-compliance as the reason. Morsel.set() then validates with _is_legal_key, built from _LegalChars, which excludes them. Twelve separator characters differ, so any Set-Cookie whose name contains one raises CookieError even though the module's own parser accepted it.
Encountered in the wild: F5 BIG-IP load balancers emit a persistence cookie named for the partition path, /Common/.app/--pool. Browsers accept this...
from http.cookies import SimpleCookie
SimpleCookie('/a/b=1') # also a@b=1, a,b=1, a(b)=1
CPython versions tested on:
3.14
Operating systems tested on:
Linux
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 提到了 SimpleCookie.load()、Morsel.set()、_LegalKeyChars、_is_legal_key 和 _LegalChars;首先跟踪这些 parser 和 validation 路径,并复现列出的 cookie 名称。完成的标准是:已接受名称的行为保持一致,示例不再引发 CookieError,并且为这一不一致添加回归覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 68/100