mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 17:51:22 +00:00
34 lines
985 B
TypeScript
34 lines
985 B
TypeScript
import type { OpenClawConfig } from "../config/config.js";
|
|
import type { SecurityAuditFinding } from "./audit.js";
|
|
|
|
let auditDeepModulePromise: Promise<typeof import("./audit.deep.runtime.js")> | undefined;
|
|
|
|
async function loadAuditDeepModule() {
|
|
auditDeepModulePromise ??= import("./audit.deep.runtime.js");
|
|
return await auditDeepModulePromise;
|
|
}
|
|
|
|
export async function collectDeepCodeSafetyFindings(params: {
|
|
cfg: OpenClawConfig;
|
|
stateDir: string;
|
|
deep: boolean;
|
|
summaryCache?: Map<string, Promise<unknown>>;
|
|
}): Promise<SecurityAuditFinding[]> {
|
|
if (!params.deep) {
|
|
return [];
|
|
}
|
|
|
|
const auditDeep = await loadAuditDeepModule();
|
|
return [
|
|
...(await auditDeep.collectPluginsCodeSafetyFindings({
|
|
stateDir: params.stateDir,
|
|
summaryCache: params.summaryCache,
|
|
})),
|
|
...(await auditDeep.collectInstalledSkillsCodeSafetyFindings({
|
|
cfg: params.cfg,
|
|
stateDir: params.stateDir,
|
|
summaryCache: params.summaryCache,
|
|
})),
|
|
];
|
|
}
|