Skip to content

python3Packages.grpcio: link vendored roots.pem to cacert - #576514

Merged
zimbatm merged 1 commit into
NixOS:stagingfrom
zimbatm:cacert-grpc
Nov 5, 2026
Merged

zimbatm merged 1 commit into
NixOS:stagingfrom
zimbatm:cacert-grpc

Conversation

@zimbatm

@zimbatm zimbatm commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

python3Packages.grpcio sets a root-certificate callback that returns its vendored roots.pem. That callback comes before the system roots in gRPC core, so grpcio always trusted its own copy of the Mozilla roots (with emSign ECC Root CA - G3) and never got cacert updates. Link the vendored file to the cacert bundle.

The grpc C core is not changed: on NixOS it already uses /etc/ssl/certs/ca-certificates.crt and never reads share/grpc/roots.pem.

Tested on x86_64-linux: the scanner finds no vendored bundle, a TLS handshake to pubsub.googleapis.com:443 with the default ssl_channel_credentials() works, and with GRPC_DEFAULT_SSL_ROOTS_FILE_PATH set to a bundle without the needed root it fails.

Related to: #576485
Related to: #576541

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

Things done

@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-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. 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 20, 2026
grpcio sets a roots override callback. The callback returns the
vendored grpc/_cython/_credentials/roots.pem. gRPC core calls it before
it tries the system trust store, so grpcio always uses the vendored
copy. That copy does not get cacert updates. It still contains
emSign ECC Root CA - G3, for example.

Replace the vendored file with a link to the cacert bundle, so that
a cacert update also updates the grpcio trust store.
GRPC_DEFAULT_SSL_ROOTS_FILE_PATH still overrides it.

Assisted-by: Claude Code (claude-opus-5)
@zimbatm zimbatm changed the title grpc: eMudhra fixes python3Packages.grpcio: link vendored roots.pem to cacert Oct 20, 2026
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. and removed 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. labels Oct 20, 2026
@zimbatm zimbatm added the backport staging-26.05 Backport PR automatically label Oct 20, 2026
@zimbatm
zimbatm added this pull request to the merge queue Nov 5, 2026
Merged via the queue into NixOS:staging with commit d9f6a36 Nov 5, 2026
33 checks passed
@zimbatm
zimbatm deleted the cacert-grpc branch November 5, 2026 12:21
@nixpkgs-ci

nixpkgs-ci Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for staging-26.05:

@github-actions github-actions Bot added the 8.has: port to stable This PR already has a backport to the stable release. label Nov 5, 2026
@Skyb0rg007

Copy link
Copy Markdown
Contributor

That callback comes before the system roots in gRPC core ... Link the vendored file to the cacert bundle.

This seems like the wrong fix for nixpkgs. If another eMudhra incident happens, the package would would then trust the revoked certificate even if the system was properly updated (ex. with security.pki.caCertificateBlacklist). Shouldn't the callback just be skipped?

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. 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 8.has: port to stable This PR already has a backport to the stable release. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely 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: 2501-5000 This PR causes many rebuilds on Linux and should 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