php / php/php-src

curl: Fallback to using Certificate Authority from Windows Certificate Store

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

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

Extension: curl Feature
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

In PHP's current implementation, there is an inconsistency in how the language handles SSL/TLS certificate validation across different operating systems. This inconsistency primarily affects Windows users.

In this proof-of-concept, we can see the behavior clearly:

On Windows, the script does two requests:

  1. The first request without a CA file that fails and prints Request correctly failed without CA certificate (expected on Windows)
  2. A second request using the CA file from Mozilla that succeeds and prints Request succeeded with provided CA certificate

On Linux and Mac, it uses the O.S CA file, which prints Request succeeded without CA certificate (expected on Linux and macOS)

On Linux, it uses by default:

CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs

On Mac, it uses:

CAPath: /usr/local/etc/openssl@3/certs

On Windows, both are blank:

CAfile: (empty)
CApath: (empty)

Which means that PHP doesn't have a fallback Certificate Authority file to validate HTTPS requests, which leads to issues such as these. The common solution for this problem for Windows users is to download a trusted CA file (such as from Mozilla), and update php.ini to use it:

This is a sub-optimal solution as it increases complexity for the average John Doe that just wants to do a network request against a HTTPS URL.

I think PHP in Windows could fallback to accessing the Windows Certificate Store, or bundle a trusted CA file, although this might get outdated.

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

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

はじめの一歩

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

調査の方向性

リポジトリのファイルやテストは指定されていません。まず、リンクされている Windows proof of concept と、現在の PHP における HTTPS 証明書検証の動作を確認し、次にどのフォールバック方式をサポートするかを定義します。Windows のリクエストが、別途設定された CA ファイルを必要とせずに信頼された証明書を検証できれば完了です。

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

評価

技術スタック
php
領域
security
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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