惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
博客园_首页
量子位
雷峰网
雷峰网
GbyAI
GbyAI
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Cloudflare Blog
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(memory-host-sdk): use TRUSTED_ENV_PROXY mode for remo...
DhtIsCoding · 2026-04-25 · via Recent Commits to openclaw:main

@@ -1,12 +1,9 @@

11

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

223-

const { fetchWithSsrFGuardMock, hasEnvHttpProxyConfiguredMock, matchesNoProxyMock } = vi.hoisted(

4-

() => ({

5-

fetchWithSsrFGuardMock: vi.fn(),

6-

hasEnvHttpProxyConfiguredMock: vi.fn(() => false),

7-

matchesNoProxyMock: vi.fn(() => false),

8-

}),

9-

);

3+

const { fetchWithSsrFGuardMock, shouldUseEnvHttpProxyForUrlMock } = vi.hoisted(() => ({

4+

fetchWithSsrFGuardMock: vi.fn(),

5+

shouldUseEnvHttpProxyForUrlMock: vi.fn(() => false),

6+

}));

107118

vi.mock("../infra/net/fetch-guard.js", async () => {

129

const actual = await vi.importActual<typeof import("../infra/net/fetch-guard.js")>(

@@ -24,8 +21,7 @@ vi.mock("../infra/net/proxy-env.js", async () => {

2421

);

2522

return {

2623

...actual,

27-

hasEnvHttpProxyConfigured: hasEnvHttpProxyConfiguredMock,

28-

matchesNoProxy: matchesNoProxyMock,

24+

shouldUseEnvHttpProxyForUrl: shouldUseEnvHttpProxyForUrlMock,

2925

};

3026

});

3127

@@ -42,8 +38,7 @@ import {

4238

} from "./shared.js";

43394440

beforeEach(() => {

45-

hasEnvHttpProxyConfiguredMock.mockReturnValue(false);

46-

matchesNoProxyMock.mockReturnValue(false);

41+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(false);

4742

});

48434944

afterEach(() => {

@@ -417,7 +412,7 @@ describe("fetchWithTimeoutGuarded", () => {

417412

});

418413419414

it("does not set a guarded fetch mode when no HTTP proxy env is configured", async () => {

420-

hasEnvHttpProxyConfiguredMock.mockReturnValue(false);

415+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(false);

421416

fetchWithSsrFGuardMock.mockResolvedValue({

422417

response: new Response(null, { status: 200 }),

423418

finalUrl: "https://example.com",

@@ -432,7 +427,7 @@ describe("fetchWithTimeoutGuarded", () => {

432427

});

433428434429

it("auto-selects trusted env proxy mode when HTTP proxy env is configured", async () => {

435-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

430+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(true);

436431

fetchWithSsrFGuardMock.mockResolvedValue({

437432

response: new Response(null, { status: 200 }),

438433

finalUrl: "https://api.minimax.io",

@@ -454,7 +449,7 @@ describe("fetchWithTimeoutGuarded", () => {

454449

});

455450456451

it("respects an explicit mode from the caller when HTTP proxy env is configured", async () => {

457-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

452+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(true);

458453

fetchWithSsrFGuardMock.mockResolvedValue({

459454

response: new Response(null, { status: 200 }),

460455

finalUrl: "https://api.example.com",

@@ -473,7 +468,7 @@ describe("fetchWithTimeoutGuarded", () => {

473468

});

474469475470

it("auto-upgrades transcription requests to trusted env proxy when proxy env is configured", async () => {

476-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

471+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(true);

477472

fetchWithSsrFGuardMock.mockResolvedValue({

478473

response: new Response(null, { status: 200 }),

479474

finalUrl: "https://api.openai.com",

@@ -495,7 +490,7 @@ describe("fetchWithTimeoutGuarded", () => {

495490

});

496491497492

it("forwards an explicit mode override through postJsonRequest even when proxy env is configured", async () => {

498-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

493+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(true);

499494

fetchWithSsrFGuardMock.mockResolvedValue({

500495

response: new Response(null, { status: 200 }),

501496

finalUrl: "https://api.example.com",

@@ -518,7 +513,7 @@ describe("fetchWithTimeoutGuarded", () => {

518513

});

519514520515

it("forwards an explicit mode override through postTranscriptionRequest even when proxy env is configured", async () => {

521-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

516+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(true);

522517

fetchWithSsrFGuardMock.mockResolvedValue({

523518

response: new Response(null, { status: 200 }),

524519

finalUrl: "https://api.example.com",

@@ -541,11 +536,11 @@ describe("fetchWithTimeoutGuarded", () => {

541536

});

542537543538

it("does not auto-upgrade when only ALL_PROXY is configured (HTTP(S) proxy gate)", async () => {

544-

// ALL_PROXY is ignored by EnvHttpProxyAgent; `hasEnvHttpProxyConfigured`

539+

// ALL_PROXY is ignored by EnvHttpProxyAgent; the shared proxy URL helper

545540

// reflects that by returning false when only ALL_PROXY is set. Auto-upgrade

546541

// must NOT fire, otherwise the request would skip pinned-DNS/SSRF checks

547542

// and then be dispatched directly.

548-

hasEnvHttpProxyConfiguredMock.mockReturnValue(false);

543+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(false);

549544

fetchWithSsrFGuardMock.mockResolvedValue({

550545

response: new Response(null, { status: 200 }),

551546

finalUrl: "https://api.example.com",

@@ -568,7 +563,7 @@ describe("fetchWithTimeoutGuarded", () => {

568563

// Callers with custom proxy URL / proxyTls / connect options must keep

569564

// control over the dispatcher. Auto-upgrade would build an

570565

// EnvHttpProxyAgent that silently drops those overrides.

571-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

566+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(true);

572567

fetchWithSsrFGuardMock.mockResolvedValue({

573568

response: new Response(null, { status: 200 }),

574569

finalUrl: "https://api.example.com",

@@ -595,8 +590,7 @@ describe("fetchWithTimeoutGuarded", () => {

595590

// for NO_PROXY matches, but in TRUSTED_ENV_PROXY mode fetchWithSsrFGuard

596591

// skips pinned-DNS checks — so auto-upgrading those targets would bypass

597592

// SSRF protection. Keep strict mode for NO_PROXY matches.

598-

hasEnvHttpProxyConfiguredMock.mockReturnValue(true);

599-

matchesNoProxyMock.mockReturnValue(true);

593+

shouldUseEnvHttpProxyForUrlMock.mockReturnValue(false);

600594

fetchWithSsrFGuardMock.mockResolvedValue({

601595

response: new Response(null, { status: 200 }),

602596

finalUrl: "https://internal.corp.example",