Skip to content

uv: use only the system CA store - #576558

Merged
r-vdp merged 1 commit into
NixOS:masterfrom
zimbatm:cacert-uv
Oct 27, 2026
Merged

r-vdp merged 1 commit into
NixOS:masterfrom
zimbatm:cacert-uv

Conversation

@zimbatm

@zimbatm zimbatm commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Set UV_SYSTEM_CERTS=1 by default with a wrapper. uv then trusts the platform store (SSL_CERT_FILE, SSL_CERT_DIR or /etc/ssl/certs) through rustls-platform-verifier. It does not use the Mozilla roots that webpki-root-certs compiles into the binary. A cacert update now also updates the trust of uv. uvx runs the wrapped uv, so it gets the same setting. Users can still set UV_SYSTEM_CERTS=0 or use --no-system-certs.

Tested on x86_64-linux with uv pip install --dry-run requests against PyPI: with /etc/ssl and /etc/pki hidden (bwrap) and no SSL_CERT_FILE, the old uv still works through its bundled roots and the new one fails ("No CA certificates were loaded from the system"); with the system store both work. uvx behaves the same. python3Packages.uv uses the same binary.

Related to: #576485
Related to: #576544

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

Things done

Set UV_SYSTEM_CERTS=1 by default with a wrapper. uv then trusts the
platform store (SSL_CERT_FILE, SSL_CERT_DIR or /etc/ssl/certs) through
rustls-platform-verifier. It does not use the Mozilla roots that
webpki-root-certs compiles into the binary. A cacert update now also
updates the trust of uv. uvx runs the wrapped uv, so it gets the same
setting. Users can still set UV_SYSTEM_CERTS=0 or use --no-system-certs.

Part of NixOS#576544.

Assisted-by: Claude Code (claude-opus-5)
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". llm-assisted Contributions that include code generation with LLMs labels Oct 20, 2026
@hesiod

hesiod commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

see #576471 for prior work on uv

@bengsparks

bengsparks commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

I'm a little iffy on doing this.
I understand the motivation, and that we (in nixpkgs) primarily package uv for usage on nixos, but fact is that many people simple consume this package from a dev shell.
Are we sure that we want to change the default behaviour of THE package manager for Python for all systems, without so much as a changelog note?

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Oct 20, 2026
@bengsparks

Copy link
Copy Markdown
Contributor

Tbf, many operating systems that uv is run on will update the certs by themself as well, like we are doing now...

@GaetanLepage

Copy link
Copy Markdown
Contributor

Yes, I'm not entirely convinced either.
The most important is to have shipped a fixed version.

I'm not sure what is the common/SotA guideline for this kind of things in nixpkgs.

@zimbatm zimbatm added the backport release-26.05 Backport PR automatically label Oct 20, 2026
@bengsparks

bengsparks commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This will not backport. uv on 26.05 is at 11.x @zimbatm
EDIT: ah, it will. it's just the diff.

@bengsparks

Copy link
Copy Markdown
Contributor

Perhaps this change should only go to 26.05?

@bengsparks

Copy link
Copy Markdown
Contributor

#576587 for your consideration.

@zimbatm zimbatm removed the backport release-26.05 Backport PR automatically label Oct 20, 2026
@r-vdp

r-vdp commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

I'm a little iffy on doing this.
I understand the motivation, and that we (in nixpkgs) primarily package uv for usage on nixos, but fact is that many people simple consume this package from a dev shell.
Are we sure that we want to change the default behaviour of THE package manager for Python for all systems, without so much as a changelog note?

I think unvendoring the root CA certs is still important for future security issues to ensure that we can respond quickly without needing to patch all individual packages.

I'm not so sure now after reading all the comments here how you all feel about this?

To me, using the system trust store seems preferable over a built-in one, since any distro is probably going to be faster at updating their central trust store then we would be at patching uv.

@r-vdp

r-vdp commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@bengsparks I'd like to merge this. I think vendored ca root stores in individual packages are a bigger risk to users here, since they are slow to update (I'm still merging PRs currently, long after our cacerts update reached all channels).

WDYT?

@bengsparks

bengsparks commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Let's go for it (as long as you've tested the CLI beyond --dry-run)

@bengsparks

Copy link
Copy Markdown
Contributor

I'd also like some eyes on #576587

@r-vdp

r-vdp commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Let's go for it (as long as you've tested the CLI beyond --dry-run)

I did a bunch of tests and all looks good.

@r-vdp

r-vdp commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

I'd also like some eyes on #576587

This PR does not cleanly cherry-pick?

@r-vdp
r-vdp added this pull request to the merge queue Oct 27, 2026
@r-vdp r-vdp added the backport release-26.05 Backport PR automatically label Oct 27, 2026
Merged via the queue into NixOS:master with commit 8b9f432 Oct 27, 2026
37 checks passed
@nixpkgs-ci

nixpkgs-ci Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-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 Oct 27, 2026
@bengsparks

Copy link
Copy Markdown
Contributor

Coming back to this since finding out that backporting this change on 26.05 was backwards-incompatible, I also noticed that my wish for a changelog entry wasn't implemented before merging.

Are we sure that we want to change the default behaviour of THE package manager for Python for all systems, without so much as a changelog note?

@r-vdp

r-vdp commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Coming back to this since finding out that backporting this change on 26.05 was backwards-incompatible, I also noticed that my wish for a changelog entry wasn't implemented before merging.

Are we sure that we want to change the default behaviour of THE package manager for Python for all systems, without so much as a changelog note?

I don't think this change required a changelog entry, it shouldn't have any impact on users.
We want to limit the changelog to actually important changes that may need specific user attention, not smaller details like where the CA roots come from.

khimoo added a commit to khimoo/flake_public that referenced this pull request Oct 29, 2026
nixpkgs wraps uv with UV_SYSTEM_CERTS=1 as the default. uv builds its
HTTP client even under UV_OFFLINE=1, and the build sandbox has no
system CA store, so the anki build exits with "No CA certificates were
loaded from the system". The wrapper uses --set-default, so setting
the variable to 0 in the anki env takes precedence.

Refs NixOS/nixpkgs#576558

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. backport release-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.

5 participants