Skip to content

python3Packages.pip: make vendored certifi prefer the system CA bundle - #576525

Open
zimbatm wants to merge 1 commit into
NixOS:stagingfrom
zimbatm:cacert-python-pip
Open

zimbatm wants to merge 1 commit into
NixOS:stagingfrom
zimbatm:cacert-python-pip

Conversation

@zimbatm

@zimbatm zimbatm commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

pip adds the cacert.pem of its vendored certifi to the trust store next to the system store. Thus a cacert update alone does not remove a distrusted root (for example emSign ECC Root CA - G3) from pip.

Append an override to the vendored certifi so that where() and contents() return NIX_SSL_CERT_FILE, SSL_CERT_FILE or /etc/ssl/certs/ca-certificates.crt when one exists. The vendored bundle stays as a fallback.

The cpython ensurepip wheel uses the same pip-certifi-override.py: #576524

Tested on x86_64-linux (same diff on master): pip download six with SSL_CERT_FILE set to an unrelated self-signed cert fails, and with the system bundle it works. Before the change both worked, because pip also trusted its vendored bundle.

Related to: #576485
Related to: #576541

Assisted-by: Claude Code (claude-opus-5)

Things done

pip adds the cacert.pem of its vendored certifi to the trust store next
to the system store. Thus a cacert update alone does not remove a
distrusted root (for example emSign ECC Root CA - G3) from pip.

Append an override to the vendored certifi so that where() and
contents() return NIX_SSL_CERT_FILE, SSL_CERT_FILE or
/etc/ssl/certs/ca-certificates.crt when one exists. The vendored bundle
stays as a fallback. The cpython ensurepip wheel uses the same file.

Assisted-by: Claude Code (claude-opus-5)
@nixpkgs-ci
nixpkgs-ci Bot requested a review from mweinelt October 20, 2026 19:58
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. llm-assisted Contributions that include code generation with LLMs 6.topic: python Python is a high-level, general-purpose programming language. labels Oct 20, 2026
@zimbatm zimbatm added the backport staging-26.05 Backport PR automatically label Oct 20, 2026
@waltmck

waltmck commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

I would like to see this get merged. I added the roots of the compromised eMudhra intermediate certs to security.pki.caCertificateBlacklist, but I realize that this does not currently apply to Python apps like sabnzbd. This is unsafe default behavior for that module as currently written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. backport staging-26.05 Backport PR automatically llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants