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

推荐订阅源

Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
宝玉的分享
宝玉的分享
量子位
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
J
Java Code Geeks
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
S
SegmentFault 最新的问题
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
小众软件
小众软件
The Cloudflare Blog
Y
Y Combinator Blog
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
IT之家
IT之家

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
test: generalize media fetch token fixtures · openclaw/op...
steipete · 2026-04-22 · via Recent Commits to openclaw:main

@@ -57,27 +57,27 @@ async function expectRemoteMediaMaxBytesError(params: {

5757

).rejects.toThrow("exceeds maxBytes");

5858

}

595960-

async function expectRedactedTelegramFetchError(params: {

61-

telegramFileUrl: string;

62-

telegramToken: string;

63-

redactedTelegramToken: string;

60+

async function expectRedactedBotTokenFetchError(params: {

61+

botFileUrl: string;

62+

botToken: string;

63+

redactedBotToken: string;

6464

fetchImpl: Parameters<typeof fetchRemoteMedia>[0]["fetchImpl"];

6565

}) {

6666

const error = await fetchRemoteMedia({

67-

url: params.telegramFileUrl,

67+

url: params.botFileUrl,

6868

fetchImpl: params.fetchImpl,

6969

lookupFn: makeLookupFn(),

7070

maxBytes: 1024,

7171

ssrfPolicy: {

72-

allowedHostnames: ["api.telegram.org"],

72+

allowedHostnames: ["files.example.test"],

7373

allowRfc2544BenchmarkRange: true,

7474

},

7575

}).catch((err: unknown) => err as Error);

76767777

expect(error).toBeInstanceOf(Error);

7878

const errorText = error instanceof Error ? String(error) : "";

79-

expect(errorText).not.toContain(params.telegramToken);

80-

expect(errorText).toContain(`bot${params.redactedTelegramToken}`);

79+

expect(errorText).not.toContain(params.botToken);

80+

expect(errorText).toContain(`bot${params.redactedBotToken}`);

8181

}

82828383

async function expectFetchRemoteMediaRejected(params: {

@@ -172,9 +172,9 @@ function createFetchRemoteMediaParams(

172172

}

173173174174

describe("fetchRemoteMedia", () => {

175-

const telegramToken = "123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZabcd";

176-

const redactedTelegramToken = `${telegramToken.slice(0, 6)}${telegramToken.slice(-4)}`;

177-

const telegramFileUrl = `https://api.telegram.org/file/bot${telegramToken}/photos/1.jpg`;

175+

const botToken = "123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZabcd";

176+

const redactedBotToken = `${botToken.slice(0, 6)}${botToken.slice(-4)}`;

177+

const botFileUrl = `https://files.example.test/file/bot${botToken}/photos/1.jpg`;

178178179179

beforeAll(async () => {

180180

({ fetchRemoteMedia } = await import("./fetch.js"));

@@ -225,20 +225,20 @@ describe("fetchRemoteMedia", () => {

225225226226

it.each([

227227

{

228-

name: "redacts Telegram bot tokens from fetch failure messages",

228+

name: "redacts bot tokens from fetch failure messages",

229229

fetchImpl: vi.fn(async () => {

230-

throw new Error(`dial failed for ${telegramFileUrl}`);

230+

throw new Error(`dial failed for ${botFileUrl}`);

231231

}),

232232

},

233233

{

234-

name: "redacts Telegram bot tokens from HTTP error messages",

234+

name: "redacts bot tokens from HTTP error messages",

235235

fetchImpl: vi.fn(async () => new Response("unauthorized", { status: 401 })),

236236

},

237237

] as const)("$name", async ({ fetchImpl }) => {

238-

await expectRedactedTelegramFetchError({

239-

telegramFileUrl,

240-

telegramToken,

241-

redactedTelegramToken,

238+

await expectRedactedBotTokenFetchError({

239+

botFileUrl,

240+

botToken,

241+

redactedBotToken,

242242

fetchImpl,

243243

});

244244

});

@@ -295,7 +295,7 @@ describe("fetchRemoteMedia", () => {

295295

const fetchImpl = vi.fn(async () => new Response("ok", { status: 200 }));

296296297297

await fetchRemoteMedia({

298-

url: "https://api.telegram.org/file/bot123/photos/test.jpg",

298+

url: "https://files.example.test/file/bot123/photos/test.jpg",

299299

fetchImpl,

300300

lookupFn: makeLookupFn(),

301301

trustExplicitProxyDns: true,