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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
Recent Announcements
Recent Announcements
L
LangChain Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
D
Docker
WordPress大学
WordPress大学
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The GitHub Blog
The GitHub Blog
博客园 - 叶小钗
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
有赞技术团队
有赞技术团队
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MongoDB | Blog
MongoDB | Blog
博客园 - Franky

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(scripts): cap npm packument reads · openclaw/openclaw...
vincentkoc · 2026-05-30 · via Recent Commits to openclaw:main
11

import { describe, expect, it } from "vitest";

22

import {

33

createTransitiveManifestRiskReport,

4+

fetchNpmManifest,

5+

readBoundedNpmRegistryText,

46

renderTransitiveManifestRiskMarkdownReport,

57

} from "../../scripts/transitive-manifest-risk-report.mjs";

68

@@ -174,4 +176,108 @@ describe("transitive-manifest-risk-report", () => {

174176

expect(markdown).not.toContain("## Notable Findings");

175177

expect(markdown).not.toContain("## Additional Sample Findings");

176178

});

179+180+

it("fetches full npm packuments for the requested manifest version", async () => {

181+

const fetchCalls: Array<{ url: string; accept: string | null }> = [];

182+

const manifest = await fetchNpmManifest({

183+

packageName: "@scope/package",

184+

version: "1.0.0",

185+

registryBaseUrl: "https://registry.example.test",

186+

fetchImpl: async (url, init) => {

187+

fetchCalls.push({

188+

url: String(url),

189+

accept: new Headers(init?.headers).get("accept"),

190+

});

191+

return new Response(

192+

JSON.stringify({

193+

time: {

194+

"1.0.0": "2026-05-12T00:00:00.000Z",

195+

},

196+

versions: {

197+

"1.0.0": {

198+

dependencies: {

199+

exact: "1.2.3",

200+

},

201+

scripts: {

202+

install: "node install.js",

203+

},

204+

},

205+

},

206+

}),

207+

{

208+

status: 200,

209+

},

210+

);

211+

},

212+

});

213+214+

expect(fetchCalls).toEqual([

215+

{

216+

url: "https://registry.example.test/@scope%2fpackage",

217+

accept: "application/json",

218+

},

219+

]);

220+

expect(manifest).toEqual({

221+

publishedAt: "2026-05-12T00:00:00.000Z",

222+

manifest: {

223+

dependencies: {

224+

exact: "1.2.3",

225+

},

226+

scripts: {

227+

install: "node install.js",

228+

},

229+

},

230+

});

231+

});

232+233+

it("rejects npm registry bodies that exceed the content-length cap", async () => {

234+

let canceled = false;

235+

const response = new Response(

236+

new ReadableStream({

237+

cancel() {

238+

canceled = true;

239+

},

240+

}),

241+

{

242+

headers: {

243+

"content-length": "12",

244+

},

245+

},

246+

);

247+248+

await expect(readBoundedNpmRegistryText(response, 8)).rejects.toThrow(

249+

"npm registry response exceeded 8 bytes (content-length 12)",

250+

);

251+

expect(canceled).toBe(true);

252+

});

253+254+

it("rejects npm registry bodies that exceed the content-length cap without a body", async () => {

255+

const response = new Response(null, {

256+

headers: {

257+

"content-length": "12",

258+

},

259+

});

260+261+

await expect(readBoundedNpmRegistryText(response, 8)).rejects.toThrow(

262+

"npm registry response exceeded 8 bytes (content-length 12)",

263+

);

264+

});

265+266+

it("rejects npm registry bodies that grow past the stream cap", async () => {

267+

const encoder = new TextEncoder();

268+

const response = new Response(

269+

new ReadableStream({

270+

start(controller) {

271+

controller.enqueue(encoder.encode("1234"));

272+

controller.enqueue(encoder.encode("5678"));

273+

controller.enqueue(encoder.encode("9"));

274+

controller.close();

275+

},

276+

}),

277+

);

278+279+

await expect(readBoundedNpmRegistryText(response, 8)).rejects.toThrow(

280+

"npm registry response exceeded 8 bytes while reading response body",

281+

);

282+

});

177283

});