Repository navigation
Conversation
…art 1a) web::vetted_get performs a single GET through the existing vet-and-pin resolver: the host is checked up front (a private address is refused before any connection) and again in the connection's own resolver. No redirect is followed (a 3xx comes back with an unread body), a non-2xx status is a response rather than an error, the body is capped (error or truncate and flag) and the timeout covers the hop. vet_public_url and allow_private_from_env expose the check and the opt-out.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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.
What
Part 1a of #625:
tole_core::web::vetted_get, a single GET hop through the existing SSRF vet-and-pin resolver, plusvet_public_urlandallow_private_from_env. Part 1b (#672, stacked on this PR) builds nginjen-lite'sHttpClienton it in tole-cli, so the built-in web tools keep tole's one HTTP client, one TLS stack and its SSRF guard on every redirect hop.Depends on: nothing unmerged; based on
develop.Why
nginjen-lite brings no HTTP stack: callers implement its blocking
HttpClient, ideally with lite'sget_following_redirectsaround a transport that fetches exactly one hop. tole's SSRF guard lives in a private ureq resolver in tole-core, so tole-core exposes that one hop. tole-core stays platform-agnostic, with no new dependency (58 crates with--no-default-features, unchanged).Changes
web::Hop/HopResponse/HopError, andweb::vetted_get(&Hop):HopError::Private. It is checked again in the connection's own resolver (SsrfResolver), which pins what it vetted, so a DNS rebinding between the two checks fails closed.locationcomes back with an unread, empty body. A non-2xx status is a response, not an error.max_bytes. Over the cap isTooLarge, or a truncated body withtruncated: true.web_fetch.web::vet_public_url(url, allow_private): the http(s) and public-address check on its own.web::allow_private_from_env():TOLE_WEB_ALLOW_PRIVATE=1.web_fetch,web_searchand backend tools are unchanged. The CHANGELOG entry and the threat-model update ship with feat(cli): built-in web_search and web_fetch on nginjen-lite (#625 part 1b) #672, which makes this reachable.Testing
tests/web_hop.rswent red against a stub (5 of 5 failed), then green.file:URLs refused;cargo fmt --allcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspacecargo test -p tole-core --no-default-featurescargo check,clippy --features shell-toolsandtestfor tole-cli with--no-default-features)cora review --no-llm --staged: no issues.