Skip to content

feat(tools): add web_fetch built-in - #373

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/web-fetch-tool
Aug 16, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/web-fetch-tool

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • Adds a web_fetch built-in tool that fetches an http(s) URL and returns its content as plain text, stripping HTML tags/scripts/styles.
  • Always registered (unlike web_search, which needs a configured provider/API key) — it's a direct HTTP GET.
  • SSRF guard: refuses non-http(s) schemes and loopback/private/link-local/multicast targets, checked against both literal IPs and DNS-resolved hostnames, with the same literal-IP check re-applied on each of up to 5 redirect hops.
  • Bounds: 3MB response body cap (streamed, not buffered unbounded), 100k-char output cap, 20s timeout; truncation is flagged in the output.

Test plan

  • cargo test -p forge-tools — new unit tests for the SSRF guard, HTML-to-text conversion, and a local raw-TCP integration test for fetch/render (green)
  • cargo test --workspace — green (one unrelated pre-existing perf-timing flake in forge-tui, confirmed passes in isolation)
  • cargo fmt --all -- --check — clean
  • cargo clippy --workspace --all-targets — clean

Fetches http(s) URLs and returns readable text (HTML tags/scripts/styles
stripped). Always registered, unlike web_search, since it needs no
provider/API key. Guards against SSRF by refusing non-http(s) schemes and
loopback/private/link-local targets, both for literal IPs and via DNS
resolution, with the same check re-applied on each redirect hop.
@github-actions
github-actions Bot enabled auto-merge (squash) August 16, 2026 20:28
@github-actions
github-actions Bot merged commit bb92b22 into main Aug 16, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
Fetches http(s) URLs and returns readable text (HTML tags/scripts/styles
stripped). Always registered, unlike web_search, since it needs no
provider/API key. Guards against SSRF by refusing non-http(s) schemes and
loopback/private/link-local targets, both for literal IPs and via DNS
resolution, with the same check re-applied on each redirect hop.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Fetches http(s) URLs and returns readable text (HTML tags/scripts/styles
stripped). Always registered, unlike web_search, since it needs no
provider/API key. Guards against SSRF by refusing non-http(s) schemes and
loopback/private/link-local targets, both for literal IPs and via DNS
resolution, with the same check re-applied on each redirect hop.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Fetches http(s) URLs and returns readable text (HTML tags/scripts/styles
stripped). Always registered, unlike web_search, since it needs no
provider/API key. Guards against SSRF by refusing non-http(s) schemes and
loopback/private/link-local targets, both for literal IPs and via DNS
resolution, with the same check re-applied on each redirect hop.
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.

1 participant