Conversation
When users activate a pixi shell, environment activation scripts set SSL_CERT_FILE and SSL_CERT_DIR pointing to the environment's CA certs. Previously, Certificates::for_mode returned early when from_env() was non-empty, completely discarding from_native_store() or webpki_roots(). This dropped corporate root CAs trusted by the system keychain when running inside an activated environment shell, leading to UnknownIssuer TLS errors. This change loads the base trust roots for the configured mode (system or webpki) and merges certificates from SSL_CERT_FILE and SSL_CERT_DIR into them, deduplicating any duplicates. This matches the behavior of the native-tls backend and ensures custom/corporate certificates in both the OS store and the environment are trusted. Fixes prefix-dev#6884 Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
… tests Move base64 certificate fixture into test_cert.crt to avoid false positives in typos linter, and use ENV_MUTEX to synchronize parallel temp_env test runs. Signed-off-by: aoright <102943475+aoright@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When users activate an environment shell (e.g.
pixi shell), activation scripts (from OpenSSL orca-certificates) setSSL_CERT_FILEandSSL_CERT_DIRpointing to the environment's certificates.Previously,
Certificates::for_modeincrates/pixi_utils/src/tls.rsreturned early whenfrom_env()was non-empty, completely discardingfrom_native_store()orwebpki_roots(). This dropped corporate root CAs trusted by the operating system keychain / Windows certificate store when running inside an activated environment shell, leading toUnknownIssuerTLS certificate errors against corporate proxies and private repositories.This change loads the base trust roots for the configured mode (
SystemorWebpki) and merges certificates fromSSL_CERT_FILEandSSL_CERT_DIRinto them, deduplicating any duplicates. This matches the behavior of thenative-tlsbackend (apply_native_tls_roots) and ensures custom/corporate certificates in both the OS store and the environment are trusted.Fixes #6884
How Has This Been Tested?
test_webpki_roots_non_emptyverifying bundled Mozilla roots are loaded and non-empty.test_for_mode_without_envassertingSystemandWebpkimodes load expected native and webpki roots when no env vars are present.test_for_mode_merges_ssl_cert_file_with_systemverifying that custom PEM certificates fromSSL_CERT_FILEare merged into system store roots without discarding native roots.test_for_mode_merges_ssl_cert_file_with_webpkiverifying custom PEM certificates merge with webpki roots.test_merge_deduplicatesverifying duplicate certificates are deduplicated cleanly.pixi_utilspass:cargo test -p pixi_utils.cargo test -p pixi_config --lib.cargo fmt --checkandcargo clippy --package pixi_utils --package pixi_config --all-targets -- -D warnings.AI Disclosure
Tools: Google Antigravity
Checklist: