fix: Support corporate TLS for Anthropic (NODE_EXTRA_CA_CERTS)#27
fix: Support corporate TLS for Anthropic (NODE_EXTRA_CA_CERTS)#27petre wants to merge 3 commits into
Conversation
|
Hey @petre — sorry for the silence on this one, you've been waiting way too long for a review on what's actually a clean, well-scoped fix. Apologies. Reviewed end-to-end, this is good work:
Four small things and we can merge: 1. Add a few tests for
|
Add regression tests for NODE_EXTRA_CA_CERTS, merge README guidance with upstream Python runtime docs and document the Python 3.13+ X.509 tradeoff, and drop the analyzer tracker change from the TLS PR per review. Co-authored-by: Cursor <cursoragent@cursor.com>
37c1122 to
b7cbbb1
Compare
|
Hi @ar7casper Thanks for the suggestions, I have implemented them. Please take a look and let me know if I should I add/remove anything. |
|
@petre Hey, some tests are failing, could yu take a look please? |
report.generator no longer exposes module-level anthropic after TLS factory wiring; patch create_anthropic_client so tier-2 disclosure tests keep a stable fake client. Co-authored-by: Cursor <cursoragent@cursor.com>
Tests updated |
Summary
OpenAnt’s Python code calls Anthropic over HTTPS. On networks with TLS inspection (e.g. Zscaler), the proxy uses a certificate chain signed by a corporate CA that is not in the default trust store. Node and Claude Code commonly work because operators set
NODE_EXTRA_CA_CERTSto a PEM file containing that CA. This PR makes the Anthropic Python client honor the same variable and documents it in the root README.Changes
libs/openant-core/utilities/anthropic_http.py(new): Builds anhttpxclient for the Anthropic SDK using the Mozilla CA bundle via certifi, then loadsNODE_EXTRA_CA_CERTSso trust matches “public CAs + corporate root”.VERIFY_X509_STRICTwhen using the extra PEM so corporate intercept CAs that omit critical Basic Constraints still verify (avoids false failures vs typical Node behavior).create_anthropic_client()so all LLM paths share the same TLS behavior.core/analyzer.py: FixNameError: definetrackerviaget_global_tracker()beforeadd_prior_usagewhen restoring checkpoint usage.core/scanner.py: Report failures log the full exception chain (underlying SSL/connection errors), not only Anthropic’s generic “Connection error.”libs/openant-core/pyproject.toml: Declarecertifiexplicitly (imported for the trust bundle).README.md: ShortNODE_EXTRA_CA_CERTSnote for users behind HTTPS inspection.How to test
Using the
openantCLI (typical): configure a key withopenant set-api-key …, or passopenant scan --api-key '…'.Behind TLS inspection: also
export NODE_EXTRA_CA_CERTS=/path/to/corporate-root.pem(same PEM many teams use for Node / Claude Code).