Skip to content

Commit 44520ff

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 6e0ce3f commit 44520ff

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
@@ -152,11 +152,13 @@ http.sslBackend::
152152

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

161163
http.schannelUseSSLCAInfo::
162164
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
@@ -158,7 +158,13 @@ static char *cached_accept_language;
158158

159159
static char *http_ssl_backend;
160160

161-
static int http_schannel_check_revoke = 1;
161+
static int http_schannel_check_revoke_mode =
162+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
163+
CURLSSLOPT_REVOKE_BEST_EFFORT;
164+
#else
165+
CURLSSLOPT_NO_REVOKE;
166+
#endif
167+
162168
/*
163169
* With the backend being set to `schannel`, setting sslCAinfo would override
164170
* the Certificate Store in cURL v7.60.0 and later, which is not what we want
@@ -323,7 +329,19 @@ static int http_options(const char *var, const char *value, void *cb)
323329
}
324330

325331
if (!strcmp("http.schannelcheckrevoke", var)) {
326-
http_schannel_check_revoke = git_config_bool(var, value);
332+
if (value && !strcmp(value, "best-effort")) {
333+
http_schannel_check_revoke_mode =
334+
#ifdef CURLSSLOPT_REVOKE_BEST_EFFORT
335+
CURLSSLOPT_REVOKE_BEST_EFFORT;
336+
#else
337+
CURLSSLOPT_NO_REVOKE;
338+
warning(_("%s=%s unsupported by current cURL"),
339+
var, value);
340+
#endif
341+
} else
342+
http_schannel_check_revoke_mode =
343+
(git_config_bool(var, value) ?
344+
0 : CURLSSLOPT_NO_REVOKE);
327345
return 0;
328346
}
329347

@@ -869,9 +887,9 @@ static CURL *get_curl_handle(void)
869887
#endif
870888

871889
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
872-
!http_schannel_check_revoke) {
890+
http_schannel_check_revoke_mode) {
873891
#if LIBCURL_VERSION_NUM >= 0x072c00
874-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
892+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
875893
#else
876894
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
877895
#endif

0 commit comments

Comments
 (0)