* feat(native): add UI and dispatch investigation workflows * feat(ghidra): support macOS host validation * docs: update native investigation capabilities * feat(artifacts): decode compiled Interface Builder archives * feat(ghidra): expose bounded p-code value flow * test(ghidra): split host and cross-format verification * fix(verify): follow complete result contracts * refactor: remove unused authorization and schema helpers * refactor: remove unused evidence result alias * fix(ghidra): report jump-table evidence precisely * fix(verify): align browser scenario fixture schema * fix(setup): compare parsed client config structurally * test(ghidra): verify AArch64 jump-table mappings * fix(ghidra): recover AArch64 byte jump tables * test(artifacts): verify compiled interface builder archives * feat(native): trace UI actions through handlers * fix(tests): update native trace and shutdown fixtures * fix(verification): diagnose browser scenario failures * fix(browser): wrap scenario snapshots in capture state * fix(native): bind and bound investigation workflows * fix(artifacts): preserve bounded interface builder evidence * fix(ghidra): enforce admitted hosts and preflight tools * fix(native): preserve trace cancellation and bounds * test(application): expect bound analysis target evidence * fix(native): preserve investigation bounds and cancellation * fix(application): preserve bundle and unresolved trace evidence * style(test): format artifact subject fixture
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
import type {
|
|
DoctorProviderCheck,
|
|
DoctorProviderInspection,
|
|
} from "../application/Doctor.js";
|
|
import {
|
|
inspectGhidraInstallation,
|
|
type GhidraInstallationCheck,
|
|
type GhidraInstallationInspection,
|
|
} from "./GhidraInstallation.js";
|
|
|
|
/** Project adapter-owned installation facts into the generic doctor contract. */
|
|
export const projectGhidraDoctorInspection = (
|
|
inspection: GhidraInstallationInspection,
|
|
): DoctorProviderInspection => ({
|
|
id: "ghidra",
|
|
configured: inspection.installDir !== null,
|
|
available: inspection.status === "available",
|
|
providerVersion: inspection.providerVersion,
|
|
registrationEnvironment:
|
|
inspection.status === "available"
|
|
? {
|
|
GHIDRA_INSTALL_DIR: inspection.installDir,
|
|
JAVA_HOME: inspection.javaHome,
|
|
}
|
|
: {},
|
|
checks: selectedChecks(inspection).map((check) =>
|
|
projectCheck(check, inspection.installDir !== null),
|
|
),
|
|
});
|
|
|
|
/** Inspect the process-configured BYO Ghidra installation for `rea doctor`. */
|
|
export const inspectSystemGhidraProvider =
|
|
(): Promise<DoctorProviderInspection> =>
|
|
Promise.resolve(
|
|
projectGhidraDoctorInspection(
|
|
inspectGhidraInstallation({
|
|
...(process.env.GHIDRA_INSTALL_DIR === undefined
|
|
? {}
|
|
: { installDir: process.env.GHIDRA_INSTALL_DIR }),
|
|
...(process.env.JAVA_HOME === undefined
|
|
? {}
|
|
: { javaHome: process.env.JAVA_HOME }),
|
|
}),
|
|
),
|
|
);
|
|
|
|
const selectedChecks = (
|
|
inspection: GhidraInstallationInspection,
|
|
): readonly GhidraInstallationCheck[] => {
|
|
const byName = new Map(
|
|
inspection.checks.map((candidate) => [candidate.name, candidate]),
|
|
);
|
|
const configuration = byName.get("configuration");
|
|
if (configuration === undefined) return [];
|
|
if (configuration.status === "failed") return [configuration];
|
|
const installation = byName.get("installation");
|
|
return [
|
|
configuration,
|
|
byName.get("platform"),
|
|
byName.get("architecture"),
|
|
installation,
|
|
...(installation?.status === "passed"
|
|
? [
|
|
byName.get("version"),
|
|
byName.get("headless"),
|
|
byName.get("native_decompiler"),
|
|
]
|
|
: []),
|
|
byName.get("java"),
|
|
].filter((candidate): candidate is GhidraInstallationCheck =>
|
|
Boolean(candidate),
|
|
);
|
|
};
|
|
|
|
const projectCheck = (
|
|
check: GhidraInstallationCheck,
|
|
configured: boolean,
|
|
): DoctorProviderCheck => ({
|
|
name: check.name,
|
|
ok: check.status === "passed",
|
|
code: check.status === "failed" ? check.code : null,
|
|
detail: check.detail,
|
|
remediation: check.status === "failed" ? check.remediation : null,
|
|
classification:
|
|
check.name === "platform" || check.name === "architecture"
|
|
? "unsupported_host"
|
|
: check.name === "java" &&
|
|
check.status === "failed" &&
|
|
check.code === "runtime_missing"
|
|
? "missing_dependency"
|
|
: configured
|
|
? "config_drift"
|
|
: "missing_analysis_engine",
|
|
});
|