Skip to content

Commit 1fcc3ce

Browse files
authored
Merge pull request #11514 from pradyunsg/certifi-update
Update certifi and replace complex certifi patch with a more targetted requests patch
2 parents 739158c + 65c23fa commit 1fcc3ce

File tree

9 files changed

+170
-94
lines changed

9 files changed

+170
-94
lines changed

news/certifi.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade certifi to 2022.9.24

src/pip/_vendor/certifi/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011#
66
This is a bundle of X.509 certificates of public Certificate Authorities
77
(CA). These were automatically extracted from Mozilla's root certificates
88
file (certdata.txt). This file can be found in the mozilla source tree:
9-
http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1#
9+
https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt
1010
It contains the certificates in PEM format and therefore
1111
can be directly used with curl / libcurl / php_curl, or with
1212
an Apache+mod_ssl webserver for SSL client authentication.

src/pip/_vendor/certifi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .core import contents, where
22

33
__all__ = ["contents", "where"]
4-
__version__ = "2022.06.15"
4+
__version__ = "2022.09.24"

src/pip/_vendor/certifi/cacert.pem

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,45 +1323,6 @@ t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy
13231323
SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
13241324
-----END CERTIFICATE-----
13251325

1326-
# Issuer: CN=EC-ACC O=Agencia Catalana de Certificacio (NIF Q-0801176-I) OU=Serveis Publics de Certificacio/Vegeu https://www.catcert.net/verarrel (c)03/Jerarquia Entitats de Certificacio Catalanes
1327-
# Subject: CN=EC-ACC O=Agencia Catalana de Certificacio (NIF Q-0801176-I) OU=Serveis Publics de Certificacio/Vegeu https://www.catcert.net/verarrel (c)03/Jerarquia Entitats de Certificacio Catalanes
1328-
# Label: "EC-ACC"
1329-
# Serial: -23701579247955709139626555126524820479
1330-
# MD5 Fingerprint: eb:f5:9d:29:0d:61:f9:42:1f:7c:c2:ba:6d:e3:15:09
1331-
# SHA1 Fingerprint: 28:90:3a:63:5b:52:80:fa:e6:77:4c:0b:6d:a7:d6:ba:a6:4a:f2:e8
1332-
# SHA256 Fingerprint: 88:49:7f:01:60:2f:31:54:24:6a:e2:8c:4d:5a:ef:10:f1:d8:7e:bb:76:62:6f:4a:e0:b7:f9:5b:a7:96:87:99
1333-
-----BEGIN CERTIFICATE-----
1334-
MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB
1335-
8zELMAkGA1UEBhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2Vy
1336-
dGlmaWNhY2lvIChOSUYgUS0wODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1
1337-
YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYDVQQLEyxWZWdldSBodHRwczovL3d3
1338-
dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UECxMsSmVyYXJxdWlh
1339-
IEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMTBkVD
1340-
LUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQG
1341-
EwJFUzE7MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8g
1342-
KE5JRiBRLTA4MDExNzYtSSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBD
1343-
Z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Tv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNaAl6k
1359-
SBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhy
1360-
Rp/7SNVel+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOS
1361-
Agu+TGbrIP65y7WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xl
1362-
nJ2lYJU6Un/10asIbvPuW/mIPX64b24D5EI=
1363-
-----END CERTIFICATE-----
1364-
13651326
# Issuer: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967
13661327
# Subject: CN=Actalis Authentication Root CA O=Actalis S.p.A./03358520967
13671328
# Label: "Actalis Authentication Root CA"
@@ -4683,3 +4644,65 @@ ADBmAjEA5gVYaWHlLcoNy/EZCL3W/VGSGn5jVASQkZo1kTmZ+gepZpO6yGjUij/6
46834644
7W4WAie3AjEA3VoXK3YdZUKWpqxdinlW2Iob35reX8dQj7FbcQwm32pAAOwzkSFx
46844645
vmjkI6TZraE3
46854646
-----END CERTIFICATE-----
4647+
4648+
# Issuer: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD.
4649+
# Subject: CN=Security Communication RootCA3 O=SECOM Trust Systems CO.,LTD.
4650+
# Label: "Security Communication RootCA3"
4651+
# Serial: 16247922307909811815
4652+
# MD5 Fingerprint: 1c:9a:16:ff:9e:5c:e0:4d:8a:14:01:f4:35:5d:29:26
4653+
# SHA1 Fingerprint: c3:03:c8:22:74:92:e5:61:a2:9c:5f:79:91:2b:1e:44:13:91:30:3a
4654+
# SHA256 Fingerprint: 24:a5:5c:2a:b0:51:44:2d:06:17:76:65:41:23:9a:4a:d0:32:d7:c5:51:75:aa:34:ff:de:2f:bc:4f:5c:52:94
4655+
-----BEGIN CERTIFICATE-----
4656+
MIIFfzCCA2egAwIBAgIJAOF8N0D9G/5nMA0GCSqGSIb3DQEBD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JYosQLTA70lUhw0Zk8jq/R3gpYd0VcwCBEF/VfR2ccCAwEAAaNCMEAw
4673+
HQYDVR0OBBYEFGQUfPxYchamCik0FW8qy7z8r6irMA4GA1UdDwEB/wQEAwIBBjAP
4674+
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDAUAA4ICAQDcAiMI4u8hOscNtybS
4675+
YpOnpSNyByCCYN8Y11StaSWSntkUz5m5UoHPrmyKO1o5yGwBQ8IibQLwYs1OY0PA
4676+
FNr0Y/Dq9HHuTofjcan0yVflLl8cebsjqodEV+m9NU1Bu0soo5iyG9kLFwfl9+qd
4677+
9XbXv8S2gVj/yP9kaWJ5rW4OH3/uHWnlt3Jxs/6lATWUVCvAUm2PVcTJ0rjLyjQI
4678+
UYWg9by0F1jqClx6vWPGOi//lkkZhOpn2ASxYfQAW0q3nHE3GYV5v4GwxxMOdnE+
4679+
OoAGrgYWp421wsTL/0ClXI2lyTrtcoHKXJg80jQDdwj98ClZXSEIx2C/pHF7uNke
4680+
gr4Jr2VvKKu/S7XuPghHJ6APbw+LP6yVGPO5DtxnVW5inkYO0QR4ynKudtml+LLf
4681+
iAlhi+8kTtFZP1rUPcmTPCtk9YENFpb3ksP+MW/oKjJ0DvRMmEoYDjBU1cXrvMUV
4682+
nuiZIesnKwkK2/HmcBhWuwzkvvnoEKQTkrgc4NtnHVMDpCKn3F2SEDzq//wbEBrD
4683+
2NCcnWXL0CsnMQMeNuE9dnUM/0Umud1RvCPHX9jYhxBAEg09ODfnRDwYwFMJZI//
4684+
1ZqmfHAuc1Uh6N//g7kdPjIe1qZ9LPFm6Vwdp6POXiUyK+OVrCoHzrQoeIY8Laad
4685+
TdJ0MN1kURXbg4NR16/9M51NZg==
4686+
-----END CERTIFICATE-----
4687+
4688+
# Issuer: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD.
4689+
# Subject: CN=Security Communication ECC RootCA1 O=SECOM Trust Systems CO.,LTD.
4690+
# Label: "Security Communication ECC RootCA1"
4691+
# Serial: 15446673492073852651
4692+
# MD5 Fingerprint: 7e:43:b0:92:68:ec:05:43:4c:98:ab:5d:35:2e:7e:86
4693+
# SHA1 Fingerprint: b8:0e:26:a9:bf:d2:b2:3b:c0:ef:46:c9:ba:c7:bb:f6:1d:0d:41:41
4694+
# SHA256 Fingerprint: e7:4f:bd:a5:5b:d5:64:c4:73:a3:6b:44:1a:a7:99:c8:a6:8e:07:74:40:e8:28:8b:9f:a1:e5:0e:4b:ba:ca:11
4695+
-----BEGIN CERTIFICATE-----
4696+
MIICODCCAb6gAwIBAgIJANZdm7N4gS7rMAoGCCqGSM49BAMDMGExCzAJBgNVBAYT
4697+
AkpQMSUwIwYDVQQKExxTRUNPTSBUcnVzdCBTeXN0ZW1zIENPLixMVEQuMSswKQYD
4698+
VQQDEyJTZWN1cml0eSBDb21tdW5pY2F0aW9uIEVDQyBSb290Q0ExMB4XDTE2MDYx
4699+
NjA1MTUyOFoXDTM4MDExODA1MTUyOFowYTELMAkGA1UEBhMCSlAxJTAjBgNVBAoT
4700+
HFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKzApBgNVBAMTIlNlY3VyaXR5
4701+
IENvbW11bmljYXRpb24gRUNDIFJvb3RDQTEwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
4702+
AASkpW9gAwPDvTH00xecK4R1rOX9PVdu12O/5gSJko6BnOPpR27KkBLIE+Cnnfdl
4703+
dB9sELLo5OnvbYUymUSxXv3MdhDYW72ixvnWQuRXdtyQwjWpS4g8EkdtXP9JTxpK
4704+
ULGjQjBAMB0GA1UdDgQWBBSGHOf+LaVKiwj+KBH6vqNm+GBZLzAOBgNVHQ8BAf8E
4705+
BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjAVXUI9/Lbu
4706+
9zuxNuie9sRGKEkz0FhDKmMpzE2xtHqiuQ04pV1IKv3LsnNdo4gIxwwCMQDAqy0O
4707+
be0YottT6SXbVQjgUMzfRGEWgqtJsLKB7HOHeLRMsmIbEvoWTSVLY70eN9k=
4708+
-----END CERTIFICATE-----

src/pip/_vendor/certifi/core.py

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,12 @@
44
55
This module returns the installation location of cacert.pem or its contents.
66
"""
7-
import os
8-
import types
9-
from typing import Union
7+
import sys
108

119

12-
class _PipPatchedCertificate(Exception):
13-
pass
10+
if sys.version_info >= (3, 11):
1411

15-
16-
try:
17-
# Return a certificate file on disk for a standalone pip zipapp running in
18-
# an isolated build environment to use. Passing --cert to the standalone
19-
# pip does not work since requests calls where() unconditionally on import.
20-
_PIP_STANDALONE_CERT = os.environ.get("_PIP_STANDALONE_CERT")
21-
if _PIP_STANDALONE_CERT:
22-
def where():
23-
return _PIP_STANDALONE_CERT
24-
raise _PipPatchedCertificate()
25-
26-
from importlib.resources import path as get_path, read_text
12+
from importlib.resources import as_file, files
2713

2814
_CACERT_CTX = None
2915
_CACERT_PATH = None
@@ -47,15 +33,54 @@ def where() -> str:
4733
# We also have to hold onto the actual context manager, because
4834
# it will do the cleanup whenever it gets garbage collected, so
4935
# we will also store that at the global level as well.
36+
_CACERT_CTX = as_file(files("pip._vendor.certifi").joinpath("cacert.pem"))
37+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
38+
39+
return _CACERT_PATH
40+
41+
def contents() -> str:
42+
return files("pip._vendor.certifi").joinpath("cacert.pem").read_text(encoding="ascii")
43+
44+
elif sys.version_info >= (3, 7):
45+
46+
from importlib.resources import path as get_path, read_text
47+
48+
_CACERT_CTX = None
49+
_CACERT_PATH = None
50+
51+
def where() -> str:
52+
# This is slightly terrible, but we want to delay extracting the
53+
# file in cases where we're inside of a zipimport situation until
54+
# someone actually calls where(), but we don't want to re-extract
55+
# the file on every call of where(), so we'll do it once then store
56+
# it in a global variable.
57+
global _CACERT_CTX
58+
global _CACERT_PATH
59+
if _CACERT_PATH is None:
60+
# This is slightly janky, the importlib.resources API wants you
61+
# to manage the cleanup of this file, so it doesn't actually
62+
# return a path, it returns a context manager that will give
63+
# you the path when you enter it and will do any cleanup when
64+
# you leave it. In the common case of not needing a temporary
65+
# file, it will just return the file system location and the
66+
# __exit__() is a no-op.
67+
#
68+
# We also have to hold onto the actual context manager, because
69+
# it will do the cleanup whenever it gets garbage collected, so
70+
# we will also store that at the global level as well.
5071
_CACERT_CTX = get_path("pip._vendor.certifi", "cacert.pem")
5172
_CACERT_PATH = str(_CACERT_CTX.__enter__())
5273

5374
return _CACERT_PATH
5475

55-
except _PipPatchedCertificate:
56-
pass
76+
def contents() -> str:
77+
return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii")
78+
79+
else:
80+
import os
81+
import types
82+
from typing import Union
5783

58-
except ImportError:
5984
Package = Union[types.ModuleType, str]
6085
Resource = Union[str, "os.PathLike"]
6186

@@ -79,6 +104,5 @@ def where() -> str:
79104

80105
return os.path.join(f, "cacert.pem")
81106

82-
83-
def contents() -> str:
84-
return read_text("certifi", "cacert.pem", encoding="ascii")
107+
def contents() -> str:
108+
return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii")

src/pip/_vendor/requests/certs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
environment, you can change the definition of where() to return a separately
1212
packaged CA bundle.
1313
"""
14-
from pip._vendor.certifi import where
14+
15+
import os
16+
17+
if "_PIP_STANDALONE_CERT" not in os.environ:
18+
from pip._vendor.certifi import where
19+
else:
20+
def where():
21+
return os.environ["_PIP_STANDALONE_CERT"]
1522

1623
if __name__ == "__main__":
1724
print(where())

src/pip/_vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pep517==0.13.0
88
platformdirs==2.5.2
99
pyparsing==3.0.9
1010
requests==2.28.1
11-
certifi==2022.06.15
11+
certifi==2022.09.24
1212
chardet==5.0.0
1313
idna==3.4
1414
urllib3==1.26.12

tools/vendoring/patches/certifi.patch

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
2-
index 497d938..f34045b 100644
2+
index de028981b..c3e546604 100644
33
--- a/src/pip/_vendor/certifi/core.py
44
+++ b/src/pip/_vendor/certifi/core.py
5-
@@ -8,7 +8,21 @@ import os
6-
import types
7-
from typing import Union
8-
9-
+
10-
+class _PipPatchedCertificate(Exception):
11-
+ pass
12-
+
13-
+
14-
try:
15-
+ # Return a certificate file on disk for a standalone pip zipapp running in
16-
+ # an isolated build environment to use. Passing --cert to the standalone
17-
+ # pip does not work since requests calls where() unconditionally on import.
18-
+ _PIP_STANDALONE_CERT = os.environ.get("_PIP_STANDALONE_CERT")
19-
+ if _PIP_STANDALONE_CERT:
20-
+ def where():
21-
+ return _PIP_STANDALONE_CERT
22-
+ raise _PipPatchedCertificate()
23-
+
24-
from importlib.resources import path as get_path, read_text
25-
26-
_CACERT_CTX = None
27-
@@ -33,11 +47,13 @@ try:
5+
@@ -33,13 +33,13 @@ def where() -> str:
6+
# We also have to hold onto the actual context manager, because
7+
# it will do the cleanup whenever it gets garbage collected, so
8+
# we will also store that at the global level as well.
9+
- _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
10+
+ _CACERT_CTX = as_file(files("pip._vendor.certifi").joinpath("cacert.pem"))
11+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
12+
13+
return _CACERT_PATH
14+
15+
def contents() -> str:
16+
- return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
17+
+ return files("pip._vendor.certifi").joinpath("cacert.pem").read_text(encoding="ascii")
18+
19+
elif sys.version_info >= (3, 7):
20+
21+
@@ -68,13 +68,13 @@ def where() -> str:
2822
# We also have to hold onto the actual context manager, because
2923
# it will do the cleanup whenever it gets garbage collected, so
3024
# we will also store that at the global level as well.
@@ -34,8 +28,15 @@ index 497d938..f34045b 100644
3428

3529
return _CACERT_PATH
3630

37-
+except _PipPatchedCertificate:
38-
+ pass
31+
def contents() -> str:
32+
- return read_text("certifi", "cacert.pem", encoding="ascii")
33+
+ return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii")
34+
35+
else:
36+
import os
37+
@@ -105,4 +105,4 @@ def where() -> str:
38+
return os.path.join(f, "cacert.pem")
3939

40-
except ImportError:
41-
Package = Union[types.ModuleType, str]
40+
def contents() -> str:
41+
- return read_text("certifi", "cacert.pem", encoding="ascii")
42+
+ return read_text("pip._vendor.certifi", "cacert.pem", encoding="ascii")

tools/vendoring/patches/requests.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,23 @@ index 8fbcd656..c5e9c19e 100644
123123

124124
try:
125125
import chardet
126+
diff --git a/src/pip/_vendor/requests/certs.py b/src/pip/_vendor/requests/certs.py
127+
index 2743144b9..38696a1fb 100644
128+
--- a/src/pip/_vendor/requests/certs.py
129+
+++ b/src/pip/_vendor/requests/certs.py
130+
@@ -11,7 +11,14 @@
131+
environment, you can change the definition of where() to return a separately
132+
packaged CA bundle.
133+
"""
134+
-from certifi import where
135+
+
136+
+import os
137+
+
138+
+if "_PIP_STANDALONE_CERT" not in os.environ:
139+
+ from certifi import where
140+
+else:
141+
+ def where():
142+
+ return os.environ["_PIP_STANDALONE_CERT"]
143+
144+
if __name__ == "__main__":
145+
print(where())

0 commit comments

Comments
 (0)