Skip to content

feat(http): opt-in explicit egress proxy, still no autodiscovery (#589) - #601

Merged
fastrevmd-lab merged 4 commits into
mainfrom
feat/589-explicit-egress-proxy
Oct 30, 2026
Merged

fastrevmd-lab merged 4 commits into
mainfrom
feat/589-explicit-egress-proxy

Conversation

@fastrevmd-lab

Copy link
Copy Markdown
Member

Fixes #589.

HttpClient::new hard-coded .no_proxy(), and HttpClientConfig had no proxy field. That blocked rustsdcmcp, which ships an explicit egress_proxy, from building on mecmcp-http.

Changes

  • New field. HttpClientConfig::explicit_proxy: Option<ProxyUrl>.
    • None (the default) leaves the built client identical to before, still .no_proxy().
    • Some adds reqwest::Proxy::all after .no_proxy(). That order keeps the explicit proxy, and environment HTTP(S)_PROXY, ALL_PROXY and NO_PROXY are never read in either case. I checked this against the locked reqwest 0.13.5 and hyper-util 0.1.21 source.
  • ProxyUrl::parse validation.
    • Accepts http and https schemes only. An http:// proxy uses CONNECT, so TLS to the origin stays end-to-end.
    • Allows a username and password, matching rustsdcmcp's shipped egress_proxy.
    • Rejects a path, query or fragment (stricter than rustsdcmcp).
    • Rejects URLs longer than 2048 bytes. hyper-util silently drops a proxy URI longer than about 64 KB, which would make requests go direct.
  • Credential redaction. Credentials never appear in Debug (it goes through SafeUrl) or in errors, and ProxyUrl has no Display.
  • Unchanged. The redirect policy (none). The module doc now promises no proxy autodiscovery. The mecmcp-oidc doc wording is updated to match.
  • Breaking for source. This is a new public field. rustmistmcp's full struct literals at crates/rustmistmcp-core/src/client.rs:187 and :290 need explicit_proxy: None or ..Default::default(). This calls for a minor release, 0.32.0.

Verification

  • fmt, clippy --workspace --all-targets --all-features -D warnings, and the workspace tests with features all pass: 2386 passed, 0 failed.
  • A child-process integration test points the environment proxies at a decoy listener. It asserts exactly one CONNECT reaches the explicit proxy, carrying the Basic credentials, and that the decoy is never contacted. Removing .no_proxy(), skipping the proxy wiring, or printing the raw URL each makes a test fail.
  • A wiring test asserts the built client carries https: Intercept { uri: … }. Boundary tests: exactly 2048 bytes is accepted and wired; 2049 and 70,000 bytes are rejected without echoing the URL.
  • Reviews: the opus review's fixes are applied (length cap, wiring assertion, changelog format). codex exec review --commit passes on both code commits. Credentialed fixture URLs use the gate-exempt PASSWORD placeholder.

Not covered

  • No test goes through an https:// proxy.
  • The proxy password lives un-zeroized in a cloneable Url; reqwest and hyper-util keep their own copies anyway.

🤖 Generated with Claude Code

fastrevmd-lab and others added 4 commits October 29, 2026 23:45
HttpClientConfig gains `explicit_proxy: Option<ProxyUrl>`. None, the
default, keeps the builder byte-identical (`.no_proxy()`). Some routes
every request through `reqwest::Proxy::all`, added after `.no_proxy()`,
so HTTP(S)_PROXY / ALL_PROXY / NO_PROXY stay ignored either way.

ProxyUrl::parse matches rustsdcmcp's shipped `egress_proxy`: http or
https scheme with a host, userinfo accepted (sent as
Proxy-Authorization: Basic). It additionally refuses a path, query or
fragment, which reqwest would drop silently. Errors never echo the
input, Debug goes through SafeUrl, and there is no Display.

Tests: default has no proxy; bad schemes/paths rejected without echoing
the password; config/client/error Debug never carries the userinfo; a
re-exec'd child proves requests CONNECT through the explicit proxy with
the Basic header while env proxies point at a decoy that is never dialled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… silently (#589)

hyper-util re-parses the proxy as an http::Uri (about 64 KiB max) and, on
failure, returns no intercept without an error, so a ProxyUrl with a very
long password left the client going direct. ProxyUrl::parse now refuses a
serialized URL over 2048 bytes, without echoing it.

The wiring test now asserts the client carries the proxy as its https
intercept target, not just a `proxies` entry (a dropped proxy still
shows `proxies: [Matcher]`). New test covers the cap boundary and the
70,000-byte case.

CHANGELOG: the source break moves to a `### Changed` "Breaking for
source (#589)" bullet naming the affected consumers. mecmcp-oidc's doc
now says "no proxy autodiscovery".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pre-push credential gate rejects http(s) URLs with a userinfo password
unless it is a placeholder; use PASSWORD in the doc and build the
over-length fixture from pieces. Same bytes at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fastrevmd-lab
fastrevmd-lab enabled auto-merge (squash) October 30, 2026 03:46
@fastrevmd-lab
fastrevmd-lab merged commit 099fae4 into main Oct 30, 2026
12 checks passed
@fastrevmd-lab
fastrevmd-lab deleted the feat/589-explicit-egress-proxy branch October 30, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mecmcp-http: opt-in explicit egress proxy (still no autodiscovery)

1 participant