python / python/cpython

http.cookiejar.domain_match() matches an interior substring instead of a suffix

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

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

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

説明

domain_match(A, B) is documented to return True when A has the form NB, i.e. A ends with B (RFC 2965, section 1: "x.y.com domain-matches .Y.com but not Y.com"). It computes i = A.rfind(B) and only rejects i == -1 or i == 0, so a B that appears as an interior substring of A also matches:

>>> from http.cookiejar import domain_match
>>> domain_match("www.acme.com.evil.org", ".acme.com")
True

www.acme.com.evil.org does not end with .acme.com, so this should be False. The sibling helper user_domain_match() already uses A.endswith(B). This feeds the RFC 2965 (version > 0) cookie domain checks in set_ok_domain/return_ok_domain and is_third_party().

Linked PRs
  • gh-150523

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

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

はじめの一歩

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

調査の方向性

http.cookiejar.domain_match() から始め、その動作を、関連する user_domain_match() ヘルパーおよび文書化されている RFC 2965 のルールと比較してください。報告された例が内部の部分文字列に対してはもう一致しないことを確認し、関連する set_ok_domain、return_ok_domain、is_third_party() のパスを確認してください。リンクされた PR gh-150523 は、作業がすでに進行中であることを示しています。

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

評価

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

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

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