Repository navigation
uv: use only the system CA store - #576558
Conversation
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)
|
see #576471 for prior work on uv |
|
I'm a little iffy on doing this. |
|
Tbf, many operating systems that uv is run on will update the certs by themself as well, like we are doing now... |
|
Yes, I'm not entirely convinced either. I'm not sure what is the common/SotA guideline for this kind of things in nixpkgs. |
|
This will not backport. uv on 26.05 is at 11.x @zimbatm |
|
Perhaps this change should only go to 26.05? |
|
#576587 for your consideration. |
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. |
|
@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? |
|
Let's go for it (as long as you've tested the CLI beyond --dry-run) |
|
I'd also like some eyes on #576587 |
I did a bunch of tests and all looks good. |
This PR does not cleanly cherry-pick? |
|
Successfully created backport PR for |
|
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.
|
I don't think this change required a changelog entry, it shouldn't have any impact on users. |
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]>
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 requestsagainst 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.uvxbehaves the same. python3Packages.uv uses the same binary.Related to: #576485
Related to: #576544
Assisted-by: Claude Code (claude-opus-5)
Things done
./result/bin/.nixpkgs-reviewon this PR. See nixpkgs-review usage.passthru.tests.