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.
This commit is contained in:
N0zoM1z0
2026-07-17 03:05:19 +09:00
committed by N0zoM1z0
parent 24274fe6b6
commit 6b1fd166b0
10 changed files with 323 additions and 14 deletions
+48
View File
@@ -128,6 +128,54 @@ describe("Ghidra provider", () => {
});
});
it("admits only native x86-64 PE applications on Windows P0", () => {
const ghidra = provider({ ...installationHost(), platform: "win32" });
const nativeApplication: BinaryTarget = {
...executableTarget("pe", "x86_64"),
executableRole: "application",
managed: false,
};
expect(ghidra.inspectTargetSupport(nativeApplication)).toMatchObject({
status: "supported",
diagnostics: {
host_platform: "win32",
executable_role: "application",
managed: false,
},
});
expect(
ghidra.inspectTargetSupport({
...nativeApplication,
executableRole: "shared-library",
}),
).toMatchObject({
status: "unsupported",
code: "target_role_unsupported",
});
expect(
ghidra.inspectTargetSupport({ ...nativeApplication, managed: true }),
).toMatchObject({
status: "unsupported",
code: "managed_target_unsupported",
});
expect(
ghidra.inspectTargetSupport({ ...nativeApplication, format: "elf" }),
).toMatchObject({
status: "unsupported",
code: "target_format_unsupported",
});
expect(
ghidra.inspectTargetSupport({
...nativeApplication,
architecture: "arm64",
}),
).toMatchObject({
status: "unsupported",
code: "architecture_unsupported",
});
});
it("commits exact provider, isolation, and resource semantics", async () => {
const callTool = vi.fn().mockResolvedValue(
ok({
+81
View File
@@ -0,0 +1,81 @@
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);
});
});