fix(fetch): support corporate proxies with TLS interception#3330
Open
sleicht wants to merge 1 commit into
Open
fix(fetch): support corporate proxies with TLS interception#3330sleicht wants to merge 1 commit into
sleicht wants to merge 1 commit into
Conversation
The fetch tool's HTTP client was created via bare `Client::new()`, which caused two failures in corporate proxy environments: 1. The workspace-wide `hickory-dns` cargo feature made the client perform direct DNS resolution, bypassing HTTP_PROXY/HTTPS_PROXY environment variables entirely. 2. The `rustls-tls` backend only trusts the webpki-roots CA bundle, so proxies that perform TLS interception (MITM) have their re-signed certificates rejected. Fix by: - Calling `.hickory_dns(false)` to delegate DNS to the system resolver / configured proxy. - Loading additional root CA certificates from well-known environment variables (FORGE_ROOT_CERT_PATHS, SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, REQUESTS_CA_BUNDLE) so corporate proxy CAs are trusted. Fixes tailcallhq#3329
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
The fetch tool's HTTP client was created via bare
Client::new(), which caused two failures in corporate proxy environments:Hickory-DNS bypasses proxy: The workspace-wide
hickory-dnscargo feature made the client perform direct DNS resolution, bypassingHTTP_PROXY/HTTPS_PROXYenvironment variables entirely.Corporate CA not trusted: The
rustls-tlsbackend only trusts thewebpki-rootsCA bundle, so proxies that perform TLS interception (MITM) have their re-signed certificates rejected.Fix
.hickory_dns(false)on the client builder to delegate DNS to the system resolver / configured proxy.FORGE_ROOT_CERT_PATHS— comma-separated list of PEM/DER paths (Forge-specific)SSL_CERT_FILE— single PEM bundle (common convention)NODE_EXTRA_CA_CERTS— single PEM file (Node.js convention)REQUESTS_CA_BUNDLE— single PEM bundle (Python convention)Testing
Verified working in a corporate environment with:
HTTP_PROXY/HTTPS_PROXYset tohttp://proxy:8080)NODE_EXTRA_CA_CERTSpointing to the corporate CA PEM fileBefore this fix, every
fetchcall failed witherror sending request for url. After the fix, fetches work correctly through the proxy.Related