Skip to content

python3Packages.raven: use cacert bundle instead of vendored CA file - #577134

Merged
pbsds merged 1 commit into
NixOS:masterfrom
irgolic:cacert/python3Packages.raven
Oct 24, 2026
Merged

pbsds merged 1 commit into
NixOS:masterfrom
irgolic:cacert/python3Packages.raven

Conversation

@irgolic

@irgolic irgolic commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

raven has a bundled CA file, raven/data/cacert.pem. raven uses this file for HTTPS connections when it cannot import certifi. This change replaces the installed file with a symlink to the ca-bundle.crt file of cacert in postFixup. Thus, the installed file is a symlink to cacert, and replaceDependencies can replace cacert. The wheel in the dist output keeps the bundled file (#576542).

Warning

AI Disclosure: Claude Code made the code change, the commit message and the first version of this pull request description. Claude Code used Claude Fable 5.1 and Claude Opus 5.5. I examined all of this work. Claude Code also wrote all of nix-cacert-harness. This pull request description is written in ASD-STE100 (Simplified Technical English), examined with memelint in strict mode.

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 -- python3Packages.raven --pr <this PR>
Harness output: python3Packages.raven
$ nix run github:irgolic/nix-cacert-harness -- python3Packages.raven --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/d1ba4d092b353ee8717262e3f23ccbc8e917c765
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR python3Packages.raven
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/d1ba4d092b353ee8717262e3f23ccbc8e917c765
before ok (0 built, 1s)
        drv /nix/store/…-python3.14-raven-6.10.0.drv
after  ok (0 built, 0s)
        drv /nix/store/…-python3.14-raven-6.10.0.drv

| output:path | before | after |
|---|---|---|
| out:/lib/python3.14/site-packages/raven/data/cacert.pem | pem 155 certs: 94 not in cacert, 19 in cacert but not for TLS, 76 cacert TLS roots missing; scanner: AAA | 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:/raven-6.10.0-py2.py3-none-any.whl!raven/data/cacert.pem  roots=107 trusts AAA Certificate Services
  after  dist:/raven-6.10.0-py2.py3-none-any.whl!raven/data/cacert.pem  roots=107 trusts AAA Certificate Services

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (113 total), e.g.:
  - C=GB, O=Comodo CA Limited, CN=AAA Certificate Services
  - C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority
  - C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1
  - C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 2
VERDICT python3Packages.raven: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs (+ bundles inside archives remain, see above)

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/python3Packages.raven.nix
  package derivations to build for the matrix: 1 python3.14-raven-6.10.0.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-python3Packages-raven-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-python3Packages-raven-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-python3Packages-raven-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-python3Packages-raven-test

python3Packages.raven  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/d1ba4d092b353ee8717262e3f23ccbc8e917c765)
         | stock cacert | + test root  | override with test-root cacert
before   | REFUSED      | REFUSED      | NO-OP (package does not take cacert)
after    | REFUSED      | CONNECTED    | yes (rebuilt with cacert + test root)
control (before cells): curl --cacert test-root: CONNECTED, curl --cacert stock: REFUSED
VERDICT python3Packages.raven: PASS: after-fix trust follows cacert; before-fix ignores it

In the second part of the output, the harness adds a temporary test root to cacert and builds the package again. Then raven sends a request to a local openssl s_server from a Python environment without certifi. The certificate of this server chains to the test root. Before this change, cacert has no effect on the result. After this change, it has an effect. To examine the server certificate, raven uses ssl.wrap_socket, but Python 3.12 removed this function. Thus, with Python 3.12 and higher, HTTPS requests from raven stop before TLS starts, with or without this change. The test adds an equivalent function to examine the trust store. This problem is in raven upstream and is not related to this change.

Things done

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5)
@zimbatm zimbatm mentioned this pull request Oct 22, 2026
66 of 95 tasks
@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. 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! 6.topic: python Python is a high-level, general-purpose programming language. labels Oct 22, 2026
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 22, 2026
@irgolic
irgolic force-pushed the cacert/python3Packages.raven branch from bdcce49 to d1ba4d0 Compare October 22, 2026 11:58
@fabaff

fabaff commented Oct 24, 2026

Copy link
Copy Markdown
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 577134
Commit: d1ba4d092b353ee8717262e3f23ccbc8e917c765


x86_64-linux

✅ 3 packages built:
  • python313Packages.raven
  • python314Packages.raven
  • kcc

@pbsds
pbsds added this pull request to the merge queue Oct 24, 2026
Merged via the queue into NixOS:master with commit ab2c74b Oct 24, 2026
28 checks passed
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 6.topic: python Python is a high-level, general-purpose programming language. 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-linux: 1-10 This PR causes between 1 and 10 packages 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.

3 participants