fix(nodes): refuse link-local and cloud metadata targets in FetchNode by Arthur031221 · Pull Request #1173 · ScrapeGraphAI/Scrapegraph-ai · GitHub
Skip to content

fix(nodes): refuse link-local and cloud metadata targets in FetchNode - #1173

Open
Arthur031221 wants to merge 1 commit into
ScrapeGraphAI:pre/betafrom
Arthur031221:fix/fetch-node-metadata-ssrf
Open

Arthur031221 wants to merge 1 commit into
ScrapeGraphAI:pre/betafrom
Arthur031221:fix/fetch-node-metadata-ssrf

Conversation

@Arthur031221

Copy link
Copy Markdown

Refs #1115

A service that passes user-supplied URLs to a graph can be pointed at cloud metadata endpoints like http://169.254.169.254/latest/meta-data/. FetchNode gave the source straight to requests or the browser.

The new utils/url_safety.py resolves the host and raises ValueError for link-local addresses (including IPv4-mapped, zone id, decimal and hex spellings) and known metadata addresses. FetchNode checks the source before fetching, except on the BrowserBase and Scrape.do paths. use_soup also checks redirect targets. The Playwright loaders abort requests to such hosts and check the page URL after load and after reading content. Selenium, DNS rebinding and service workers aren't covered.

Loopback and private ranges stay allowed because local scraping relies on them. Link-local has no opt-out.

Tested with pytest tests/utils/test_url_safety.py. The ChromiumLoader test doubles gained route and url. Other lint and test failures already exist on pre/beta.

Assisted by Claude/Codex.

Signed-off-by: Arthur031221 <levi74108520963@gmail.com>

This branch has not been deployed

No deployments
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