Skip to content

fix(tools): apply SSRF guard to Firecrawl fallback fetch path#21669

Closed
AI-Reviewer-QS wants to merge 3 commits into
openclaw:mainfrom
AI-Reviewer-QS:fix/firecrawl-ssrf-guard
Closed

fix(tools): apply SSRF guard to Firecrawl fallback fetch path#21669
AI-Reviewer-QS wants to merge 3 commits into
openclaw:mainfrom
AI-Reviewer-QS:fix/firecrawl-ssrf-guard

Conversation

@AI-Reviewer-QS
Copy link
Copy Markdown
Contributor

@AI-Reviewer-QS AI-Reviewer-QS commented Feb 20, 2026

Summary

  • Replace plain fetch() in fetchFirecrawlContent with fetchWithSsrFGuard to validate the Firecrawl endpoint URL against the same SSRF policy
  • Properly release the guarded fetch dispatcher via try/finally after the Firecrawl request completes
  • Remove unused withTimeout import that was previously used by the plain fetch call

Test plan

  • Linting passes with no errors
  • Manual: verify Firecrawl fallback still works with valid public endpoint URLs
  • Manual: verify SSRF-blocked Firecrawl endpoint URLs (e.g., pointing to internal IPs) are rejected

Greptile Summary

Adds SSRF protection to the Firecrawl fallback fetch path by replacing plain fetch() with fetchWithSsrFGuard(), ensuring the Firecrawl endpoint URL is validated against the same SSRF policy used for direct web fetches.

  • Replaced plain fetch() call with fetchWithSsrFGuard() wrapper that validates the endpoint URL
  • Added proper resource cleanup via try/finally block to release the guarded dispatcher
  • Removed unused withTimeout import (timeout now handled by fetchWithSsrFGuard)
  • Follows the same pattern already established in the performDirectFetch function within this file

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward security improvement that follows existing patterns in the codebase. The implementation correctly handles SSRF protection, error handling, and resource cleanup. The removed import was genuinely unused.
  • No files require special attention

Last reviewed commit: f25fbed

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>
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Feb 20, 2026
@HenryLoenwind
Copy link
Copy Markdown
Contributor

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.)

@AI-Reviewer-QS
Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants