feat(ghidra): enable Windows x64 read-only analysis (#699)

* feat(ghidra): enable Windows x64 read-only analysis

* test(ghidra): exercise native Windows runtime boundaries

* test(ghidra): verify current Windows inventory and isolate ACL observer

* fix(ghidra): align Windows admission and address P0 review
This commit is contained in:
N0zoM1z0 authored and GitHub committed 2026-10-06 16:53:33 +08:00
1 parent cf061159ab
commit 26881da76a
65 files changed
+4091 -356

No files matched your search

+3 -3
View File
@@ -83,7 +83,7 @@ export const parseBinaryTarget = async (
)
return ok({
path,
sourcePath: canonical,
sourcePath: process.platform === "win32" ? candidate : canonical,
sha256: await sha256Handle(handle),
kind: "database",
format: "analysis-database",
@@ -92,7 +92,7 @@ export const parseBinaryTarget = async (
if (artifactFormat !== undefined) {
const identity = {
path,
sourcePath: canonical,
sourcePath: process.platform === "win32" ? candidate : canonical,
sha256: await sha256Handle(handle),
};
return isArchiveFormat(artifactFormat)
@@ -103,7 +103,7 @@ export const parseBinaryTarget = async (
if (!detected.ok) return err(new BinaryTargetError(path, detected.error));
return ok({
path,
sourcePath: canonical,
sourcePath: process.platform === "win32" ? candidate : canonical,
sha256: await sha256Handle(handle),
kind: "executable",
...detected.value,
+2 -1
View File
@@ -63,7 +63,8 @@ export interface DoctorProviderInspection {
readonly configured: boolean;
readonly available: boolean;
readonly providerVersion: string | null;
/** Exact non-secret variables safe to persist in an approved registration. */
/** Adapter-validated non-secret settings, independent of runtime readiness.
* Invalid installations publish no settings. */
readonly registrationEnvironment: Readonly<Record<string, string>>;
readonly checks: readonly DoctorProviderCheck[];
}
@@ -0,0 +1,40 @@
import { describe, expect, it } from "vitest";
import type { DoctorProviderInspection } from "./Doctor.js";
import { providerRegistrationEnvironment } from "./SetupRegistrationEnvironment.js";
const inspection = (
overrides: Partial<DoctorProviderInspection> = {},
): DoctorProviderInspection => ({
id: "fixture",
configured: true,
available: false,
providerVersion: "1",
registrationEnvironment: {
REA_FIXTURE_PROVIDER_ROOT: "C:\\Tools\\Provider",
},
checks: [],
...overrides,
});
describe("provider registration settings", () => {
it("retains valid published paths when runtime capabilities are unavailable", () => {
expect(providerRegistrationEnvironment([inspection()])).toEqual({
REA_FIXTURE_PROVIDER_ROOT: "C:\\Tools\\Provider",
});
});
it("does not invent settings when the adapter cannot publish an installation", () => {
expect(
providerRegistrationEnvironment([
inspection({ configured: false, registrationEnvironment: {} }),
]),
).toEqual({});
});
it("keeps available-provider settings unchanged", () => {
expect(
providerRegistrationEnvironment([inspection({ available: true })]),
).toEqual({ REA_FIXTURE_PROVIDER_ROOT: "C:\\Tools\\Provider" });
});
});
@@ -1,12 +1,11 @@
import type { DoctorProviderInspection } from "./Doctor.js";
/** Select exact non-secret settings published by available providers. */
/** Preserve adapter-published settings independently of runtime readiness. */
export const providerRegistrationEnvironment = (
inspections: readonly DoctorProviderInspection[],
): Readonly<Record<string, string>> =>
Object.fromEntries(
inspections
.filter(({ available }) => available)
.flatMap(({ registrationEnvironment }) =>
Object.entries(registrationEnvironment),
)
+9 -6
View File
@@ -26,6 +26,7 @@ export interface WindowsCapabilityDependencies {
probePrivateAcl(): WindowsCapabilityOutcome;
probeUnixDomainSocket(): WindowsCapabilityOutcome;
probePty(): Promise<ProcessCaptureCapability>;
nativeCapabilities?(): WindowsNativeCapabilitySet;
}
/** Machine-readable facts for features that need Windows-specific security. */
@@ -63,7 +64,9 @@ export const probeWindowsCapabilities = async (
? { available: true, reason: null }
: { available: false, reason: pty.reason },
},
security: windowsNativeCapabilities(dependencies.platform),
security:
dependencies.nativeCapabilities?.() ??
windowsNativeCapabilities(dependencies.platform),
};
};
@@ -73,10 +76,9 @@ const systemDependencies = (): WindowsCapabilityDependencies => ({
probeSymlinkCreation,
probeNoFollowOpen: () =>
systemNoFollowOpenCapability(process.platform, constants.O_NOFOLLOW),
probePrivateAcl: () => ({
available: false,
reason: "Windows ACL enforcement is not implemented by this REA build",
}),
probePrivateAcl: () =>
windowsNativeCapabilities(process.platform).private_runtime_dacl,
nativeCapabilities: () => windowsNativeCapabilities(process.platform),
probeUnixDomainSocket: () =>
process.platform === "win32"
? {
@@ -95,7 +97,8 @@ export const systemNoFollowOpenCapability = (
if (platform === "win32")
return {
available: false,
reason: "Windows reparse-safe handle admission is not implemented",
reason:
"Node pathname O_NOFOLLOW is not Windows handle authority; native admission is reported separately in security.",
};
return typeof noFollow === "number"
? { available: true, reason: null }