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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
Y
Y Combinator Blog
IT之家
IT之家
博客园 - 聂微东
L
LangChain Blog
爱范儿
爱范儿
H
Help Net Security
GbyAI
GbyAI
F
Fortinet All Blogs
B
Blog
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
D
DataBreaches.Net
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享

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: avoid plugin install scanner false positives · openc...
steipete · 2026-05-04 · via Recent Commits to openclaw:main

@@ -145,6 +145,8 @@ type SourceRule = {

145145

pattern: RegExp;

146146

/** Secondary context pattern; both must match for the rule to fire. */

147147

requiresContext?: RegExp;

148+

/** If set, secondary context must be within this many lines of the primary match. */

149+

requiresContextWindowLines?: number;

148150

};

149151150152

const LINE_RULES: LineRule[] = [

@@ -205,6 +207,7 @@ const SOURCE_RULES: SourceRule[] = [

205207

"Environment variable access combined with network send — possible credential harvesting",

206208

pattern: /process\.env/,

207209

requiresContext: NETWORK_SEND_CONTEXT_PATTERN,

210+

requiresContextWindowLines: 8,

208211

},

209212

];

210213

@@ -240,6 +243,42 @@ function stripFullLineCommentsForHeuristics(source: string): string {

240243

.join("\n");

241244

}

242245246+

function findSourceRuleMatch(params: {

247+

rule: SourceRule;

248+

source: string;

249+

lines: string[];

250+

}): { line: number; evidence: string } | null {

251+

if (!params.rule.pattern.test(params.source)) {

252+

return null;

253+

}

254+

if (params.rule.requiresContext && !params.rule.requiresContext.test(params.source)) {

255+

return null;

256+

}

257+258+

for (let i = 0; i < params.lines.length; i++) {

259+

if (!params.rule.pattern.test(params.lines[i] ?? "")) {

260+

continue;

261+

}

262+263+

if (params.rule.requiresContext && params.rule.requiresContextWindowLines !== undefined) {

264+

const start = Math.max(0, i - params.rule.requiresContextWindowLines);

265+

const end = Math.min(params.lines.length, i + params.rule.requiresContextWindowLines + 1);

266+

const windowSource = params.lines.slice(start, end).join("\n");

267+

if (!params.rule.requiresContext.test(windowSource)) {

268+

continue;

269+

}

270+

}

271+272+

return { line: i + 1, evidence: params.lines[i] ?? "" };

273+

}

274+275+

if (params.rule.requiresContextWindowLines !== undefined) {

276+

return null;

277+

}

278+279+

return { line: 1, evidence: params.source.slice(0, 120) };

280+

}

281+243282

export function scanSource(source: string, filePath: string): SkillScanFinding[] {

244283

const findings: SkillScanFinding[] = [];

245284

const lines = source.split("\n");

@@ -300,38 +339,22 @@ export function scanSource(source: string, filePath: string): SkillScanFinding[]

300339

continue;

301340

}

302341303-

if (!rule.pattern.test(heuristicSource)) {

304-

continue;

305-

}

306-

if (rule.requiresContext && !rule.requiresContext.test(heuristicSource)) {

342+

const match = findSourceRuleMatch({

343+

rule,

344+

source: heuristicSource,

345+

lines: heuristicLines,

346+

});

347+

if (!match) {

307348

continue;

308349

}

309350310-

// Find the first matching line for evidence + line number

311-

let matchLine = 0;

312-

let matchEvidence = "";

313-

for (let i = 0; i < lines.length; i++) {

314-

if (rule.pattern.test(heuristicLines[i] ?? "")) {

315-

matchLine = i + 1;

316-

matchEvidence = lines[i].trim();

317-

break;

318-

}

319-

}

320-321-

// For source rules, if we can't find a line match the pattern might span

322-

// lines. Report line 0 with truncated source as evidence.

323-

if (matchLine === 0) {

324-

matchLine = 1;

325-

matchEvidence = source.slice(0, 120);

326-

}

327-328351

findings.push({

329352

ruleId: rule.ruleId,

330353

severity: rule.severity,

331354

file: filePath,

332-

line: matchLine,

355+

line: match.line,

333356

message: rule.message,

334-

evidence: truncateEvidence(matchEvidence),

357+

evidence: truncateEvidence(lines[match.line - 1]?.trim() ?? match.evidence.trim()),

335358

});

336359

matchedSourceRules.add(ruleKey);

337360

}