Add support for SSL_CERT_DIR (#16473)

## Summary

Closes https://github.com/astral-sh/uv/issues/16414

Adds support for the standard
[SSL_CERT_DIR](https://docs.openssl.org/3.6/man3/SSL_CTX_load_verify_locations)
which has gained recent proper support from
[rustls-native-certs](https://github.com/rustls/rustls-native-certs/pull/187)
in v0.8.2.

In addition, this PR clarifies documentation around `SSL_CERT_FILE` and
`SSL_CERT_DIR` when used in combination with `UV_NATIVE_TLS` as
mentioned in
https://github.com/astral-sh/uv/issues/16412#issuecomment-3434927201

## Test Plan

Manually tested with custom cert chains in multiple directories and
loading them via SSL_CERT_DIR. We didn't have tests for `SSL_CERT_FILE`
or `SSL_CERT_DIR` environment variables so I added a basic one using our
own test-only certificate generation and dummy https server. I also
moved some things around for better reuse.
This commit is contained in:
samypr100
2025-11-16 12:48:31 -05:00
committed by GitHub
parent b9826778b9
commit bf99f0a195
11 changed files with 821 additions and 79 deletions
+11
View File
@@ -1004,11 +1004,22 @@ the fact that Windows' real main thread is only 1MB. That thread has size
The standard `SHELL` posix env var.
### `SSL_CERT_DIR`
<small class="added-in">added in `next release`</small>
Custom path for certificate bundles for SSL connections.
Multiple entries are supported separated using a platform-specific
delimiter (`:` on Unix, `;` on Windows).
Takes precedence over `UV_NATIVE_TLS` when set.
### `SSL_CERT_FILE`
<small class="added-in">added in `0.1.14`</small>
Custom certificate bundle file path for SSL connections.
Takes precedence over `UV_NATIVE_TLS` when set.
### `SSL_CLIENT_CERT`
<small class="added-in">added in `0.2.11`</small>