fix(tools): apply SSRF guard to Firecrawl fallback fetch path#21669
fix(tools): apply SSRF guard to Firecrawl fallback fetch path#21669AI-Reviewer-QS wants to merge 3 commits into
Conversation
The Firecrawl fallback in web-fetch used plain fetch() without SSRF protection, allowing bypass of the SSRF guard when the primary fetch failed with a non-SSRF error. Replace the plain fetch with fetchWithSsrFGuard to validate the Firecrawl endpoint URL against the same SSRF policy before making the request. Co-Authored-By: AI-Reviewer-QS <qs-ai-reviewer@quantstamp.com>
|
This scrutinises the user-configured URL, not just the redirects from the firecrawl server, and has no policy set. In effect, it prevents the user from setting up their own firecrawl-compatible server or secure tunnel as it blocks all access to local installations. Set a policy that limits requests to stay within the same authority domain (intranet or internet) based on the configured URL. (Note: This also requires a configuration option to define what the local intranet encompasses, which is required for so many other checks, too, that rely on hardcoded IP ranges at the moment.) |
|
Closing based on reviewer feedback. The current implementation blocks legitimate local Firecrawl installations and self-hosted setups. A proper fix would need a policy-based approach rather than blanket blocking of local addresses. |
Summary
fetch()infetchFirecrawlContentwithfetchWithSsrFGuardto validate the Firecrawl endpoint URL against the same SSRF policytry/finallyafter the Firecrawl request completeswithTimeoutimport that was previously used by the plain fetch callTest plan
Greptile Summary
Adds SSRF protection to the Firecrawl fallback fetch path by replacing plain
fetch()withfetchWithSsrFGuard(), ensuring the Firecrawl endpoint URL is validated against the same SSRF policy used for direct web fetches.fetch()call withfetchWithSsrFGuard()wrapper that validates the endpoint URLtry/finallyblock to release the guarded dispatcherwithTimeoutimport (timeout now handled byfetchWithSsrFGuard)performDirectFetchfunction within this fileConfidence Score: 5/5
Last reviewed commit: f25fbed