Files
rea/tests/windowsCapabilities.test.ts
T
N0zoM1z0 6b1fd166b0 feat(ghidra): define the Windows P0 admission boundary
Admit only native x86-64 PE applications when the Ghidra candidate runs on Windows while preserving the existing Linux format matrix. Add precise rejection codes for executable roles and managed targets, publish a machine-readable Windows capability report, and keep missing no-follow, ACL, Unix-socket, and PTY controls as independent observations rather than inferred support.
2026-07-17 03:05:19 +09:00

82 lines
2.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
probeWindowsCapabilities,
type WindowsCapabilityDependencies,
} from "../src/application/WindowsCapabilities.js";
const dependencies = (
overrides: Partial<WindowsCapabilityDependencies> = {},
): WindowsCapabilityDependencies => ({
platform: "win32",
architecture: "x64",
probeSymlinkCreation: () =>
Promise.resolve({ available: false, reason: "EPERM" }),
probeNoFollowOpen: () => ({
available: false,
reason: "O_NOFOLLOW is unavailable in this Node runtime",
}),
probePrivateAcl: () => ({
available: false,
reason: "Windows ACL enforcement is not implemented by this REA build",
}),
probeUnixDomainSocket: () => ({
available: false,
reason: "Node path-based IPC uses named pipes on Windows",
}),
probePty: () =>
Promise.resolve({
available: false,
backend: "node-pty",
reason: "probe unavailable",
}),
...overrides,
});
describe("Windows host capability report", () => {
it("keeps unavailable security controls explicit", async () => {
await expect(probeWindowsCapabilities(dependencies())).resolves.toEqual({
platform: "win32",
architecture: "x64",
capabilities: {
symlink_creation: { available: false, reason: "EPERM" },
no_follow_open: {
available: false,
reason: "O_NOFOLLOW is unavailable in this Node runtime",
},
private_acl: {
available: false,
reason:
"Windows ACL enforcement is not implemented by this REA build",
},
unix_domain_socket: {
available: false,
reason: "Node path-based IPC uses named pipes on Windows",
},
pty: { available: false, reason: "probe unavailable" },
},
});
});
it("reports successful probes independently", async () => {
const result = await probeWindowsCapabilities(
dependencies({
probeSymlinkCreation: () =>
Promise.resolve({ available: true, reason: null }),
probePty: () =>
Promise.resolve({ available: true, backend: "node-pty" }),
}),
);
expect(result.capabilities.symlink_creation).toEqual({
available: true,
reason: null,
});
expect(result.capabilities.pty).toEqual({
available: true,
reason: null,
});
expect(result.capabilities.private_acl.available).toBe(false);
});
});