* test(mcp): expect trace_feature to report references the provider truncated A provider that reports a capped xrefs read makes the trace truncated with a residual unknown for that target. An explicit complete report and a provider that reports nothing leave the trace as before. * fix(mcp): report references a provider truncated in trace_feature Executions gain an optional flag for a capped xrefs read, set by the IDA adapter from the upstream cap. trace_feature marks the trace truncated with a residual unknown for that target only when the provider reports a truncation; a provider that reports nothing keeps its previous result. The trace_feature workflow profile is revised so earlier results are not replayed. * refactor(ida): report reference truncation whenever the runner observed an xrefs cap * test(mcp): cover session forwarding, per-target state, native reports and failures of the trace coverage * test(mcp): format the session forwarding test * test(ida): expect headless IDA to resolve containing procedures from lookups and segment facts Cover positive and negative containment, segment boundaries including addresses above 2^53, failures of the lookup and of the segment survey, cancellation, input validation and the admitted program as the only document. * test(ida): expect feature tracing and address context to work on headless IDA Run trace_feature, including a capped reference read, and inspect_address_context with and without an explicit document through the IDA session client. * test(mcp): expect trace_feature availability to follow the search operations it calls * fix(mcp): derive trace_feature availability from the search operations it calls * feat(ida): resolve containing procedures and report the admitted program as the document The modern headless profile resolves an address through the function lookup and, when no function contains it, tells a mapped address from an unmapped one using the database-scoped minimal survey. A survey that is missing, truncated or inconsistent fails the read. list_documents reports the single admitted program. The attached profiles do not declare either operation. * docs(ida): describe containing procedures, the admitted document and truncated feature traces * test(ida): verify containing procedures, the admitted document and feature tracing on real IDA * docs(testing): list the headless IDA workflows the real lane verifies * test(ida): make each survey failure case isolate a single defect * test(ida): pin large addresses, segment order, document identity, attached refusals and each trace_feature prerequisite * test(mcp): expect a repeated reference source to be resolved once in trace_feature * fix(mcp): resolve the containing procedure of a repeated reference source once * test(ida): trace the fixture procedure and derive probe addresses from its facts in the real lane * test(process): format processCaptureLifecycle.test.ts after the merge * test(ida): declare the alignment each synthetic universal slice offset satisfies * refactor(ida): move the real lane's feature trace assertions into a helper * test(ida): expect the real lane's feature trace check to accept references to every matched address * fix(ida): check each trace reference against its own matched address in the real lane * test(ida): pin that the new operations reject a document other than the admitted program * refactor(ida): move the real lane's mapped non-function probe into a helper * test(ida): expect the real lane's mapped data probe to skip strings inside functions * fix(ida): try the target's strings in order for the mapped non-function probe * test(ida): declare the real lane helper types for the verifier tests * test(ida): expect the real lane to reject a listed string that resolves as unmapped * fix(ida): fail the real lane when a listed string resolves as unmapped
109 lines
4.6 KiB
TypeScript
109 lines
4.6 KiB
TypeScript
import type {
|
|
AnalysisOperation,
|
|
CapabilityDescriptor,
|
|
} from "../application/AnalysisProvider.js";
|
|
|
|
/** This version identifies REA's adapter, not IDA or the upstream MCP server. */
|
|
export const IDA_PROVIDER_IDENTITY = Object.freeze({
|
|
id: "ida",
|
|
name: "IDA MCP adapter",
|
|
version: "1",
|
|
});
|
|
|
|
/** Read-only analyst outcomes supported by the upstream compatibility profiles. */
|
|
export const IDA_OPERATIONS = Object.freeze([
|
|
"list_procedures",
|
|
"search_procedures",
|
|
"list_strings",
|
|
"search_strings",
|
|
"procedure_address",
|
|
"procedure_pseudo_code",
|
|
"procedure_assembly",
|
|
"procedure_callers",
|
|
"procedure_callees",
|
|
"read_function_instructions",
|
|
"xrefs",
|
|
"analyze_function",
|
|
"resolve_containing_procedure",
|
|
"list_documents",
|
|
] as const satisfies readonly Exclude<AnalysisOperation, "health">[]);
|
|
export type IdaOperation = (typeof IDA_OPERATIONS)[number];
|
|
|
|
/** Operations only the modern headless profile implements. */
|
|
const HEADLESS_ONLY_OPERATIONS: ReadonlySet<IdaOperation> = new Set([
|
|
"resolve_containing_procedure",
|
|
"list_documents",
|
|
]);
|
|
|
|
/** Whether the configured profile admits an operation. */
|
|
export const idaProfileAdmits = (
|
|
operation: IdaOperation,
|
|
mode: "attached" | "headless",
|
|
): boolean => mode === "headless" || !HEADLESS_ONLY_OPERATIONS.has(operation);
|
|
|
|
/** Shared limitations of observations from an externally mutable analysis database. */
|
|
export const IDA_LIMITATIONS = Object.freeze([
|
|
"Provider version identifies the REA IDA adapter. IDA engine and upstream distribution versions are unknown unless separately observed; MCP serverInfo is reported independently.",
|
|
"Results describe the current IDA analysis database. Input identity does not prove an unmodified database; patches, annotations, analysis completeness, and database revision remain unknown.",
|
|
"Live results are never replayed from analysis snapshots. Target checks before and after a request do not provide an atomic lock against external GUI changes.",
|
|
"Caller cancellation drains the in-flight MCP request before cleanup; it does not prove that IDA engine work was interrupted.",
|
|
"Headless workers are released through the upstream database lifecycle. Abrupt termination of REA, its proxy, or the supervisor cannot prove worker cleanup; inspect upstream inventory after an interrupted process.",
|
|
"Complete function body ranges, typed references, unresolved indirect calls, referenced data, and basic blocks are unavailable in this adapter. Empty unsupported dossier facets are unknown, not observed absence.",
|
|
]);
|
|
|
|
export const IDA_NATIVE_STRING_LIMITATION =
|
|
"Native string observations use upstream C-string rendering; other string representations remain unknown.";
|
|
|
|
/**
|
|
* Attached mode requires the legacy 1.4 profile, whose `disassemble_function`
|
|
* jumps to the function and whose `decompile_function` opens or reuses a
|
|
* pseudocode view whenever an IDA window is active.
|
|
*/
|
|
const ATTACHED_GUI_NAVIGATION_OPERATIONS: ReadonlySet<IdaOperation> = new Set([
|
|
"procedure_pseudo_code",
|
|
"procedure_assembly",
|
|
"read_function_instructions",
|
|
"analyze_function",
|
|
]);
|
|
|
|
/** Advertise live observations and configured lifecycle effects truthfully. */
|
|
export const idaCapabilities = (
|
|
mode: "attached" | "headless",
|
|
stdio: boolean,
|
|
native = false,
|
|
): readonly CapabilityDescriptor[] =>
|
|
IDA_OPERATIONS.filter((operation) => idaProfileAdmits(operation, mode)).map(
|
|
(operation) => ({
|
|
provider: IDA_PROVIDER_IDENTITY,
|
|
operation,
|
|
...((mode === "headless" || native) && operation === "procedure_callers"
|
|
? ({
|
|
available: false,
|
|
reason: native
|
|
? "The native upstream profile reports code references without proving direct call edges."
|
|
: "The modern upstream profile reports code references without proving direct call edges.",
|
|
} as const)
|
|
: ({ available: true, reason: null } as const)),
|
|
cachePolicy: "live",
|
|
effects: {
|
|
mutatesArtifact: false,
|
|
launchesProcess: stdio || mode === "headless",
|
|
mayShowUi:
|
|
mode === "attached" &&
|
|
(native
|
|
? operation === "procedure_pseudo_code" ||
|
|
operation === "analyze_function"
|
|
: ATTACHED_GUI_NAVIGATION_OPERATIONS.has(operation)),
|
|
mayAccessNetwork: true,
|
|
mayWriteFilesystem: stdio || mode === "headless",
|
|
changesPermissions: false,
|
|
requiresRoot: false,
|
|
},
|
|
limitations:
|
|
native &&
|
|
(operation === "list_strings" || operation === "search_strings")
|
|
? [...IDA_LIMITATIONS, IDA_NATIVE_STRING_LIMITATION]
|
|
: IDA_LIMITATIONS,
|
|
}),
|
|
);
|