Personal AI, On Personal Devices
Python
fix: add SSRF check in WebSearchTool to prevent unsafe URL access
xbsheng9c3803828b91
diff --git a/src/openjarvis/tools/web_search.py b/src/openjarvis/tools/web_search.pyindex 0b01f8cc..430e58b3 100644--- a/src/openjarvis/tools/web_search.py+++ b/src/openjarvis/tools/web_search.py@@ -8,6 +8,7 @@ from typing import Anyfrom openjarvis.core.registry import ToolRegistryfrom openjarvis.core.types import ToolResultfrom openjarvis.tools._stubs import BaseTool, ToolSpec+from openjarvis.security.ssrf import check_ssrf@ToolRegistry.register("web_search")@@ -76,6 +77,9 @@ class WebSearchTool(BaseTool):import httpxurl = WebSearchTool._normalize_url(url)+ ssrf_error = check_ssrf(url)+ if ssrf_error:+ raise ValueError(ssrf_error)resp = httpx.get(url.strip(),follow_redirects=True,