Cheng Wang ea849650ef feat: improve web_fetch URL validation and security
Add URL validation and redirect limits to web_fetch tool to prevent potential security issues:

- Add _validate_url() function to validate URLs before fetching
  - Only allow http:// and https:// schemes (prevent file://, ftp://, etc.)
  - Verify URL has valid scheme and domain
  - Return descriptive error messages for invalid URLs

- Limit HTTP redirects to 5 (down from default 20) to prevent DoS attacks
  - Add MAX_REDIRECTS constant for easy configuration
  - Explicitly configure httpx.AsyncClient with max_redirects parameter

- Improve error handling with JSON error responses for validation failures

This addresses security concerns identified in code review where web_fetch
had no URL validation or redirect limits, potentially allowing:
- Unsafe URL schemes (file://, etc.)
- Redirect-based DoS attacks
- Invalid URL formats causing unclear errors
2026-02-02 19:34:22 +08:00
..
2026-02-01 07:36:42 +00:00
2026-02-01 18:35:27 +00:00
2026-02-01 07:36:42 +00:00
2026-02-01 07:36:42 +00:00
2026-02-01 07:36:42 +00:00
2026-02-01 18:45:42 +00:00
2026-02-01 07:36:42 +00:00
2026-02-01 07:36:42 +00:00
2026-02-01 07:36:42 +00:00