Repository navigation
Verify TLS against the OS trust store via truststore - #319
Draft
gerardo-navarro wants to merge 3 commits into
Draft
gerardo-navarro wants to merge 3 commits into
gerardo-navarro wants to merge 3 commits into
Conversation
Corporate proxies that re-sign HTTPS traffic use a CA that Windows trusts but certifi does not. Every model download then fails with CERTIFICATE_VERIFY_FAILED, while the same download works in the browser. Inject truststore in aTrain_core.globals, which every process imports, including the spawned download workers. Refs #318
This was referenced Oct 22, 2026
gerardo-navarro
force-pushed
the
bugfixes_truststore
branch
from
October 27, 2026 09:08
0154736 to
b9f6799
Compare
# Conflicts: # .github/workflows/ci.yml # uv.lock
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.
Summary
In corporate networks a TLS-inspecting proxy re-signs HTTPS traffic with an internal root CA. Windows trusts that CA (distributed via GPO), so downloads work in the browser. aTrain's Python verifies against
certifi, which does not know the CA. Every model download then fails withCERTIFICATE_VERIFY_FAILED, both for required models and on the models page.This PR makes Python verify certificates against the OS trust store with
truststore, the same approach pip has used since 24.2.pyproject.toml/uv.lock: addtruststore==0.10.4(pure Python, MIT, no dependencies).aTrain_core/globals.py: calltruststore.inject_into_ssl()at import. Every process imports this module, including the spawned workers that run the downloads on Windows.tests/unit/test_globals.py: assert thatssl.SSLContextis replaced..github/workflows/ci.yml: installtruststorein the unit job, which installs its deps by hand.Notes:
requests(currenthuggingface_hub0.36) and forhttpx(huggingface_hub1.x, Upgrade to Transformers 5.17 and Hugging Face Hub 1.33 #286), since both build their contexts fromssl.SSLContext.References
Refs #318
Screenshots / Examples
Behind a TLS-inspecting proxy whose CA is only in the system store (Linux sandbox), with
REQUESTS_CA_BUNDLEunset:Verification Steps
uv run --no-sync pytest tests/unit/test_globals.py: new test fails without the fix, passes with it.ruff check,ruff format --check, bandit clean.REQUESTS_CA_BUNDLEunset:tiny→ finishes (fails today withSSLCertVerificationError).