python / python/cpython

urllib.parse.parse_qs should not parse a query string containing illegal characters

オープン
#135,523 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

urllib.parse.parse_qsl will happily parse a query string containing '#'.

from urllib.parse import parse_qsl
parse_qsl('foo=#', strict_parsing=True)

Output is [('foo', '#')] .

But 'foo=#' is an invalid query string according to RFC 3986. Similarly, '[', and ']' are excluded from the set of valid query characters, but parse_qsl parses strings like 'foo=[' and 'foo=]' . In the absence of any allocation of responsibility, this looks like a bug to me.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs
  • gh-152530

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

urllib.parse.parse_qsl から始め、RFC 3986 に照らしてクエリ文字がどのように検証されているかを確認します。まず既存のパーステストとリンク先の PR gh-152530 を確認してください。'#'、'['、']' などの不正な文字が合意された動作と一貫した方法で処理され、テストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend-api-design
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。