fix(ghidra): return complete native analysis results
This commit is contained in:
@@ -111,7 +111,7 @@ const installationHost = (): GhidraInstallationHost => ({
|
||||
|
||||
const sessionInfo = (profileDigest: string, targetSha256: string) => ({
|
||||
name: "REA Ghidra bridge" as const,
|
||||
bridge_version: 6 as const,
|
||||
bridge_version: 7 as const,
|
||||
run_id: "11111111-1111-4111-8111-111111111111",
|
||||
profile_digest: profileDigest,
|
||||
provider: { id: "ghidra" as const, version: "12.1.2" },
|
||||
@@ -240,11 +240,7 @@ const resultBuilders = new Map<GhidraOperation, GhidraResultBuilder>([
|
||||
["xrefs", () => ["0x401001"]],
|
||||
[
|
||||
"analyze_function",
|
||||
(input, _limit) =>
|
||||
ghidraFunctionDossier(
|
||||
input.include_assembly === true,
|
||||
input.procedure === "fixture_truncated",
|
||||
),
|
||||
(input) => ghidraFunctionDossier(input.include_assembly === true),
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
@@ -2,27 +2,25 @@ import { describe, expect, it } from "vitest";
|
||||
import { connectGhidraMcp, sessionEvidence } from "./ghidraMcpHarness.js";
|
||||
|
||||
describe("Ghidra MCP native API evidence", () => {
|
||||
it("records approved native API truncation once and links its evidence", async () => {
|
||||
it("returns complete native API boundaries without output-cap unknowns", async () => {
|
||||
const harness = await connectGhidraMcp("ghidra-native-api");
|
||||
const { mcp, session } = harness;
|
||||
try {
|
||||
const unapprovedInspection = sessionEvidence(
|
||||
const inspection = sessionEvidence(
|
||||
session,
|
||||
(
|
||||
await mcp.callTool({
|
||||
name: "inspect_native_api",
|
||||
arguments: { procedure: "fixture_truncated" },
|
||||
arguments: { procedure: "fixture_main" },
|
||||
})
|
||||
).structuredContent,
|
||||
);
|
||||
expect(unapprovedInspection.normalized_result).toMatchObject({
|
||||
expect(inspection.normalized_result).toMatchObject({
|
||||
boundary: {
|
||||
available: true,
|
||||
jump_tables: [{ mappings_truncated: true }],
|
||||
jump_tables: [{ mappings: [{ target_address: "0x401020" }] }],
|
||||
},
|
||||
residual_unknowns: [
|
||||
expect.stringContaining("additional data sources or targets"),
|
||||
],
|
||||
residual_unknowns: [],
|
||||
});
|
||||
expect(
|
||||
(
|
||||
@@ -32,53 +30,6 @@ describe("Ghidra MCP native API evidence", () => {
|
||||
})
|
||||
).structuredContent,
|
||||
).toMatchObject({ result: { items: [] } });
|
||||
|
||||
const approvedInspection = sessionEvidence(
|
||||
session,
|
||||
(
|
||||
await mcp.callTool({
|
||||
name: "inspect_native_api",
|
||||
arguments: {
|
||||
procedure: "fixture_truncated",
|
||||
unknown_registry_approved: true,
|
||||
},
|
||||
})
|
||||
).structuredContent,
|
||||
);
|
||||
await mcp.callTool({
|
||||
name: "inspect_native_api",
|
||||
arguments: {
|
||||
procedure: "fixture_truncated",
|
||||
unknown_registry_approved: true,
|
||||
},
|
||||
});
|
||||
expect(
|
||||
(
|
||||
await mcp.callTool({
|
||||
name: "list_unknowns",
|
||||
arguments: {},
|
||||
})
|
||||
).structuredContent,
|
||||
).toMatchObject({
|
||||
result: {
|
||||
items: [
|
||||
{
|
||||
status: "open",
|
||||
domain: "native-api",
|
||||
question: expect.stringContaining(
|
||||
"additional data sources or targets",
|
||||
),
|
||||
supporting_evidence_ids: [approvedInspection.evidence_id],
|
||||
recommended_probes: [
|
||||
{
|
||||
operation: "inspect_native_api",
|
||||
rationale: expect.stringContaining("ABI probe"),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await harness.close();
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ describe("GhidraClient", () => {
|
||||
await expect(client.start()).resolves.toMatchObject({
|
||||
ok: true,
|
||||
value: {
|
||||
bridge_version: 6,
|
||||
bridge_version: 7,
|
||||
target: { sha256: TARGET_SHA256 },
|
||||
},
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -178,7 +178,7 @@ const sessionInfo = ({
|
||||
timedOut,
|
||||
}) => ({
|
||||
name: "REA Ghidra bridge",
|
||||
bridge_version: 6,
|
||||
bridge_version: 7,
|
||||
run_id: sessionRunId,
|
||||
profile_digest: digest,
|
||||
provider: { id: "ghidra", version },
|
||||
|
||||
Reference in New Issue
Block a user