feat(ghidra): integrate optional NativeAOT metadata recovery (#748)
* feat(ghidra): integrate optional NativeAOT metadata recovery * fix(ghidra): bind extension snapshots to configured artifacts * test(ghidra): verify lazy NativeAOT startup failures * fix(ghidra): preserve NativeAOT failure reasons and coverage * fix(ghidra): preserve NativeAOT x64 calling conventions * test(ghidra): guard recovered NativeAOT method conventions * fix(ghidra): reject blocking extension file inputs * fix(ghidra): diagnose incompatible NativeAOT extension classes * test(ghidra): verify real extension initialization failures * fix(ghidra): keep extension descriptor fields optional
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { AnalysisCapabilityUnavailableError } from "../../domain/analysisErrorCore.js";
|
||||
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
||||
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
|
||||
import { jsonValueSchema } from "../../domain/jsonValue.js";
|
||||
import {
|
||||
validateGhidraExtensionResults,
|
||||
type GhidraExtension,
|
||||
type GhidraExtensionResult,
|
||||
} from "./GhidraExtensions.js";
|
||||
|
||||
/** Preserve unsupported recovery separately from malformed or failed producers. */
|
||||
export const ghidraExtensionFailure = (
|
||||
extensions: readonly GhidraExtension[],
|
||||
results: readonly GhidraExtensionResult[],
|
||||
operation: string,
|
||||
): AnalysisError | undefined => {
|
||||
const reports = results;
|
||||
const invalid = validateGhidraExtensionResults(extensions, reports);
|
||||
const failed = reports.find(
|
||||
(value) => value.status === "unsupported" || value.status === "failed",
|
||||
);
|
||||
if (invalid === null && failed === undefined) return undefined;
|
||||
return invalid === null && failed?.status === "unsupported"
|
||||
? new AnalysisCapabilityUnavailableError(
|
||||
"ghidra",
|
||||
operation,
|
||||
`${failed.id}: ${failed.reason}. Omit REA_GHIDRA_NATIVEAOT_JAR to continue ordinary native analysis.`,
|
||||
)
|
||||
: new ProviderAdapterError("ghidra", operation, {
|
||||
diagnostics: {
|
||||
reason: invalid ?? failed?.reason ?? "Ghidra extension failed",
|
||||
analysis_extensions: jsonValueSchema.parse(reports),
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user