curl: Fallback to using Certificate Authority from Windows Certificate Store
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.1k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
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:
- The first request without a CA file that fails and prints
Request correctly failed without CA certificate (expected on Windows) - 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:
- Download http://curl.haxx.se/ca/cacert.pem
- Point php.ini
openssl.cafileto the downloaded file
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Aucun fichier du dépôt ni aucun test n’est indiqué. Commencez par examiner la preuve de concept Windows liée et le comportement actuel de PHP en matière de validation des certificats HTTPS, puis définissez quelle approche de fallback est prise en charge ; le travail est terminé lorsque les requêtes Windows valident les certificats approuvés sans nécessiter de fichier CA configuré séparément.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- php
- Domaine
- security
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100