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

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog
M
MIT News - Artificial intelligence
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
H
Help Net Security
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
F
Fortinet All Blogs
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
U
Unit 42

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(e2e): reject declared oversized probe bodies · opencl...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -20,6 +20,15 @@ if (!Number.isFinite(maxBodyBytes) || maxBodyBytes <= 0) {

2020

}

2121
2222

async function readBoundedResponseText(response, byteLimit) {

23+

const contentLength = response.headers?.get?.("content-length");

24+

if (contentLength && /^\d+$/u.test(contentLength)) {

25+

const parsedContentLength = Number(contentLength);

26+

if (Number.isSafeInteger(parsedContentLength) && parsedContentLength > byteLimit) {

27+

await response.body?.cancel().catch(() => undefined);

28+

throw new Error(`chat completions response body exceeded ${byteLimit} bytes`);

29+

}

30+

}

31+
2332

const reader = response.body?.getReader();

2433

if (!reader) {

2534

return "";

Original file line numberDiff line numberDiff line change

@@ -105,6 +105,15 @@ function matchesDegradedReadyExpectation(body) {

105105

}

106106
107107

async function readBoundedResponseText(response, byteLimit) {

108+

const contentLength = response.headers?.get?.("content-length");

109+

if (contentLength && /^\d+$/u.test(contentLength)) {

110+

const parsedContentLength = Number(contentLength);

111+

if (Number.isSafeInteger(parsedContentLength) && parsedContentLength > byteLimit) {

112+

await response.body?.cancel().catch(() => undefined);

113+

throw new Error(`${url} probe body exceeded ${byteLimit} bytes`);

114+

}

115+

}

116+
108117

const reader = response.body?.getReader();

109118

if (!reader) {

110119

return "";

Original file line numberDiff line numberDiff line change

@@ -336,4 +336,26 @@ describe("scripts/e2e/lib/openai-chat-tools/client.mjs", () => {

336336

server.close();

337337

}

338338

});

339+
340+

it("rejects declared oversized chat completion bodies before waiting on the stream", async () => {

341+

const server = createServer((_request, response) => {

342+

response.writeHead(200, {

343+

"content-length": "65",

344+

"content-type": "application/json",

345+

});

346+

response.flushHeaders();

347+

});

348+

const port = await listen(server);

349+

try {

350+

const startedAt = Date.now();

351+

const result = await runClient(port, { OPENCLAW_OPENAI_CHAT_TOOLS_MAX_BODY_BYTES: "64" });

352+
353+

expect(result.error).toBeUndefined();

354+

expect(result.status).not.toBe(0);

355+

expect(result.stderr).toContain("chat completions response body exceeded 64 bytes");

356+

expect(Date.now() - startedAt).toBeLessThan(3_500);

357+

} finally {

358+

server.close();

359+

}

360+

});

339361

});

Original file line numberDiff line numberDiff line change

@@ -259,6 +259,45 @@ describe("scripts/e2e/lib/upgrade-survivor/probe-gateway.mjs", () => {

259259

}

260260

});

261261
262+

it("rejects declared oversized probe bodies before waiting on the stream", async () => {

263+

const server = createHttpServer((_request, response) => {

264+

response.writeHead(200, {

265+

"content-length": "65",

266+

"content-type": "application/json",

267+

});

268+

response.flushHeaders();

269+

});

270+

const baseUrl = await listen(server);

271+

const out = path.join(makeTempDir(), "oversized.json");

272+

const startedAt = Date.now();

273+

try {

274+

const result = await runProbe(

275+

[

276+

"--base-url",

277+

baseUrl,

278+

"--path",

279+

"/healthz",

280+

"--expect",

281+

"live",

282+

"--out",

283+

out,

284+

"--timeout-ms",

285+

"1000",

286+

],

287+

5_000,

288+

{ OPENCLAW_UPGRADE_SURVIVOR_PROBE_MAX_BODY_BYTES: "64" },

289+

);

290+
291+

expect(result.error).toBeUndefined();

292+

expect(result.status).not.toBe(0);

293+

expect(result.stderr).toContain(`${baseUrl}/healthz probe body exceeded 64 bytes`);

294+

expect(fs.existsSync(out)).toBe(false);

295+

expect(Date.now() - startedAt).toBeLessThan(3_500);

296+

} finally {

297+

server.close();

298+

}

299+

});

300+
262301

it("bounds probes when a server accepts the connection but never responds", async () => {

263302

const sockets = new Set<Socket>();

264303

const server = createTcpServer((socket) => {