Skip to content

Rust CLI: honor NO_PROXY=* like the Node CLI - #334

Merged
poiley merged 5 commits into
rust-cli-portfrom
rust-cli-noproxy-star
Jul 22, 2026
Merged

Rust CLI: honor NO_PROXY=* like the Node CLI#334
poiley merged 5 commits into
rust-cli-portfrom
rust-cli-noproxy-star

Conversation

@poiley

@poiley poiley commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Parity backlog: a proxy differential (both CLIs through a recording forward proxy, nine HTTP_PROXY/NO_PROXY combinations) found that reqwest ignores the conventional NO_PROXY=* bypass-everything wildcard that undici and curl honor. With a proxy configured and NO_PROXY=*, the Rust CLI silently kept routing traffic through the proxy while the Node CLI went direct.

What changed

  • client.rs: env_no_proxy_wildcard() detects a * entry in NO_PROXY/no_proxy (comma-separated, trimmed; *.example.com does NOT count) and the builder calls .no_proxy() when present. Unit tests cover the parse.
  • Same guard on the other two reqwest builders: payloads.rs (compiled standalone by the include-style tests, so it carries a small local copy) and root_startup.rs.

Differential results after the fix

case node rust
no proxy vars direct direct
proxy set proxy proxy
NO_PROXY=127.0.0.1 direct direct
NO_PROXY=localhost (target by IP) proxy proxy
NO_PROXY=127.0.0.0/8 proxy direct (kept, see below)
NO_PROXY=* direct direct (was proxy)
NO_PROXY=example.com proxy proxy
NO_PROXY=127.0.0.1:1 proxy proxy
lowercase vars proxy proxy

Deliberately kept difference: reqwest honors CIDR entries which undici ignores; matching Node there would make the Rust CLI strictly less correct for users behind CIDR-scoped corp proxies.

Validation

make rust-cli-check green; proxy matrix above re-run against the built binary.

🤖 Generated with Claude Code

etbyrd and others added 2 commits July 20, 2026 18:54
A local proxy differential (both CLIs against a recording forward proxy
across nine HTTP_PROXY/NO_PROXY combinations) showed reqwest ignores the
conventional NO_PROXY=* bypass-everything wildcard that undici and curl
honor: with HTTP(S)_PROXY set and NO_PROXY=*, the Rust CLI kept routing
through the proxy while the Node CLI went direct. In environments that use
NO_PROXY=* to disable a configured proxy, the Rust CLI would silently send
traffic through it.

Detect a `*` entry in NO_PROXY/no_proxy and disable proxying on all three
reqwest client builders (client.rs, payloads.rs which is compiled
standalone by the include-style tests, and root_startup.rs).

Every other combination already matched: exact IP and hostname bypass,
port-qualified entries, lowercase vars, unset vars. Known remaining
difference, deliberately kept: reqwest honors CIDR entries
(NO_PROXY=127.0.0.0/8) which undici ignores; matching Node would make the
Rust CLI strictly less correct.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
cli-rust/src/config.rs Adds the shared proxy wildcard helper and exact * parsing.
cli-rust/src/client.rs Applies the shared wildcard check to the main reqwest client builder.
cli-rust/src/payloads.rs Applies the shared wildcard check to payload HTTP requests.
cli-rust/src/root_startup.rs Applies the shared wildcard check to the startup root-account request.
cli-rust/tests/config.rs Adds unit coverage for conventional wildcard parsing forms.
cli-rust/tests/payloads.rs Updates the include-style payload test shim with the new proxy helper.

Reviews (4): Last reviewed commit: "Merge updated rust-cli-port base" | Re-trigger Greptile

Comment thread cli-rust/src/client.rs Outdated
Comment thread cli-rust/src/payloads.rs Outdated
Greptile: checking both spellings with any() meant no_proxy=127.0.0.1
alongside an inherited NO_PROXY=* disabled proxying based on a value
reqwest would never use. The gate now resolves the effective value exactly
like reqwest's NoProxy::from_env (NO_PROXY first, falling back to
no_proxy) so it always agrees with the list reqwest applies.

The helper moves to config.rs as the single canonical copy; client.rs
re-exports it and payloads.rs (compiled standalone by the include-style
tests, whose config stub now carries a passthrough) calls it directly
instead of duplicating the parse.

Verified against the recording proxy: NO_PROXY=* bypasses; NO_PROXY=* +
no_proxy=example.com bypasses (upper wins); NO_PROXY=example.com +
no_proxy=* still proxies (upper wins, matching reqwest).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread cli-rust/src/config.rs Outdated
Greptile round 2, resolved empirically: undici gives the lowercase
no_proxy precedence when both spellings are set (verified by running the
Node CLI through a recording proxy), the opposite of reqwest. With the
gate now lowercase-first, all four wildcard scenarios match Node:
NO_PROXY=* alone and no_proxy=* alone both bypass; NO_PROXY=* +
no_proxy=host keeps proxying (the gate defers to the lowercase list and
reqwest ignores the * entry in the uppercase list it resolves);
NO_PROXY=host + no_proxy=* bypasses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@etbyrd
etbyrd force-pushed the rust-cli-port branch 2 times, most recently from 322c5b5 to 0765fa5 Compare July 21, 2026 17:25
# Conflicts:
#	.github/workflows/rust-cli-release.yml
#	.github/workflows/sdk-checks.yml
#	Makefile
#	cli-rust/src/client.rs
#	cli-rust/src/completion_commands.rs
#	cli-rust/src/config.rs
#	cli-rust/src/friendly.rs
#	cli-rust/src/functions_commands.rs
#	cli-rust/src/help_snapshots.generated.rs
#	cli-rust/src/payloads.rs
#	cli-rust/src/payments.rs
#	cli-rust/src/root_startup.rs
#	cli-rust/tests/completion_commands.rs
#	cli-rust/tests/config.rs
#	cli-rust/tests/payloads.rs
#	scripts/generate-rust-cli-help-snapshots.mjs
#	scripts/run-cli-help-sweep.mjs
#	scripts/run-cli-parity.mjs
#	test-fixtures/cli-parity/cases.json
@poiley poiley mentioned this pull request Jul 21, 2026
@poiley
poiley merged commit fe6d408 into rust-cli-port Jul 22, 2026
15 checks passed
@poiley
poiley deleted the rust-cli-noproxy-star branch July 22, 2026 20:24
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.

2 participants