Skip to content

Commit edc3ddb

Browse files
authored
Release 1.25.5 (urllib3#1685)
1 parent 7e856c0 commit edc3ddb

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changes
22
=======
33

4+
1.25.5 (2019-09-19)
5+
-------------------
6+
7+
* Add mitigation for BPO-37428 affecting Python <3.7.4 and OpenSSL 1.1.1+ which
8+
caused certificate verification to be enabled when using ``cert_reqs=CERT_NONE``.
9+
(Issue #1682)
10+
11+
412
1.25.4 (2019-09-19)
513
-------------------
614

src/urllib3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
__author__ = "Andrey Petrov ([email protected])"
2424
__license__ = "MIT"
25-
__version__ = "1.25.4"
25+
__version__ = "1.25.5"
2626

2727
__all__ = (
2828
"HTTPConnectionPool",

src/urllib3/util/ssl_.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import errno
33
import warnings
44
import hmac
5+
import sys
56

67
from binascii import hexlify, unhexlify
78
from hashlib import md5, sha1, sha256
@@ -274,8 +275,12 @@ def create_urllib3_context(
274275
# Enable post-handshake authentication for TLS 1.3, see GH #1634. PHA is
275276
# necessary for conditional client cert authentication with TLS 1.3.
276277
# The attribute is None for OpenSSL <= 1.1.0 or does not exist in older
277-
# versions of Python.
278-
if getattr(context, "post_handshake_auth", None) is not None:
278+
# versions of Python. We only enable on Python 3.7.4+ or if certificate
279+
# verification is enabled to work around Python issue #37428
280+
# See: https://bugs.python.org/issue37428
281+
if (cert_reqs == ssl.CERT_REQUIRED or sys.version_info >= (3, 7, 4)) and getattr(
282+
context, "post_handshake_auth", None
283+
) is not None:
279284
context.post_handshake_auth = True
280285

281286
context.verify_mode = cert_reqs

0 commit comments

Comments
 (0)