feat(ghidra): apply validated analyzer overrides before analysis
Apply caller-selected analyzer opt-outs before Ghidra analysis, reject unknown or ineffective names, and commit raw/header imports to the same analyzer profile. Use supported x86 raw compiler specs and cover the real analyzer/readback and raw workflows. Adopts the original implementation from #1800 with validated corrections. Refs #1783, #1836. Co-authored-by: akushonkamen <74654766+akushonkamen@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
co-authored by
akushonkamen
Kaoru0822
parent
12ee785e5e
commit
9878bb7296
@@ -14,7 +14,9 @@ import {
|
||||
ghidraSeedLimitations,
|
||||
} from "./GhidraAnalysisSeeds.js";
|
||||
import {
|
||||
ghidraProfileDisabledAnalyzers,
|
||||
ghidraProfileLanguageOverride,
|
||||
sameGhidraDisabledAnalyzers,
|
||||
sameGhidraLanguageOverride,
|
||||
} from "./GhidraAnalysisProfile.js";
|
||||
import type { AnalysisProfileCommitment } from "../domain/analysisProfile.js";
|
||||
@@ -431,6 +433,23 @@ export const createGhidraProviderClient = (input: {
|
||||
},
|
||||
}),
|
||||
);
|
||||
const disabledAnalyzers = ghidraProfileDisabledAnalyzers(
|
||||
committedProfile.parameters,
|
||||
);
|
||||
if (
|
||||
!sameGhidraDisabledAnalyzers(
|
||||
disabledAnalyzers,
|
||||
config.ghidraDisabledAnalyzers,
|
||||
)
|
||||
)
|
||||
return unavailableClient(
|
||||
new ProviderAdapterError("ghidra", "open_binary", {
|
||||
diagnostics: {
|
||||
reason:
|
||||
"The committed analysis profile and REA_GHIDRA_DISABLED_ANALYZERS differ; reopen the target to resolve a new profile.",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const invalidProfile = validateGhidraExtensionProfile(
|
||||
extensions,
|
||||
config,
|
||||
@@ -501,6 +520,9 @@ export const createGhidraProviderClient = (input: {
|
||||
},
|
||||
}),
|
||||
...(languageOverride === undefined ? {} : { languageOverride }),
|
||||
...(config.ghidraDisabledAnalyzers === undefined
|
||||
? {}
|
||||
: { disabledAnalyzers: config.ghidraDisabledAnalyzers }),
|
||||
...(seeds === undefined ? {} : { analysisSeeds: seeds }),
|
||||
platform: installation.platform,
|
||||
...(extensions.length === 0 ? {} : { analysisExtensions: extensions }),
|
||||
|
||||
Reference in New Issue
Block a user