Repository navigation
Description
Is your feature request related to a problem? Please describe.
apm fails TLS verification against internal Git hosts that use a corporate CA or a TLS-inspecting proxy, even when git and curl to the same host succeed. This makes the first-run experience in enterprise environments confusing and requires per-shell env-var setup.
What the user sees:
apm marketplace add https://<internal-ghe-host>/Org/repo.git --name foo
[x] Failed to register marketplace: Failed to fetch marketplace 'foo':
HTTPSConnectionPool(host='<internal-ghe-host>', port=443): Max retries exceeded with
url: /api/v3/repos/Org/repo/contents/marketplace.json?ref=main
(Caused by SSLError(SSLCertVerificationError(1,
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
unable to get local issuer certificate (_ssl.c:1010)')))
git clone of the exact same URL succeeds, which is what makes this so confusing.
Why it happens: APM classifies GitHub/GHES/GitLab hosts and fetches marketplace.json (and package metadata) through the REST Contents API using requests, via a plain module-level session:
# src/apm_cli/marketplace/client.py
_HTTP_SESSION = requests.Session()A default requests.Session() verifies against the bundled certifi CA set (certifi.where()), which does not include internal/corporate root CAs or the certs injected by a TLS-inspecting proxy. The PyInstaller build bundles this set explicitly (build/apm.spec: 'certifi' # CA certificate bundle for SSL verification in frozen binary). Repository operations, by contrast, shell out to git, which reads the OS trust store (e.g. /etc/ssl/certs/ca-certificates.crt) -- so git clone succeeds while the requests-based Contents API call fails against the exact same certificate chain.
Describe the solution you'd like
Use the OS trust store by default via truststore (Python 3.10+; APM already requires >=3.10), e.g. call truststore.inject_into_ssl() once at CLI startup. This automatically picks up corporate CAs on Linux/macOS/Windows with no user configuration, is the modern recommended approach for exactly this problem, and makes git and apm behave consistently against the same host.
Acceptance criteria:
- A fresh install of APM, in an environment where only the OS trust store contains the corporate CA, can
apm marketplace add/apm installfrom an internal HTTPS Git host without setting any env vars. git-based andrequests-based operations use a consistent trust source.- Behaviour documented for air-gapped / custom-CA setups (extend the existing
troubleshooting/ssl-issuespage).
Please do not offer a "disable verification" flag as the primary remedy -- trusting the OS store is the secure fix.
Describe alternatives you've considered
-
REQUESTS_CA_BUNDLEenv var (current workaround). This already works and is documented, and APM already prints a hint pointing at it on TLS failure. But it must be re-set per shell / per container and is easy to miss:export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crtNote a sharp edge worth fixing regardless:
SSL_CERT_FILEalone does not repair the APMrequestspath.requestspinscertifi.where()and only consultsREQUESTS_CA_BUNDLE/CURL_CA_BUNDLE-- it ignoresSSL_CERT_FILE. So the fix documented for the older [BUG] SSL certificate issues related to to apm's bundled OpenSSL #428 (setting onlySSL_CERT_FILE) does not help the marketplace / install code path; users additionally needREQUESTS_CA_BUNDLE. This split between "what the OS trusts", "whatgituses", and "whatrequestsuses" is exactly the confusiontruststoreremoves. -
A
--ca-bundleflag /apm config set ca-bundle <path>. Lets users pin a custom CA file without relying on env vars. Useful as a secondary option, but still not zero-config. -
Disabling verification. Rejected -- insecure, and not an acceptable default or primary remedy.
Additional context
Related to #428, but distinct: #428 was about APM's bundled OpenSSL pointing at a non-existent python.org cert path. This issue is about internal/corporate root CAs not being present in the bundled certifi set at all, which is the common enterprise failure mode.
Environment where this was observed:
- APM CLI
0.23.1 - Bundled Python (PyInstaller,
--onedir) - Linux (dev container, Ubuntu 24.04), behind a corporate CA / TLS-inspecting proxy
git cloneof the same URL succeeds;apm marketplace add/apm installfail
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Jul 3, 2026
Triage Panel Verdict -- Issue #2004
Title: [FEATURE] Verify TLS using the system trust store by default (breaks in enterprise/proxy environments)
Triage Decision: ACCEPT (enterprise blocker, high priority, bounded fix)
Panel Review
DevX UX Expert
This is a first-run experience blocker in enterprise environments. When
git clonesucceeds against an internal HTTPS host butapm install/apm marketplace addfail withSSLCertVerificationError, the user has no obvious path forward. The error message does not explain thecertifivs. OS trust store split, and the current documented workaround (REQUESTS_CA_BUNDLE) requires per-shell setup that does not persist.The split the author describes --
gitreads the OS trust store,requestsreads the bundledcertifiset -- is the root of the confusion. Making these consistent is the correct fix, not documenting yet another env-var workaround.Supply Chain Security Expert
Using the OS trust store via
truststoreis more secure than the currentcertifiapproach, not less. The OS trust store is explicitly managed by the enterprise IT/security team; deferring to it meansapmhonors the organization's declared PKI rather than overriding it with a snapshot CA bundle that may be months out of date. Thetruststorelibrary is actively maintained, is the recommended approach for exactly this scenario in modern Python tooling, and requires no user configuration once injected at startup. The author's explicit rejection of a--no-verifyflag reflects correct security posture and should be honored.APM CEO (Arbiter)
Enterprise viability requires TLS consistency between
git-based andrequests-based operations. A tool that silently fails TLS wheregitsucceeds will not be adopted in corporate environments. Thetruststorefix is:truststore.inject_into_ssl()call at CLI entry, one dependency addition, one PyInstaller spec update.Accept for next minor release. The author also identifies a sharp edge worth fixing alongside:
SSL_CERT_FILEalone does not repair therequestspath (onlyREQUESTS_CA_BUNDLE/CURL_CA_BUNDLEdo). The troubleshooting docs should clarify this split.Decision
Suggested next action:
truststoreas a dependency (pinned, with lower bound).truststore.inject_into_ssl()at CLI entry point, before any network call.build/apm.specto includetruststorein the PyInstaller bundle.docs/troubleshooting/ssl-issues/to document: (a) OS trust store is now the default source; (b)REQUESTS_CA_BUNDLEremains available for edge cases; (c)SSL_CERT_FILEalone does NOT fix therequestspath -- users needREQUESTS_CA_BUNDLEfor that.test(tls): integration test for verification against a custom CA (mic…
feat(tls): verify against the OS trust store by default (microsoft#2004)
test(tls): integration test for verification against a custom CA (mic…
fix(tls): don't let SSL_CERT_FILE suppress OS-trust injection (micros…
test(tls): drive the real frozen SSL runtime hook (microsoft#2004)
docs(tls): address PR review feedback
feat(tls): verify against the OS trust store by default (microsoft#2004)
test(tls): integration test for verification against a custom CA (mic…
fix(tls): don't let SSL_CERT_FILE suppress OS-trust injection (micros…
test(tls): drive the real frozen SSL runtime hook (microsoft#2004)
docs(tls): address PR review feedback
feat(tls): verify against the OS trust store by default (closes #2004) (