Skip to content

Commit 6108558

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
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 753f9b0 commit 6108558

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

Documentation/config/http.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,13 @@ http.sslBackend::
173173

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

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

http.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ static char *cached_accept_language;
165165

166166
static char *http_ssl_backend;
167167

168-
static int http_schannel_check_revoke = 1;
168+
static int http_schannel_check_revoke_mode =
169+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
170+
CURLSSLOPT_REVOKE_BEST_EFFORT;
171+
#else
172+
CURLSSLOPT_NO_REVOKE;
173+
#endif
174+
169175
/*
170176
* With the backend being set to `schannel`, setting sslCAinfo would override
171177
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -330,7 +336,19 @@ static int http_options(const char *var, const char *value, void *cb)
330336
}
331337

332338
if (!strcmp("http.schannelcheckrevoke", var)) {
333-
http_schannel_check_revoke = git_config_bool(var, value);
339+
if (value && !strcmp(value, "best-effort")) {
340+
http_schannel_check_revoke_mode =
341+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
342+
CURLSSLOPT_REVOKE_BEST_EFFORT;
343+
#else
344+
CURLSSLOPT_NO_REVOKE;
345+
warning(_("%s=%s unsupported by current cURL"),
346+
var, value);
347+
#endif
348+
} else
349+
http_schannel_check_revoke_mode =
350+
(git_config_bool(var, value) ?
351+
0 : CURLSSLOPT_NO_REVOKE);
334352
return 0;
335353
}
336354

@@ -905,9 +923,9 @@ static CURL *get_curl_handle(void)
905923
#endif
906924

907925
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
908-
!http_schannel_check_revoke) {
926+
http_schannel_check_revoke_mode) {
909927
#if LIBCURL_VERSION_NUM >= 0x072c00
910-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
928+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
911929
#else
912930
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
913931
#endif

0 commit comments

Comments
 (0)