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

推荐订阅源

Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
Google DeepMind News
Google DeepMind News
月光博客
月光博客
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog

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: parallelize plugin package scan · openclaw/openclaw...
steipete · 2026-05-06 · via Recent Commits to openclaw:main

@@ -1,7 +1,8 @@

1-

import { execFileSync } from "node:child_process";

1+

import { execFile } from "node:child_process";

22

import { copyFileSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from "node:fs";

33

import { tmpdir } from "node:os";

44

import { dirname, join, relative, resolve, sep } from "node:path";

5+

import { promisify } from "node:util";

56

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

67

import { isScannable, scanDirectoryWithSummary } from "../security/skill-scanner.js";

78

@@ -18,6 +19,9 @@ type PublishablePluginPackage = {

1819

packageName: string;

1920

};

202122+

const execFileAsync = promisify(execFile);

23+

const PACKAGE_SCAN_CONCURRENCY = 6;

24+2125

const REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS = new Set([

2226

"@openclaw/acpx:dangerous-exec:src/codex-auth-bridge.ts",

2327

"@openclaw/acpx:dangerous-exec:src/runtime-internals/mcp-proxy.mjs",

@@ -61,14 +65,17 @@ function parseNpmPackFiles(raw: string, packageName: string): string[] {

6165

.toSorted();

6266

}

636764-

function collectNpmPackedFiles(packageDir: string, packageName: string): string[] {

65-

const raw = execFileSync("npm", ["pack", "--dry-run", "--json", "--ignore-scripts"], {

66-

cwd: packageDir,

67-

encoding: "utf8",

68-

maxBuffer: 128 * 1024 * 1024,

69-

stdio: ["ignore", "pipe", "pipe"],

70-

});

71-

return parseNpmPackFiles(raw, packageName);

68+

async function collectNpmPackedFiles(packageDir: string, packageName: string): Promise<string[]> {

69+

const { stdout } = await execFileAsync(

70+

"npm",

71+

["pack", "--dry-run", "--json", "--ignore-scripts"],

72+

{

73+

cwd: packageDir,

74+

encoding: "utf8",

75+

maxBuffer: 128 * 1024 * 1024,

76+

},

77+

);

78+

return parseNpmPackFiles(stdout, packageName);

7279

}

73807481

function isScannerWalkedPackedPath(packedPath: string): boolean {

@@ -141,6 +148,72 @@ function collectPublishablePluginPackages(): PublishablePluginPackage[] {

141148

.toSorted((left, right) => left.packageName.localeCompare(right.packageName));

142149

}

143150151+

async function mapWithConcurrency<T, U>(

152+

items: readonly T[],

153+

concurrency: number,

154+

fn: (item: T) => Promise<U>,

155+

): Promise<U[]> {

156+

const results = new Array<U>(items.length);

157+

let nextIndex = 0;

158+

const workerCount = Math.min(concurrency, items.length);

159+

await Promise.all(

160+

Array.from({ length: workerCount }, async () => {

161+

while (nextIndex < items.length) {

162+

const index = nextIndex;

163+

nextIndex += 1;

164+

results[index] = await fn(items[index]!);

165+

}

166+

}),

167+

);

168+

return results;

169+

}

170+171+

async function scanPublishablePluginPackage(plugin: PublishablePluginPackage): Promise<{

172+

reviewedCriticalFindings: string[];

173+

expectedReviewedCriticalFindings: string[];

174+

unexpectedCriticalFindings: string[];

175+

}> {

176+

const reviewedCriticalFindings: string[] = [];

177+

const expectedReviewedCriticalFindings: string[] = [];

178+

const unexpectedCriticalFindings: string[] = [];

179+

const packedFiles = await collectNpmPackedFiles(plugin.packageDir, plugin.packageName);

180+

for (const packedFile of packedFiles) {

181+

const key = `${plugin.packageName}:dangerous-exec:${normalizePackedFindingPath(packedFile)}`;

182+

if (OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDINGS.has(key)) {

183+

expectedReviewedCriticalFindings.push(key);

184+

}

185+

}

186+

const stageDir = stageScannerRelevantPackedFiles(plugin.packageDir, packedFiles);

187+

const summary = await scanDirectoryWithSummary(stageDir, {

188+

excludeTestFiles: true,

189+

maxFiles: 10_000,

190+

});

191+192+

for (const finding of summary.findings) {

193+

if (finding.severity !== "critical") {

194+

continue;

195+

}

196+

const packedPath = normalizePackedFindingPath(

197+

relative(stageDir, finding.file).split(sep).join("/"),

198+

);

199+

const key = `${plugin.packageName}:${finding.ruleId}:${packedPath}`;

200+

if (

201+

REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS.has(key) ||

202+

OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDINGS.has(key)

203+

) {

204+

reviewedCriticalFindings.push(key);

205+

continue;

206+

}

207+

unexpectedCriticalFindings.push([key, `${finding.line}`, finding.evidence].join(":"));

208+

}

209+210+

return {

211+

reviewedCriticalFindings,

212+

expectedReviewedCriticalFindings,

213+

unexpectedCriticalFindings,

214+

};

215+

}

216+144217

describe("publishable plugin npm package install security scan", () => {

145218

it("keeps npm-published plugin files clear of unexpected critical hits", async () => {

146219

const unexpectedCriticalFindings: string[] = [];

@@ -149,37 +222,22 @@ describe("publishable plugin npm package install security scan", () => {

149222

REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS,

150223

);

151224152-

for (const plugin of collectPublishablePluginPackages()) {

153-

const packedFiles = collectNpmPackedFiles(plugin.packageDir, plugin.packageName);

154-

for (const packedFile of packedFiles) {

155-

const key = `${plugin.packageName}:dangerous-exec:${normalizePackedFindingPath(packedFile)}`;

156-

if (OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDINGS.has(key)) {

157-

expectedReviewedCriticalFindings.add(key);

158-

}

225+

const packageResults = await mapWithConcurrency(

226+

collectPublishablePluginPackages(),

227+

PACKAGE_SCAN_CONCURRENCY,

228+

scanPublishablePluginPackage,

229+

);

230+

for (const result of packageResults) {

231+

for (const key of result.expectedReviewedCriticalFindings) {

232+

expectedReviewedCriticalFindings.add(key);

159233

}

160-

const stageDir = stageScannerRelevantPackedFiles(plugin.packageDir, packedFiles);

161-

const summary = await scanDirectoryWithSummary(stageDir, {

162-

excludeTestFiles: true,

163-

maxFiles: 10_000,

164-

});

165-166-

for (const finding of summary.findings) {

167-

if (finding.severity !== "critical") {

168-

continue;

169-

}

170-

const packedPath = normalizePackedFindingPath(

171-

relative(stageDir, finding.file).split(sep).join("/"),

172-

);

173-

const key = `${plugin.packageName}:${finding.ruleId}:${packedPath}`;

174-

if (expectedReviewedCriticalFindings.has(key)) {

175-

reviewedCriticalFindings.add(key);

176-

continue;

177-

}

178-

unexpectedCriticalFindings.push([key, `${finding.line}`, finding.evidence].join(":"));

234+

for (const key of result.reviewedCriticalFindings) {

235+

reviewedCriticalFindings.add(key);

179236

}

237+

unexpectedCriticalFindings.push(...result.unexpectedCriticalFindings);

180238

}

181239182-

expect(unexpectedCriticalFindings).toEqual([]);

240+

expect(unexpectedCriticalFindings.toSorted()).toEqual([]);

183241

expect([...reviewedCriticalFindings].toSorted()).toEqual(

184242

[...expectedReviewedCriticalFindings].toSorted(),

185243

);