Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tests/claude-integration/claude-desktop-first-party.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { firstPartyDesired } from "../../src/claude/first-party-settings";
import type { OcxConfig } from "../../src/types";
import { removeTreeWithRetry } from "../helpers/remove-tree";
import { flushConfigDirHardeningAndReaps } from "../../src/config/paths";
import { setLocalCaWindowsAclRunnerForTests } from "../../src/claude/intercept/local-ca-windows";
import { resolveCurrentWindowsPrincipal } from "../../src/lib/windows-user-principal";

let root = "";
let lifecycleLock: ReturnType<typeof isolateClientLifecycleLock>;
Expand Down Expand Up @@ -72,10 +74,23 @@ beforeEach(() => {
process.env.OPENCODEX_CLAUDE_DESKTOP_CONFIG_DIR = library;
process.env.CLAUDE_CONFIG_DIR = claudeDir;
writeFileSync(join(root, "config.json"), JSON.stringify(config()));
// The local-CA ACL inspection spawns PowerShell under the shared 30 s principal-lookup budget,
// which a loaded hosted Windows runner can exhaust (local_ca_path_unsafe). This file tests
// first-party apply; claude-intercept-local-ca.test.ts runs the native inspection. Report the
// private ACL for the current SID, which production resolves (and caches) before this runner.
if (process.platform === "win32") {
setLocalCaWindowsAclRunnerForTests((_path, timeoutMs) => {
const sid = resolveCurrentWindowsPrincipal(timeoutMs).replace(/^\*/, "");
return { success: true, exitCode: 0, timedOut: false, stdout: JSON.stringify({
owner: sid, protected: true, rules: [{ sid, type: 0, rights: 2032127 }],
}) };
});
}
});

afterEach(async () => {
await flushConfigDirHardeningAndReaps(root);
try { await flushConfigDirHardeningAndReaps(root); }
finally { setLocalCaWindowsAclRunnerForTests(null); }
lifecycleLock.restore();
for (const key of ENV_KEYS) {
if (previous[key] === undefined) delete process.env[key];
Expand Down
Loading