fix(ida): report a procedure IDA cannot resolve as invalid input (#1785)
* test(ida): expect a missing procedure to be reported as invalid input * test(ida): name the invalid_request code and its category for a missing procedure * fix(ida): report a procedure IDA cannot resolve as invalid input * test(ida): pin the missing-procedure issue shape and the lookups that stay unreadable * fix(ida): treat a lookup answer for another query as a producer fault * test(ida): expect an argument-independent issue path and pin legacy error replies and escaping * fix(ida): report a missing procedure without naming an argument path * test(ida): expect provider-derived selectors to stay producer faults in composed workflows * fix(ida): keep provider-derived procedure selectors out of the caller's input errors * test(ida): cover session forwarding, parameter hygiene and structured derived-node errors * docs(ida): describe when procedure resolution blames the caller
This commit is contained in:
@@ -246,6 +246,40 @@ describe("native UI action trace", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("native UI action selector origin", () => {
|
||||
it("marks provider-reported function addresses as derived and the action seed as caller-supplied", async () => {
|
||||
const inner = testAnalysis({
|
||||
procedure_address: () => execution("procedure_address", "0x1000"),
|
||||
});
|
||||
const recorded: { operation: string; origin: unknown }[] = [];
|
||||
|
||||
const result = await new EnhancedTools({
|
||||
execute: async (operation, parameters, options) => {
|
||||
recorded.push({ operation, origin: options?.selectorOrigin });
|
||||
return inner.execute(operation, parameters);
|
||||
},
|
||||
}).execute("trace_native_ui_action", { action: "0x1000" });
|
||||
|
||||
expect(result.ok, "the trace completes").toBe(true);
|
||||
expect(
|
||||
recorded
|
||||
.filter(({ operation }) => operation === "procedure_address")
|
||||
.map(({ origin }) => origin),
|
||||
"the caller's action seed carries no provider origin",
|
||||
).toEqual([undefined]);
|
||||
const probes = recorded.filter(
|
||||
({ operation }) =>
|
||||
operation === "procedure_references" ||
|
||||
operation === "procedure_callees",
|
||||
);
|
||||
expect(probes.length, "relationships were probed").toBeGreaterThan(0);
|
||||
expect(
|
||||
probes.every(({ origin }) => origin === "provider"),
|
||||
"every relationship probe uses a provider-reported address",
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("bounded native UI tracing", () => {
|
||||
it("continues handler traversal from its own depth when another UI branch is deeper", async () => {
|
||||
const deepGraph = {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import type { AnalysisOperationPort } from "../AnalysisProvider.js";
|
||||
import type {
|
||||
AnalysisOperationPort,
|
||||
ExecutionOptions,
|
||||
} from "../AnalysisProvider.js";
|
||||
import {
|
||||
parseRelatedAddresses,
|
||||
referenceKindSchema,
|
||||
@@ -26,8 +29,12 @@ export const readNativeCallRoutes = async (
|
||||
analysis: AnalysisOperationPort,
|
||||
procedure: string,
|
||||
signal?: AbortSignal,
|
||||
selectorOrigin?: ExecutionOptions["selectorOrigin"],
|
||||
) => {
|
||||
const options = signal === undefined ? {} : { signal };
|
||||
const options = {
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
...(selectorOrigin === undefined ? {} : { selectorOrigin }),
|
||||
};
|
||||
const execution = await analysis.execute(
|
||||
"procedure_references",
|
||||
{ procedure, direction: "outgoing" },
|
||||
|
||||
@@ -411,6 +411,7 @@ const addDirectCallees = async (input: {
|
||||
input.analysis,
|
||||
current.address,
|
||||
input.signal,
|
||||
"provider",
|
||||
);
|
||||
examined += 1;
|
||||
if (!execution.ok) {
|
||||
|
||||
@@ -529,3 +529,32 @@ describe("bounded native value dependency composition", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("native value trace selector origin", () => {
|
||||
it("marks only the initial procedure as caller-supplied", async () => {
|
||||
const analyzed: { procedure: unknown; origin: unknown }[] = [];
|
||||
|
||||
const result = await traceNativeValues(
|
||||
{
|
||||
execute: async (operation, parameters, options) => {
|
||||
if (operation === "analyze_function")
|
||||
analyzed.push({
|
||||
procedure: parameters.procedure,
|
||||
origin: options?.selectorOrigin,
|
||||
});
|
||||
return analysis.execute(operation, parameters, options);
|
||||
},
|
||||
},
|
||||
{ procedure: "0x1000" },
|
||||
);
|
||||
|
||||
expect(result.ok, "the trace completes").toBe(true);
|
||||
expect(
|
||||
analyzed,
|
||||
"the caller's procedure is unmarked and the discovered callee is provider-derived",
|
||||
).toEqual([
|
||||
{ procedure: "0x1000", origin: undefined },
|
||||
{ procedure: "0x2000", origin: "provider" },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -57,7 +57,10 @@ export const traceNativeValues = async (
|
||||
const execution = await analysis.execute(
|
||||
"analyze_function",
|
||||
{ procedure: next.procedure },
|
||||
signal === undefined ? {} : { signal },
|
||||
{
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
...(next.depth > 0 ? { selectorOrigin: "provider" as const } : {}),
|
||||
},
|
||||
);
|
||||
decompilations++;
|
||||
if (!execution.ok) {
|
||||
|
||||
Reference in New Issue
Block a user