test(windows): normalize risky-path assertions

This commit is contained in:
Peter Steinberger
2026-02-25 01:11:47 +00:00
parent e2362d352d
commit a177b10b79
2 changed files with 8 additions and 4 deletions

View File

@@ -50,7 +50,7 @@ describe("resolveSandboxedMediaSource", () => {
media, media,
sandboxRoot: sandboxDir, sandboxRoot: sandboxDir,
}); });
expect(result).toBe(expected); expect(result).toBe(path.resolve(expected));
}); });
}); });

View File

@@ -439,10 +439,14 @@ describe("security audit", () => {
}); });
it("warns for risky safeBinTrustedDirs entries", async () => { it("warns for risky safeBinTrustedDirs entries", async () => {
const riskyGlobalTrustedDirs =
process.platform === "win32"
? [String.raw`C:\Users\ci-user\bin`, String.raw`C:\Users\ci-user\.local\bin`]
: ["/usr/local/bin", "/tmp/openclaw-safe-bins"];
const cfg: OpenClawConfig = { const cfg: OpenClawConfig = {
tools: { tools: {
exec: { exec: {
safeBinTrustedDirs: ["/usr/local/bin", "/tmp/openclaw-safe-bins"], safeBinTrustedDirs: riskyGlobalTrustedDirs,
}, },
}, },
agents: { agents: {
@@ -464,8 +468,8 @@ describe("security audit", () => {
(f) => f.checkId === "tools.exec.safe_bin_trusted_dirs_risky", (f) => f.checkId === "tools.exec.safe_bin_trusted_dirs_risky",
); );
expect(finding?.severity).toBe("warn"); expect(finding?.severity).toBe("warn");
expect(finding?.detail).toContain("/usr/local/bin"); expect(finding?.detail).toContain(riskyGlobalTrustedDirs[0]);
expect(finding?.detail).toContain("/tmp/openclaw-safe-bins"); expect(finding?.detail).toContain(riskyGlobalTrustedDirs[1]);
expect(finding?.detail).toContain("agents.list.ops.tools.exec"); expect(finding?.detail).toContain("agents.list.ops.tools.exec");
}); });