feat: v0.8.2 安全纵深补全 · 协议保真 · 断链修复 — 图片SSRF/根MEMORY.md保护根治 · Anthropic thinking回传+pause_turn续传 · 2523 用例全量回归 + E2E 扩充
CI / 类型检查 + Lint + 单元测试 (push) Failing after 9m45s
CI / 全量测试 (Electron ABI) (push) Failing after 6m28s
CI / 产物编译验证 (push) Successful in 11m18s

This commit is contained in:
2026-09-08 14:30:27 +08:00
parent 69776e447f
commit 4cd6e997b5
86 changed files with 4303 additions and 956 deletions
+17 -1
View File
@@ -27,7 +27,7 @@ import {
logTool,
} from './network-utils';
// v0.7.3 P2-1: 可达性预检经 SSRF 校验 + DNS pinning(结果 URL 是不可信外部输入)
import { safeValidateSSRF } from './ssrf-guard';
import { safeValidateSSRF, assertSafeConfigTargetDeep, DeepCheckSoftFailure } from './ssrf-guard';
import { ssrfPinnedFetch } from './ssrf-dispatcher';
import type { WebFetchTool } from './web-fetch';
@@ -579,6 +579,22 @@ export class WebSearchTool implements IMetonaTool {
const headers = buildSearXNGAuthHeaders(config.auth_key, config.auth_type);
const tr = timeRange || config.time_range;
// v0.8.2 P1-6: SearXNG 运行时请求的 SSRF 纵深校验。
// 配置期已有 assertSafeConfigTargetipc/shared 写入链),但 DNS 记录可在配置
// 之后被切换(指向云元数据/链路本地)—— 运行时请求此前完全无校验。此处对
// 每次搜索会话做同口径静态校验 + DNS 深校验;本地回环/RFC1918 合法放行
// SearXNG 常部署本机/内网),DNS 解析失败按 DeepCheckSoftFailure 留痕放行
// (离线实例合法,与配置期深校验语义一致)。
try {
await assertSafeConfigTargetDeep(baseUrl);
} catch (err) {
if (err instanceof DeepCheckSoftFailure) {
logTool('web_search', `[SearXNG] DNS deep check skipped (soft-fail): ${err.message}`);
} else {
throw new Error(`SearXNG target blocked by security policy: ${(err as Error).message}`);
}
}
// SearXNG 标准分页:每页由实例配置决定(通常 10 条),用 pageno 翻页直到达到 maxResults
const maxPages = Math.ceil(maxResults / 5) + 1; // 保守估计,每页至少 5 条
let page = 1;