





















@@ -1,6 +1,6 @@
11import { Type } from "typebox";
22import type { OpenClawConfig } from "../../config/types.openclaw.js";
3-import { SsrFBlockedError, type LookupFn } from "../../infra/net/ssrf.js";
3+import { SsrFBlockedError, type LookupFn, type SsrFPolicy } from "../../infra/net/ssrf.js";
44import { logDebug } from "../../logger.js";
55import type { RuntimeWebFetchMetadata } from "../../secrets/runtime-web-tools.types.js";
66import { wrapExternalContent, wrapWebContent } from "../../security/external-content.js";
@@ -274,6 +274,7 @@ type WebFetchRuntimeParams = {
274274config?: OpenClawConfig;
275275ssrfPolicy?: {
276276allowRfc2544BenchmarkRange?: boolean;
277+allowIpv6UniqueLocalRange?: boolean;
277278};
278279lookupFn?: LookupFn;
279280resolveProviderFallback: () => Promise<WebFetchProviderFallback>;
@@ -389,8 +390,16 @@ async function maybeFetchProviderWebFetchPayload(
389390390391async function runWebFetch(params: WebFetchRuntimeParams): Promise<Record<string, unknown>> {
391392const allowRfc2544BenchmarkRange = params.ssrfPolicy?.allowRfc2544BenchmarkRange === true;
393+const allowIpv6UniqueLocalRange = params.ssrfPolicy?.allowIpv6UniqueLocalRange === true;
394+const ssrfPolicy: SsrFPolicy | undefined =
395+allowRfc2544BenchmarkRange || allowIpv6UniqueLocalRange
396+ ? {
397+ ...(allowRfc2544BenchmarkRange ? { allowRfc2544BenchmarkRange } : {}),
398+ ...(allowIpv6UniqueLocalRange ? { allowIpv6UniqueLocalRange } : {}),
399+}
400+ : undefined;
392401const cacheKey = normalizeCacheKey(
393-`fetch:${params.url}:${params.extractMode}:${params.maxChars}${allowRfc2544BenchmarkRange ? ":allow-rfc2544" : ""}`,
402+`fetch:${params.url}:${params.extractMode}:${params.maxChars}${allowRfc2544BenchmarkRange ? ":allow-rfc2544" : ""}${allowIpv6UniqueLocalRange ? ":allow-ipv6-ula" : ""}`,
394403);
395404const cached = readCache(FETCH_CACHE, cacheKey);
396405if (cached) {
@@ -418,7 +427,7 @@ async function runWebFetch(params: WebFetchRuntimeParams): Promise<Record<string
418427maxRedirects: params.maxRedirects,
419428timeoutSeconds: params.timeoutSeconds,
420429lookupFn: params.lookupFn,
421-policy: allowRfc2544BenchmarkRange ? { allowRfc2544BenchmarkRange } : undefined,
430+policy: ssrfPolicy,
422431init: {
423432headers: {
424433Accept: "text/markdown, text/html;q=0.9, */*;q=0.1",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。