Repository navigation
fix(web_fetch): build the client through the host's prepare_client - #93
Conversation
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(web_fetch): build the client through the host's prepare_client. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete What changed`web_fetch` splits its client construction into a builder followed by `self.gate.prepare_client("tool.web_fetch", builder)`, then continues with `redirect(Policy::none())` applied before the hook and `resolve_to_addrs` after it, allowing the host's proxy settings to apply while still connecting only to vetted addresses. `TestNetGate` gains a `prepared` field and `prepared()` accessor, and its `NetGate::prepare_client` implementation now records the service name instead of ignoring it. A new test module `web_fetch_proxy_tests.rs` is wired into `web_fetch.rs` under `cfg(test)` and contains one test that serves a local HTTP response and asserts a non-error result plus `gate.prepared() == ["tool.web_fetch"]`. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Summary
web_fetchbuilt itsreqwestclient directly and never calledNetGate::prepare_client. That is the hook a host uses to apply its process-wide proxy and client settings.http_requestandcurlboth call it ("tool.http_request","tool.curl"), soweb_fetchwas the only network tool that ignored the host's proxy and connected directly.web_fetchnow passes its builder throughself.gate.prepare_client("tool.web_fetch", builder)before pinning the vetted addresses, in the same order ashttp_request.Related issue
None.
API or behavior changes
Behavior change:
web_fetchnow uses the host's proxy. Whatever a host'sprepare_clientapplies (proxy, TLS settings) now applies toweb_fetchas well. A host that sets a user proxy will seeweb_fetchtraffic go through it, ashttp_requestandcurltraffic already does. The public API is unchanged.Validation
Commands actually run, with their outcome:
cargo fmt --all -- --check:rustfmt --edition 2024on the touched files only.cargo clippy --all-targets --all-features -- -D warningswas left to CI.cargo build --all-targets --all-featureswas left to CI.cargo test --all-featureswas left to CI. Only the new test ran locally:web_fetch_builds_its_client_through_prepare_clientbefore the fix failed (left: [] right: ["tool.web_fetch"]); after the fix it passed.Tests
TestNetGatenow records the service name of eachprepare_clientcall (prepared()).network/web_fetch_proxy_tests.rs::web_fetch_builds_its_client_through_prepare_clientfetches from a local server and asserts that the gate saw exactly oneprepare_client("tool.web_fetch"). It is a new file becauseweb_fetch_tests.rsis already over the 750-line layout cap.Documentation
Not needed:
NetGate::prepare_clientalready documents the hook, and this makesweb_fetchuse it.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description