Repository navigation
net: loopback never through a proxy; trust INCODE_CA_CERTS (refs #26) - #41
Merged
Merged
Conversation
Every client is reqwest with its system proxy on, so HTTPS_PROXY, HTTP_PROXY, NO_PROXY and the Windows/macOS proxy settings already applied everywhere. But that matcher proxies loopback too unless NO_PROXY names it, so the memory engine, a local model server or a local MCP server went to a corporate proxy that cannot reach them, and a proxy re-signing TLS with a company CA had no way to be trusted. runtime::http::builder is now the base of every client: a client for this machine gets no proxy (client_for, no_redirect_client(url), the model API by its endpoint), and the PEM bundle INCODE_CA_CERTS (else SSL_CERT_FILE) names is trusted beside the system store; one that cannot be used is said and not added. Dev-only: rcgen and rustls (ring) for an end-to-end TLS test against a CA made at test time.
…own client Review of the previous commit: a client with no proxy followed any redirect, so a local service redirecting elsewhere sent the request to the other host past the proxy; and OAuth discovery reused the client chosen for the MCP server for metadata URLs on other hosts. builder(true) now follows a redirect only while it stays on this machine, and mcp_oauth::fetch_json chooses the client for the URL it fetches.
This was referenced Oct 22, 2026
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.
#26 item 4: corporate proxy and custom CA.
What was already true
Every outbound client is reqwest 0.12 with its
system-proxydefault on, and none called.no_proxy().HTTPS_PROXY,HTTP_PROXY,ALL_PROXYandNO_PROXY(either case) applied everywhere already. The Windows Internet Options or macOS proxy settings came next (hyper-utilMatcher::from_system).incode update, and the memory engine..proxy(..)would switch off the OS settings.What was wrong
NO_PROXYlists it (hyper-util-0.1.20 .../matcher.rs:122-133). With a corporate proxy set, the memory engine on127.0.0.1, a local model server or a local MCP server was sent to a proxy that cannot reach them.The change
runtime::http::builder(loopback)is now the base of every client..no_proxy(). "This machine" meanslocalhost, a.localhostname,127.0.0.0/8or::1(is_loopback).client_for(url),no_redirect_client(url), andrequest_text/request_empty, which build the request first and then pick by its URL.INCODE_CA_CERTS, elseSSL_CERT_FILE, names a PEM bundle that is trusted beside the system store (Certificate::from_pem_bundle).builder(true)client; the no-redirect clients still follow none.mcp_oauth::fetch_json), not the one chosen for the MCP server, because the metadata can live on another host.Both of these came from a security review of the first commit.
Test
a_redirect_from_this_machine_to_another_is_not_followed. Control: without the check, the direct client resolved the outside host itself.Test
the_client_is_chosen_by_the_address_it_is_for.Web fetch keeps the system proxy. Through a proxy, the proxy resolves the name itself, so the IP pin cannot hold there; that was already the case. Its local checks still refuse a name that resolves inward. Both points are in the code comment and the README.
README: a new "Proxies and certificates" section.
Tests
Both network tests run a child process, so the proxy and CA environment is that process's alone. Each has a control.
a_loopback_request_skips_the_proxy_and_a_remote_one_takes_it. The child hasHTTP_PROXYpointing at the sandbox crate's loopback proxy (deny-all, records every target) and noNO_PROXY..invalidname is asked of the proxy.a_server_signed_by_the_operators_ca_is_trusted_through_incode_ca_certs. A rustls server onlocalhostuses a certificate from a CA made at test time with rcgen.INCODE_CA_CERTSthe request is refused; with it, it is answered.this_machine_is_named_by_localhost_and_loopback_addresses_onlya_ca_bundle_is_read_from_the_environment_and_a_bad_one_is_said: precedence, a missing file, garbage, and a two-certificate bundle.Local Windows gate: fmt, clippy
-D warnings,cargo test(2209 lib + 59 bin).Dependencies (dev-only)
rcgen0.13 andrustls0.23 (ring, no defaults) are used for the TLS test only.rustlsandringwere already inCargo.lockas optional parts of reqwest's tree. New in the lock:rcgen,pem,yasna.errno,rustix,tempfileand one other) ontowindows-sys0.61.2, which was already in the tree in place of 0.59.Not covered
The coding-agent CLIs incode drives (claude, codex, agy) make their own requests with their own proxy and CA settings.