Skip to content

Commit f09887d

Browse files
committed
http: use new "best effort" strategy for Secure Channel revoke checking
The native Windows HTTPS backend is based on Secure Channel which lets the caller decide how to handle revocation checking problems caused by missing information in the certificate or offline CRL distribution points. Unfortunately, cURL chose to handle these problems differently than OpenSSL by default: while OpenSSL happily ignores those problems (essentially saying "¯\_(ツ)_/¯"), the Secure Channel backend will error out instead. As a remedy, the "no revoke" mode was introduced, which turns off revocation checking altogether. This is a bit heavy-handed. We support this via the `http.schannelCheckRevoke` setting. In curl/curl#4981, we contributed an opt-in "best effort" strategy that emulates what OpenSSL seems to do. In Git for Windows, we actually want this to be the default. This patch makes it so, introducing it as a new value for the `http.schannelCheckRevoke" setting, which now becmes a tristate: it accepts the values "false", "true" or "best-effort" (defaulting to the last one). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 787bfe4 commit f09887d

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Documentation/config/http.txt

+7-5
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,13 @@ http.sslBackend::
189189

190190
http.schannelCheckRevoke::
191191
Used to enforce or disable certificate revocation checks in cURL
192-
when http.sslBackend is set to "schannel". Defaults to `true` if
193-
unset. Only necessary to disable this if Git consistently errors
194-
and the message is about checking the revocation status of a
195-
certificate. This option is ignored if cURL lacks support for
196-
setting the relevant SSL option at runtime.
192+
when http.sslBackend is set to "schannel" via "true" and "false",
193+
respectively. Another accepted value is "best-effort" (the default)
194+
in which case revocation checks are performed, but errors due to
195+
revocation list distribution points that are offline are silently
196+
ignored, as well as errors due to certificates missing revocation
197+
list distribution points. This option is ignored if cURL lacks
198+
support for setting the relevant SSL option at runtime.
197199

198200
http.schannelUseSSLCAInfo::
199201
As of cURL v7.60.0, the Secure Channel backend can use the

http.c

+22-4
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ static char *cached_accept_language;
136136

137137
static char *http_ssl_backend;
138138

139-
static int http_schannel_check_revoke = 1;
139+
static int http_schannel_check_revoke_mode =
140+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
141+
CURLSSLOPT_REVOKE_BEST_EFFORT;
142+
#else
143+
CURLSSLOPT_NO_REVOKE;
144+
#endif
145+
140146
/*
141147
* With the backend being set to `schannel`, setting sslCAinfo would override
142148
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -287,7 +293,19 @@ static int http_options(const char *var, const char *value, void *cb)
287293
}
288294

289295
if (!strcmp("http.schannelcheckrevoke", var)) {
290-
http_schannel_check_revoke = git_config_bool(var, value);
296+
if (value && !strcmp(value, "best-effort")) {
297+
http_schannel_check_revoke_mode =
298+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
299+
CURLSSLOPT_REVOKE_BEST_EFFORT;
300+
#else
301+
CURLSSLOPT_NO_REVOKE;
302+
warning(_("%s=%s unsupported by current cURL"),
303+
var, value);
304+
#endif
305+
} else
306+
http_schannel_check_revoke_mode =
307+
(git_config_bool(var, value) ?
308+
0 : CURLSSLOPT_NO_REVOKE);
291309
return 0;
292310
}
293311

@@ -854,9 +872,9 @@ static CURL *get_curl_handle(void)
854872
#endif
855873

856874
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
857-
!http_schannel_check_revoke) {
875+
http_schannel_check_revoke_mode) {
858876
#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
859-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
877+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
860878
#else
861879
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
862880
#endif

0 commit comments

Comments
 (0)