Mercurial > hg
annotate mercurial/typelib.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 | 82e2c99c84f3 |
children |
rev | line source |
---|---|
49793
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
1 # typelib.py - type hint aliases and support |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
2 # |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
3 # Copyright 2022 Matt Harbison <matt_harbison@yahoo.com> |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
4 # |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
7 |
51864
1c5810ce737e
typing: add `from __future__ import annotations` to remaining source files
Matt Harbison <matt_harbison@yahoo.com>
parents:
51732
diff
changeset
|
8 from __future__ import annotations |
1c5810ce737e
typing: add `from __future__ import annotations` to remaining source files
Matt Harbison <matt_harbison@yahoo.com>
parents:
51732
diff
changeset
|
9 |
49793
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
10 import typing |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
11 |
51732
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
12 from typing import ( |
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
13 Callable, |
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
14 ) |
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
15 |
49793
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
16 # Note: this is slightly different from pycompat.TYPE_CHECKING, as using |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
17 # pycompat causes the BinaryIO_Proxy type to be resolved to ``object`` when |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
18 # used as the base class during a pytype run. |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
19 TYPE_CHECKING = typing.TYPE_CHECKING |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
20 |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
21 |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
22 # The BinaryIO class provides empty methods, which at runtime means that |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
23 # ``__getattr__`` on the proxy classes won't get called for the methods that |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
24 # should delegate to the internal object. So to avoid runtime changes because |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
25 # of the required typing inheritance, just use BinaryIO when typechecking, and |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
26 # ``object`` otherwise. |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
27 if TYPE_CHECKING: |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
28 from typing import ( |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
29 BinaryIO, |
51716
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
30 Union, |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
31 ) |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
32 |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
33 from . import ( |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
34 node, |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
35 posix, |
52102
82e2c99c84f3
cachestat: avoid creating cachestat for http path
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
51864
diff
changeset
|
36 util, |
51716
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
37 windows, |
49793
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
38 ) |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
39 |
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
40 BinaryIO_Proxy = BinaryIO |
52102
82e2c99c84f3
cachestat: avoid creating cachestat for http path
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
51864
diff
changeset
|
41 CacheStat = Union[ |
82e2c99c84f3
cachestat: avoid creating cachestat for http path
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
51864
diff
changeset
|
42 posix.cachestat, |
82e2c99c84f3
cachestat: avoid creating cachestat for http path
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
51864
diff
changeset
|
43 windows.cachestat, |
82e2c99c84f3
cachestat: avoid creating cachestat for http path
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
51864
diff
changeset
|
44 util.uncacheable_cachestat, |
82e2c99c84f3
cachestat: avoid creating cachestat for http path
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
51864
diff
changeset
|
45 ] |
51716
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
46 NodeConstants = node.sha1nodeconstants |
49793
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
47 else: |
51716
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
48 from typing import Any |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
49 |
49793
8147abc05794
pytype: stop excluding mercurial/ui.py
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
50 BinaryIO_Proxy = object |
51716
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
51 CacheStat = Any |
f3b34386d3e0
typing: add type hints to `mercurial.dirstatemap`
Matt Harbison <matt_harbison@yahoo.com>
parents:
49793
diff
changeset
|
52 NodeConstants = Any |
51732
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
53 |
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
54 # scmutil.getuipathfn() related callback. |
43460c311c0c
typing: add trivial type hints to `mercurial.scmutil`
Matt Harbison <matt_harbison@yahoo.com>
parents:
51716
diff
changeset
|
55 UiPathFn = Callable[[bytes], bytes] |