fix: make windows CI path handling deterministic

This commit is contained in:
Peter Steinberger
2026-02-22 22:34:42 +00:00
parent 3b0e62d5bf
commit 84e5ab598a
3 changed files with 59 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
import path from "node:path";
import { describe, expect, it } from "vitest";
import {
isInterpreterLikeSafeBin,
@@ -72,16 +73,18 @@ describe("exec safe-bin runtime policy", () => {
});
it("merges explicit safe-bin trusted dirs from global and local config", () => {
const customDir = path.join(path.sep, "custom", "bin");
const agentDir = path.join(path.sep, "agent", "bin");
const policy = resolveExecSafeBinRuntimePolicy({
global: {
safeBinTrustedDirs: [" /custom/bin ", "/custom/bin"],
safeBinTrustedDirs: [` ${customDir} `, customDir],
},
local: {
safeBinTrustedDirs: ["/agent/bin"],
safeBinTrustedDirs: [agentDir],
},
});
expect(policy.trustedSafeBinDirs.has("/custom/bin")).toBe(true);
expect(policy.trustedSafeBinDirs.has("/agent/bin")).toBe(true);
expect(policy.trustedSafeBinDirs.has(path.resolve(customDir))).toBe(true);
expect(policy.trustedSafeBinDirs.has(path.resolve(agentDir))).toBe(true);
});
});