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:
morluto
2026-09-30 00:41:05 +08:00
committed by GitHub
parent fa26affc86
commit ed933d1893
87 changed files with 6771 additions and 375 deletions
+58 -5
View File
@@ -8,6 +8,7 @@ import {
} from "../domain/hopperValues.js";
import type { JsonValue } from "../domain/jsonValue.js";
import { nativeApiBoundarySchema } from "../domain/nativeApiBoundary.js";
import { nativeValueFlowSchema } from "../domain/nativeValueFlow.js";
import { err, ok, type Result } from "../domain/result.js";
import {
ghidraIdentifierSchema,
@@ -151,10 +152,7 @@ const ghidraNativeApiBoundary = nativeApiBoundarySchema.superRefine(
const addresses = value.jump_tables.flatMap((table) => [
table.dispatch_address,
...table.data_sources.map(({ address }) => address),
...table.mappings.flatMap(({ target_address, data_addresses }) => [
target_address,
...data_addresses,
]),
...table.mappings.map(({ target_address }) => target_address),
]);
if (
addresses.some(
@@ -169,8 +167,63 @@ const ghidraNativeApiBoundary = nativeApiBoundarySchema.superRefine(
},
);
const ghidraNativeValueFlow = nativeValueFlowSchema.superRefine(
(value, context) => {
if (!value.available) return;
const operations = value.operations;
const addresses = operations.flatMap((operation) => [
operation.address,
...operation.inputs.flatMap(({ location }) =>
location === null ? [] : [location],
),
...(operation.output?.location == null
? []
: [operation.output.location]),
]);
if (
addresses.some(
(address) => !ghidraCanonicalAddressSchema.safeParse(address).success,
)
)
context.addIssue({
code: "custom",
message: "Ghidra p-code flow contains a non-canonical address",
});
const operationIds = new Set(operations.map(({ id }) => id));
if (operationIds.size !== operations.length)
context.addIssue({
code: "custom",
message: "Ghidra p-code operation identifiers are not unique",
});
if (
value.def_use.some(
({ definition, use }) =>
!operationIds.has(definition) || !operationIds.has(use),
) ||
value.effects.some(({ operation }) => !operationIds.has(operation))
)
context.addIssue({
code: "custom",
message: "Ghidra p-code relationship references a missing operation",
});
if (
value.truncated !==
(value.omitted_operations_lower_bound > 0 ||
value.known_omitted_inputs > 0 ||
value.known_omitted_edges > 0)
)
context.addIssue({
code: "custom",
message: "Ghidra p-code truncation flag contradicts omitted counts",
});
},
);
const ghidraFunctionDossier = functionDossierSchema
.extend({ native_api: ghidraNativeApiBoundary })
.extend({
native_api: ghidraNativeApiBoundary,
native_value_flow: ghidraNativeValueFlow,
})
.strict()
.superRefine((value, context) => {
const addresses = [