python / python/cpython

The running time of the load_verify_locations functions of the SSL module using the cafile and cadata parameters is quite different.

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

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

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

説明

Bug report

Bug description:

The running time of the load_verify_locations functions of the SSL module using the cafile and cadata parameters is quite different.
The cafile parameter takes much more time to run than the cadata.

import ssl
import time
import certifi

from pathlib import Path

DEFAULT_CA_BUNDLE_PATH = Path(certifi.where())
print(DEFAULT_CA_BUNDLE_PATH)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

start = time.time()
context.load_verify_locations(cafile=DEFAULT_CA_BUNDLE_PATH)
end = time.time()
print(end - start)

start = time.time()
cdata = open(DEFAULT_CA_BUNDLE_PATH, 'r', encoding='utf-8').read()
context.load_verify_locations(cadata=cdata)
end = time.time()
print(end - start)

out :

C:\Program Files\Python311\Lib\site-packages\certifi\cacert.pem
0.5879108905792236
0.06105494499206543
CPython versions tested on:

3.11

Operating systems tested on:

Windows

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

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

はじめの一歩

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

調査の方向性

Windows 上で Python 3.11 を使って提供されたスクリプトを再現し、cafile として渡された certifi cacert.pem パスの場合と、cadata として渡されたその内容の場合で SSLContext.load_verify_locations を比較します。SSL モジュールのエントリポイントから開始し、実行時に 2 つの呼び出しが異なる理由を特定します。原因が説明され、動作が修正または文書化され、比較を対象とするカバレッジが用意されれば完了です。

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

評価

技術スタック
python
領域
security
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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