diff mercurial/sslutil.py @ 29561:1a782fabf80d

sslutil: print a warning when using TLS 1.0 on legacy Python Mercurial now requires TLS 1.1+ when TLS 1.1+ is supported by the client. Since we made the decision to require TLS 1.1+ when running with modern Python versions, it makes sense to do something for legacy Python versions that only support TLS 1.0. Feature parity would be to prevent TLS 1.0 connections out of the box and require a config option to enable them. However, this is extremely user hostile since Mercurial wouldn't talk to https:// by default in these installations! I can easily see how someone would do something foolish like use "--insecure" instead - and that would be worse than allowing TLS 1.0! This patch takes the compromise position of printing a warning when performing TLS 1.0 connections when running on old Python versions. While this warning is no more annoying than the CA certificate / fingerprint warnings in Mercurial 3.8, we provide a config option to disable the warning because to many people upgrading Python to make the warning go away is not an available recourse (unlike pinning fingerprints is for the CA warning). The warning appears as optional output in a lot of tests.
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 13 Jul 2016 21:49:17 -0700
parents 303e9300772a
children 9654ef41f7cc
line wrap: on
line diff
--- a/mercurial/sslutil.py	Wed Jul 13 21:35:54 2016 -0700
+++ b/mercurial/sslutil.py	Wed Jul 13 21:49:17 2016 -0700
@@ -161,6 +161,16 @@
     if modernssl:
         defaultprotocol = 'tls1.1'
     else:
+        # Let people on legacy Python versions know they are borderline
+        # secure.
+        # We don't document this config option because we want people to see
+        # the bold warnings on the web site.
+        # internal config: hostsecurity.disabletls10warning
+        if not ui.configbool('hostsecurity', 'disabletls10warning'):
+            ui.warn(_('warning: connecting to %s using legacy security '
+                      'technology (TLS 1.0); see '
+                      'https://mercurial-scm.org/wiki/SecureConnections for '
+                      'more info\n') % hostname)
         defaultprotocol = 'tls1.0'
 
     key = 'minimumprotocol'