fix(comparison): keep unsupported function facets unknown (#2450)
* fix(comparison): keep unsupported function facets unknown * docs(comparison): explain function facet availability * fix(analysis): preserve unavailable facets across Evidence consumers --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -243,6 +243,10 @@ describe("native IDA provider observations", () => {
|
||||
expect(dossier.value.result).toMatchObject({
|
||||
callers: [],
|
||||
callees: [{ address: "0x2000", name: "puts" }],
|
||||
facet_availability: {
|
||||
callers: { available: false },
|
||||
callees: { available: true },
|
||||
},
|
||||
});
|
||||
if (more)
|
||||
expect(dossier.value.limitations).toContain(
|
||||
|
||||
@@ -70,6 +70,9 @@ const identity = (fn: IdaFunction) => ({
|
||||
interface IdaRelationships {
|
||||
readonly items: ReturnType<typeof identity>[];
|
||||
readonly coverage: RelationshipCoverage;
|
||||
readonly availability:
|
||||
| { readonly available: true }
|
||||
| { readonly available: false; readonly reason: string };
|
||||
}
|
||||
|
||||
/** The only lookup answers upstream reports for a name or address that is not a function. */
|
||||
@@ -469,7 +472,14 @@ export class IdaOperationRunner {
|
||||
};
|
||||
if (this.readsCallGraph(direction)) {
|
||||
coverage = await this.addCallGraphCallees(fn, result);
|
||||
return { items: [...result.values()], coverage };
|
||||
return {
|
||||
items: [...result.values()],
|
||||
coverage,
|
||||
availability:
|
||||
coverage.status === "unknown"
|
||||
? { available: false, reason: coverage.reason }
|
||||
: { available: true },
|
||||
};
|
||||
}
|
||||
if (this.protocol === "legacy") {
|
||||
const value = await this.call(
|
||||
@@ -491,6 +501,10 @@ export class IdaOperationRunner {
|
||||
);
|
||||
return {
|
||||
items: [],
|
||||
availability: {
|
||||
available: false,
|
||||
reason: "Upstream xrefs do not establish direct caller relationships.",
|
||||
},
|
||||
coverage: {
|
||||
status: "unknown",
|
||||
reason:
|
||||
@@ -555,7 +569,11 @@ export class IdaOperationRunner {
|
||||
result.set(resolved.address, resolved);
|
||||
}
|
||||
}
|
||||
return { items: [...result.values()], coverage };
|
||||
return {
|
||||
items: [...result.values()],
|
||||
coverage,
|
||||
availability: { available: true },
|
||||
};
|
||||
}
|
||||
|
||||
async run(
|
||||
@@ -694,6 +712,32 @@ export class IdaOperationRunner {
|
||||
basic_blocks: [],
|
||||
native_api: null,
|
||||
native_value_flow: null,
|
||||
facet_availability: {
|
||||
pseudocode:
|
||||
pseudocode === null
|
||||
? { available: false, reason: "IDA did not supply pseudocode." }
|
||||
: { available: true },
|
||||
assembly: { available: true },
|
||||
comments: {
|
||||
available: false,
|
||||
reason: "IDA adapter does not expose typed comments.",
|
||||
},
|
||||
callers: callers.availability,
|
||||
callees: callees.availability,
|
||||
references: {
|
||||
available: false,
|
||||
reason: "IDA adapter does not expose typed reference edges.",
|
||||
},
|
||||
strings_names: {
|
||||
available: false,
|
||||
reason:
|
||||
"IDA adapter does not expose function-referenced strings and names.",
|
||||
},
|
||||
cfg: {
|
||||
available: false,
|
||||
reason: "IDA adapter does not expose basic blocks.",
|
||||
},
|
||||
},
|
||||
limitations: [
|
||||
...IDA_LIMITATIONS,
|
||||
...this.limitations,
|
||||
|
||||
Reference in New Issue
Block a user