mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 12:40:45 +00:00
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import { collectAttackSurfaceSummaryFindings } from "./audit-extra.summary.js";
|
|
|
|
function requireAttackSurfaceSummary(
|
|
findings: ReturnType<typeof collectAttackSurfaceSummaryFindings>,
|
|
) {
|
|
const summary = findings.find((f) => f.checkId === "summary.attack_surface");
|
|
expect(summary).toEqual(
|
|
expect.objectContaining({ checkId: "summary.attack_surface", severity: "info" }),
|
|
);
|
|
if (!summary) {
|
|
throw new Error("Expected attack surface summary finding");
|
|
}
|
|
return summary;
|
|
}
|
|
|
|
describe("security audit attack surface summary", () => {
|
|
it("includes an attack surface summary (info)", () => {
|
|
const cfg: OpenClawConfig = {
|
|
channels: { whatsapp: { groupPolicy: "open" }, telegram: { groupPolicy: "allowlist" } },
|
|
tools: { elevated: { enabled: true, allowFrom: { whatsapp: ["+1"] } } },
|
|
hooks: { enabled: true },
|
|
browser: { enabled: true },
|
|
};
|
|
|
|
const findings = collectAttackSurfaceSummaryFindings(cfg);
|
|
const summary = requireAttackSurfaceSummary(findings);
|
|
|
|
expect(summary.detail).toContain("trust model: personal assistant");
|
|
});
|
|
});
|