Skip to content

Commit 65a0c46

Browse files
authored
Use patched certifi bundle for release mirroring (#189)
## Summary The [eMudhra incident](https://emudhra.we-have-a-problem.com/) compromised intermediate CA keys that could be used to impersonate HTTPS sites. This PR updates `certifi` to an updated version and uses the custom `PoolManager` approach recommended by the [urllib docs](https://urllib3.readthedocs.io/en/stable/user-guide.html#certificate-verification), at Codex's suggestion.
1 parent 0919ea4 commit 65a0c46

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎mirror.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# /// script
22
# requires-python = ">=3.12"
33
# dependencies = [
4+
# "certifi==2026.10.19",
45
# "packaging==23.1",
56
# "urllib3==2.0.5",
67
# ]
@@ -13,6 +14,7 @@
1314
import typing
1415
from pathlib import Path
1516

17+
import certifi
1618
import urllib3
1719
from packaging.requirements import Requirement
1820
from packaging.version import Version
@@ -37,7 +39,8 @@ def main():
3739

3840

3941
def get_all_versions() -> list[Version]:
40-
response = urllib3.request("GET", "https://pypi.org/pypi/ruff/json")
42+
http = urllib3.PoolManager(ca_certs=certifi.where())
43+
response = http.request("GET", "https://pypi.org/pypi/ruff/json")
4144
if response.status != 200:
4245
raise RuntimeError("Failed to fetch versions from pypi")
4346

0 commit comments

Comments
 (0)