feat(native): add investigation features (#486)
* 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
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { functionDossierSchema } from "../domain/hopperValues.js";
|
||||
import {
|
||||
GHIDRA_FUNCTION_OPERATIONS,
|
||||
isGhidraFunctionOperation,
|
||||
@@ -147,7 +148,6 @@ describe("Ghidra function-analysis result values", () => {
|
||||
mappings: [
|
||||
{
|
||||
target_address: "0x401020",
|
||||
data_addresses: ["0x403000"],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -157,10 +157,70 @@ describe("Ghidra function-analysis result values", () => {
|
||||
compilable: false,
|
||||
},
|
||||
},
|
||||
native_value_flow: {
|
||||
available: true,
|
||||
provenance: "ghidra-high-pcode",
|
||||
operations: [
|
||||
expect.objectContaining({ id: "0x401000#0", opcode: "COPY" }),
|
||||
],
|
||||
truncated: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects p-code relationships that refer to omitted operation IDs", () => {
|
||||
const dossier = ghidraFunctionDossier();
|
||||
if (
|
||||
typeof dossier !== "object" ||
|
||||
dossier === null ||
|
||||
Array.isArray(dossier)
|
||||
)
|
||||
throw new TypeError("Ghidra dossier fixture is invalid");
|
||||
const flow = dossier.native_value_flow;
|
||||
if (typeof flow !== "object" || flow === null || Array.isArray(flow))
|
||||
throw new TypeError("Ghidra p-code fixture is invalid");
|
||||
expect(
|
||||
parseGhidraFunctionResult("analyze_function", {
|
||||
...dossier,
|
||||
native_value_flow: {
|
||||
...flow,
|
||||
def_use: [
|
||||
{
|
||||
definition: "0x401000#missing",
|
||||
use: "0x401000#0",
|
||||
input_index: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
).toMatchObject({
|
||||
ok: false,
|
||||
error: { _tag: "AnalysisOutputError" },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Ghidra jump-table mapping contract", () => {
|
||||
it("keeps jump-table sources separate from case-to-target mappings", () => {
|
||||
const parsed = parseGhidraFunctionResult(
|
||||
"analyze_function",
|
||||
ghidraFunctionDossier(),
|
||||
);
|
||||
if (!parsed.ok) throw parsed.error;
|
||||
const boundary = functionDossierSchema.parse(parsed.value).native_api;
|
||||
if (boundary?.available !== true)
|
||||
throw new TypeError("Ghidra native API fixture is unavailable");
|
||||
const mapping = boundary.jump_tables[0]?.mappings[0];
|
||||
expect(mapping).toMatchObject({
|
||||
case_value: 0,
|
||||
target_address: "0x401020",
|
||||
});
|
||||
expect(mapping).not.toHaveProperty("data_addresses");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Ghidra function-analysis malformed results", () => {
|
||||
it.each(malformedOutputs())(
|
||||
"rejects malformed %s output",
|
||||
(_name, operation, value) => {
|
||||
|
||||
Reference in New Issue
Block a user