mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 09:48:39 +00:00
test(windows): normalize risky-path assertions
This commit is contained in:
@@ -50,7 +50,7 @@ describe("resolveSandboxedMediaSource", () => {
|
|||||||
media,
|
media,
|
||||||
sandboxRoot: sandboxDir,
|
sandboxRoot: sandboxDir,
|
||||||
});
|
});
|
||||||
expect(result).toBe(expected);
|
expect(result).toBe(path.resolve(expected));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user