mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
Add SSRF-guarded web fetch agent tool
* feat(web-fetch): add web_fetch tool to read a specific URL's content * test(web-fetch): add SSRF coverage and fail closed on empty DNS resolution Add explicit SSRF regression tests for the web_fetch path covering loopback, private LAN ranges, link-local/metadata, IPv6 private/local, redirect-into-private, and unsupported schemes. Harden _public_http_url to fail closed when a hostname resolves to no addresses.
This commit is contained in:
@@ -95,6 +95,10 @@ _TOOL_NAME_MAP = {
|
||||
"search": "web_search",
|
||||
"web_search": "web_search",
|
||||
"websearch": "web_search",
|
||||
"web_fetch": "web_fetch",
|
||||
"webfetch": "web_fetch",
|
||||
"fetch_url": "web_fetch",
|
||||
"fetch": "web_fetch",
|
||||
"read": "read_file",
|
||||
"read_file": "read_file",
|
||||
"cat": "read_file",
|
||||
@@ -305,6 +309,8 @@ def _parse_tool_code_block(raw: str) -> Optional[ToolBlock]:
|
||||
content = xml_params.get("code", args_body)
|
||||
elif mapped == "web_search":
|
||||
content = xml_params.get("query", args_body)
|
||||
elif mapped == "web_fetch":
|
||||
content = xml_params.get("url", args_body)
|
||||
elif mapped in ("read_file", "write_file"):
|
||||
content = xml_params.get("path", xml_params.get("file_path", args_body))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user