comparison mercurial/sslutil.py @ 52292:085cc409847d

sslutil: bump the default minimum TLS version of the client to 1.2 (BC) TLS v1.0 and v1.1 are deprecated by RFC8996[1]: These versions lack support for current and recommended cryptographic algorithms and mechanisms, and various government and industry profiles of applications using TLS now mandate avoiding these old TLS versions. TLS version 1.2 became the recommended version for IETF protocols in 2008 (subsequently being obsoleted by TLS version 1.3 in 2018)... Various browsers have disabled or removed it[2][3][4], as have various internet services, and Windows 11 has it disabled by default[5]. We should move on too. (We should also bump it on the server side, as this config only affects clients not allowing a server to negotiate down. But the only server-side config is a `devel` option to pick exactly one protocol version and is commented as a footgun, so I'm hesitant to touch that. See 7dec5e441bf7 for details, which states that using `hg serve` directly isn't expected for a web service.) I'm not knowledgeable enough in this area to know if we should follow up with disabling certain ciphers too. But this should provide better security on its own. [1] https://datatracker.ietf.org/doc/rfc8996/ [2] https://learn.microsoft.com/en-us/DeployEdge/microsoft-edge-policies#sslversionmin [3] https://hacks.mozilla.org/2020/02/its-the-boot-for-tls-1-0-and-tls-1-1/ [4] https://security.googleblog.com/2018/10/modernizing-transport-security.html [5] https://techcommunity.microsoft.com/blog/windows-itpro-blog/tls-1-0-and-tls-1-1-soon-to-be-disabled-in-windows/3887947
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 11 Nov 2024 21:25:03 -0500
parents 323e3626929a
children
comparison
equal deleted inserted replaced
52291:b65085c6d6ff 52292:085cc409847d
97 % (key, protocol), 97 % (key, protocol),
98 hint=_(b'valid protocols: %s') 98 hint=_(b'valid protocols: %s')
99 % b' '.join(sorted(configprotocols)), 99 % b' '.join(sorted(configprotocols)),
100 ) 100 )
101 101
102 # We default to TLS 1.1+ because TLS 1.0 has known vulnerabilities (like 102 # We default to TLS 1.2+ because TLS 1.0 has known vulnerabilities (like
103 # BEAST and POODLE). We allow users to downgrade to TLS 1.0+ via config 103 # BEAST and POODLE). We allow users to downgrade to TLS 1.0+ via config
104 # options in case a legacy server is encountered. 104 # options in case a legacy server is encountered.
105 105
106 # setup.py checks that TLS 1.1 or TLS 1.2 is present, so the following 106 # setup.py checks that TLS 1.1 or TLS 1.2 is present, so the following
107 # assert should not fail. 107 # assert should not fail.
108 assert supportedprotocols - {b'tls1.0'} 108 assert supportedprotocols - {b'tls1.0', b'tls1.1'}
109 defaultminimumprotocol = b'tls1.1' 109 defaultminimumprotocol = b'tls1.2'
110 110
111 key = b'minimumprotocol' 111 key = b'minimumprotocol'
112 minimumprotocol = ui.config(b'hostsecurity', key, defaultminimumprotocol) 112 minimumprotocol = ui.config(b'hostsecurity', key, defaultminimumprotocol)
113 validateprotocol(minimumprotocol, key) 113 validateprotocol(minimumprotocol, key)
114 114