Skip to content

pipenv: use cacert bundle instead of vendored CA bundle - #578553

Merged
SuperSandro2000 merged 1 commit into
NixOS:masterfrom
irgolic:cacert/pipenv
Oct 27, 2026
Merged

SuperSandro2000 merged 1 commit into
NixOS:masterfrom
irgolic:cacert/pipenv

Conversation

@irgolic

@irgolic irgolic commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

pipenv bundles a changed copy of pip 26.0.1 in pipenv/patched/pip. That copy has certifi 2026.1.4, with the file pip/_vendor/certifi/cacert.pem. The bundled pip reads this file for each HTTPS connection, also when it uses truststore. The file has 136 certificates. 13 of them are not in cacert, and 10 are in cacert but not for TLS. The file contains the root emSign ECC Root CA - G3. This change replaces the file with a symlink to ${cacert}/etc/ssl/certs/ca-bundle.crt in postInstall. The rm command stops the build when a new version moves the file.

Note

AI Disclosure: Claude Code made the code change, the commit message and the first version of this pull request description, with patchix. Claude Code used Claude Opus 5.5. This pull request description is written in ASD-STE100 (Simplified Technical English), examined with memelint in strict mode. As the automation/AI policy requires, I established confidence in this output: by manual review of the code change and of this description, and with the verification tooling that this description discloses.

Test

nix-cacert-harness examines the package before and after this change. A local copy of nixpkgs is not necessary.

nix run github:irgolic/nix-cacert-harness -- pipenv --pr 578553 --emudhra
Output of harness: pipenv
[1/2] static check + eMudhra chains: offline, reproducible
base (before) = dac5e22db3ed2be013da0eba8050c05140bd3f30
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR pipenv
before: dac5e22db3ed2be013da0eba8050c05140bd3f30   after: worktree <worktree>
before ok (0 built, 1s)
        drv /nix/store/hb5dx6k4wn3pv6a8y27fhkxlf29i8p3g-pipenv-2026.5.1.drv
after  ok (0 built, 1s)
        drv /nix/store/r4xfsdjjizki6rhqx0r275lxf6h3d8nn-pipenv-2026.5.1.drv

| output:path | before | after |
|---|---|---|
| out:/lib/python3.14/site-packages/pipenv/patched/pip/_vendor/certifi/cacert.pem | pem 136 certs: 13 not in cacert, 10 in cacert but not for TLS, 5 cacert TLS roots missing; scanner: ECC G3 | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

inside archives (scanner only; a symlink in the installed output cannot reach them, issue #576542 class):
  before dist:/pipenv-2026.5.1-py3-none-any.whl!pipenv/patched/pip/_vendor/certifi/cacert.pem  roots=133 trusts emSign ECC Root CA - C3,emSign ECC Root CA - G3,emSign Root CA - C1,emSign Root CA - G1
  after  dist:/pipenv-2026.5.1-py3-none-any.whl!pipenv/patched/pip/_vendor/certifi/cacert.pem  roots=133 trusts emSign ECC Root CA - C3,emSign ECC Root CA - G3,emSign Root CA - C1,emSign Root CA - G1

cacert in runtime closure (before): yes
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (23 total), e.g.:
  - C=IN, OU=emSign PKI, O=eMudhra Technologies Limited, CN=emSign ECC Root CA - G3
  - C=US, OU=emSign PKI, O=eMudhra Inc, CN=emSign ECC Root CA - C3
  - C=US, OU=emSign PKI, O=eMudhra Inc, CN=emSign Root CA - C1
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=CH, O=SwissSign AG, CN=SwissSign Gold CA - G2
  - C=ES, O=Firmaprofesional SA, CN=FIRMAPROFESIONAL CA ROOT-A WEB
  - C=FR, O=Dhimyotis, CN=Certigna
  - C=GB, O=COMODO CA Limited, CN=COMODO Certification Authority
VERDICT pipenv: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs (+ bundles inside archives remain, see above)

eMudhra chains (--emudhra; offline and reproducible): the 14 chains in fixtures/emudhra,
each leaf verified against each store (openssl verify -purpose sslserver, at 2026-10-23):
| output:path | before | after |
|---|---|---|
| out:/lib/python3.14/site-packages/pipenv/patched/pip/_vendor/certifi/cacert.pem | pem: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) | symlink->cacert:ca-bundle.crt pem: accepted 0/14 |
inside archives (zip members, extracted):
| dist:/pipenv-2026.5.1-py3-none-any.whl!pipenv/patched/pip/_vendor/certifi/cacert.pem | pem: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) | pem: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) |
VERDICT pipenv emudhra: FIXED: before accepted 7/14 compromised eMudhra chains (g3: 7/7, aaa: 0/7, noct: 1/2); after 0/14 (+ after-side archive members accept 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2), see table)

[2/2] live eMudhra test hosts: needs network, NOT reproducible offline
(no shims/pipenv.{nix,sh} or shims/live/pipenv.{nix,sh}: live check skipped)

Before the change, the bundled file accepts 7 of the 14 eMudhra chains. It accepts 7 of 7 for emSign ECC Root CA - G3 and 0 of 7 for AAA Certificate Services. After the change, the file is a symlink to the cacert bundle, and it accepts none of the 14 chains. The harness did not do the live test, because it has no shim for pipenv. The dist output keeps the wheel with the bundled file. pipenv does not read that wheel.

Things done

@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 24, 2026
@irgolic
irgolic marked this pull request as draft October 24, 2026 22:47
Assisted-by: Claude Code (Claude Opus 5.5) with patchix
@irgolic
irgolic marked this pull request as ready for review October 24, 2026 22:53
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. llm-assisted Contributions that include code generation with LLMs 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! labels Oct 24, 2026
@SuperSandroBot

Copy link
Copy Markdown

✅ nixpkgs-review result

Generated using nixpkgs-review-gha (b97195b)

Command: nixpkgs-review pr 578553
Commit: 8c8f6f6ac16c27ff7e0370099cc73f430230b713 (subsequent changes)
Merge: 0c2687f144d281b50451e91275bfef04206a02ad

Logs: https://github.com/SuperSandro2000/nixpkgs-review-gha/actions/runs/40537697189/attempts/1


x86_64-linux

✅ 1 package built:
  • pipenv

aarch64-linux

✅ 1 package built:
  • pipenv

aarch64-darwin (sandbox = relaxed)

✅ 1 package built:
  • pipenv

@SuperSandro2000
SuperSandro2000 added this pull request to the merge queue Oct 27, 2026
Merged via the queue into NixOS:master with commit c57a028 Oct 27, 2026
34 checks passed

@dotlambda dotlambda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuperSandro2000

Copy link
Copy Markdown
Member

Good question

Also I am not sure either if it is feasible if they did no modifications to just devendor things.

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

Labels

1.severity: security Issues which raise a security issue, or PRs that fix one 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants