mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #17997: Change behavior of `ssl.match_hostname()
` to follow RFC 6125,
for security reasons. It now doesn't match multiple wildcards nor wildcards inside IDN fragments.
This commit is contained in:
parent
ca580f4ec1
commit
72c98d3a76
4 changed files with 97 additions and 32 deletions
|
@ -283,10 +283,10 @@ Certificate handling
|
|||
Verify that *cert* (in decoded format as returned by
|
||||
:meth:`SSLSocket.getpeercert`) matches the given *hostname*. The rules
|
||||
applied are those for checking the identity of HTTPS servers as outlined
|
||||
in :rfc:`2818`, except that IP addresses are not currently supported.
|
||||
In addition to HTTPS, this function should be suitable for checking the
|
||||
identity of servers in various SSL-based protocols such as FTPS, IMAPS,
|
||||
POPS and others.
|
||||
in :rfc:`2818` and :rfc:`6125`, except that IP addresses are not currently
|
||||
supported. In addition to HTTPS, this function should be suitable for
|
||||
checking the identity of servers in various SSL-based protocols such as
|
||||
FTPS, IMAPS, POPS and others.
|
||||
|
||||
:exc:`CertificateError` is raised on failure. On success, the function
|
||||
returns nothing::
|
||||
|
@ -301,6 +301,13 @@ Certificate handling
|
|||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
.. versionchanged:: 3.3.3
|
||||
The function now follows :rfc:`6125`, section 6.4.3 and does neither
|
||||
match multiple wildcards (e.g. ``*.*.com`` or ``*a*.example.org``) nor
|
||||
a wildcard inside an internationalized domain names (IDN) fragment.
|
||||
IDN A-labels such as ``www*.xn--pthon-kva.org`` are still supported,
|
||||
but ``x*.python.org`` no longer matches ``xn--tda.python.org``.
|
||||
|
||||
.. function:: cert_time_to_seconds(timestring)
|
||||
|
||||
Returns a floating-point value containing a normal seconds-after-the-epoch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue