http.cookiejar.http2time raises ValueError instead of returning None for a strict-format fake month
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug description
http.cookiejar.http2time() documents that it returns None for an
unrecognized date format, but its STRICT_DATE_RE fast path raises a raw
ValueError when the month field matches the pattern [JFMASOND][a-z][a-z]
yet names a month that does not exist:
>>> from http.cookiejar import http2time
>>> http2time('Wed, 09 Foo 1994 22:23:32 GMT')
Traceback (most recent call last):
...
ValueError: 'foo' is not in list
>>> http2time('Wed, 09 Feb 1994 22:23:32 GMT') # a real month still works
760832612.0
The slower parser (_str2time) already handles the same input via
try/except and returns None; only the strict fast path leaks. It is
reachable from parse_ns_headers() through a cookie's expires= attribute,
e.g. Set-Cookie: x=y; expires=Wed, 09 Foo 1994 22:23:32 GMT.
gh-60385 previously established the "returns None, never raises" contract
for a different http2time code path; the later STRICT_DATE_RE fast path
reintroduced a leak on this separate path.
CPython versions tested on
3.13, 3.14, 3.15
Operating systems tested on
Linux, macOS
Linked PRs
- gh-153678
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Python の http.cookiejar モジュールから始め、STRICT_DATE_RE の高速パスを通る http2time() を追跡し、無効な月に対する _str2time の処理と比較します。厳密形式の不正な月が例外を発生させずに None を返し、有効な月は引き続き正常に解析されれば、変更は完了です。Issue で説明されている parse_ns_headers() の cookie expiry パスを考慮してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- networking
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100