Re: [PATCH v2] http: add http.sslVerifyStatus to check stapled OCSP responses
Patrick Steinhardt <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 11, 2026 at 04:44:07PM -0400, graysongordon-gl wrote: > From: Grayson Gordon <[email protected]> > > git asks libcurl to verify the peer certificate and the hostname, but it > never sets CURLOPT_SSL_VERIFYSTATUS, so the "Certificate Status Request" > TLS extension is never requested and any stapled OCSP response the server > does send is ignored. > > On an OpenSSL-linked build this is silent. OpenSSL hands the stapled > response to the application and takes no view on it: > SSL_CTX_set_tlsext_status_cb(3) says the callback "should determine > whether the returned OCSP response(s) are acceptable or not", and libcurl > only installs that callback when CURLOPT_SSL_VERIFYSTATUS is set. So git > will fetch from a server whose own staple says its certificate has been > revoked. > > A GnuTLS-linked build behaves differently, and the difference does not > come from curl. GnuTLS consults a stapled response inside > gnutls_certificate_verify_peers(), so the failure surfaces through the > verifypeer branch of curl's GnuTLS backend (lib/vtls/gtls.c) whether or > not CURLOPT_SSL_VERIFYSTATUS was ever set. The same git, against the same Nit: this is arguably not the same git, as it links against different libraries. It is not exactly unexpected that using different dependencies may cause different behaviour, even though we should of course try to minimize the differences. > server, therefore enforces revocation or not depending only on how its > libcurl was built. That difference is documented here rather than papered > over: this option turns the check on where the backend needs asking, and > setting it to false does not turn the check off on GnuTLS. > > Add an http.sslVerifyStatus boolean that sets CURLOPT_SSL_VERIFYSTATUS. > Because http_options() is the collect_fn of a urlmatch config, the > per-URL form works with no further changes: > > git config http.https://example.com/.sslVerifyStatus true > > It defaults to false, and has to. The option is fail-closed: libcurl fails > verification when the server staples nothing at all, so turning this on > globally would break every remote that does not staple. > > Leaving the default to libcurl is not an option either. The same > complaint was raised there in https://github.com/curl/curl/issues/15483 > and closed as intentional ("Marked as enhancement since this was done on > purpose"), with the observation that stapling is expected to see less use > as Let's Encrypt drops OCSP support. If the check is to be reachable at > all, the lever has to come from the application. Okay. One could make the argument that we shouldn't add support for OCSP either if it's being phased out now. But I assume there's still going to be enough servers out there that do use it. The big question to me is why we want to have this change in the first place. It doesn't help to address the behaviour difference between GnuTLS and OpenSSL: if set to "false" OpenSSL would continue to ignore OCSP, whereas GnuTLS would still honor it. If set to "true", OpenSSL would fail closed, whereas GnuTLS would still behave the same as before. So nothing really changes here, unless I misunderstand something. We don't really gain security, either, because the setting is disabled by default and can only be enabled host-by-host. I doubt anybody out there is really going to do that though, and consequently we haven't really made the world a more secure place :/ So is there any specific use case that you're after? Who exactly is this new feature for? Thanks! Patrick