diff --git a/src/tools/web_fetch.rs b/src/tools/web_fetch.rs index 113b62d..f78d80a 100644 --- a/src/tools/web_fetch.rs +++ b/src/tools/web_fetch.rs @@ -64,6 +64,11 @@ impl WebFetchTool { async fn fetch_content(&self, url: &str) -> Result { let client = reqwest::Client::builder() .timeout(Duration::from_secs(self.timeout_secs)) + // 禁用重定向:validate_url 只校验初始 URL 的 host, + // 若跟随 302 跳转,攻击者可用公网 URL 重定向到 + // 169.254.169.254(云元数据)或 127.0.0.1 等内网地址, + // 绕过 is_private_host 的 SSRF 防护。 + .redirect(reqwest::redirect::Policy::none()) .build() .map_err(|e| format!("Failed to create HTTP client: {}", e))?;