feat(ghidra): admit bounded PSP ELF through installed Allegrex (#1599)
* feat(ghidra): admit bounded PSP ELF through installed Allegrex Build on merged generic MIPS without weakening its policy. Bind caller-installed processor files into the analysis profile, check them again before launch, force and verify PSP language selection, retain limitations, and extend the public CLI/MCP verifier with source-owned PSP and target-switching checks. Local actual focused Vitest: 102 passed, one existing permission skip. Hosted static and real-provider results are pending. * fix(ghidra): validate PSPSDK ABI records in PSP admission * test(ghidra): bind PSP ABI verification to snapshot profiles * test(ghidra): declare independent PSP ABI reader contract * test(ghidra): retain the PSP fixture discriminated type * test(ghidra): contextually type PSP metadata as the MIPS target variant * test(ghidra): keep carved firmware checks scoped to generic MIPS fixtures * style(ghidra): format PSP language-override guard * style(test): format PSP language override regressions * fix(ghidra): bound PSP extension enumeration before allocation --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
co-authored by
github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
morluto
parent
0153b4d95b
commit
e4407dbed5
@@ -49,6 +49,11 @@ import {
|
||||
ghidraInstallationDiagnostics,
|
||||
type GhidraInstallationInspection,
|
||||
} from "./GhidraInstallation.js";
|
||||
import {
|
||||
isGhidraPspTarget,
|
||||
GHIDRA_PSP_LIMITATIONS,
|
||||
} from "./GhidraPspProfile.js";
|
||||
import { ghidraPspExtensionSchema } from "./GhidraPspExtension.js";
|
||||
import { unverifiedGhidraBuildLimitation } from "./GhidraInstallationPolicy.js";
|
||||
import { GhidraHeadlessLauncher } from "./GhidraLauncher.js";
|
||||
import { attestGhidraNativeLoadImage } from "./GhidraLoadImageAttest.js";
|
||||
@@ -353,6 +358,26 @@ export const createGhidraProviderClient = (input: {
|
||||
);
|
||||
if (!prerequisites.ok) return unavailableClient(prerequisites.error);
|
||||
const committedProfile = prerequisites.value.profile;
|
||||
const psp = isGhidraPspTarget(target);
|
||||
const pspExtension = psp
|
||||
? ghidraPspExtensionSchema.safeParse(
|
||||
committedProfile.parameters.psp_extension,
|
||||
)
|
||||
: null;
|
||||
if (
|
||||
pspExtension !== null &&
|
||||
(!pspExtension.success ||
|
||||
committedProfile.parameters.language_id !== "Allegrex:LE:32:default" ||
|
||||
committedProfile.parameters.loader !== "PspElfLoader")
|
||||
)
|
||||
return unavailableClient(
|
||||
new ProviderAdapterError("ghidra", "open_binary", {
|
||||
diagnostics: {
|
||||
reason:
|
||||
"Resolve the supported PSP profile and installed Allegrex extension before opening the session.",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const extensionProfile = ghidraExtensionSchema
|
||||
.array()
|
||||
.safeParse(committedProfile.parameters.analysis_extensions ?? []);
|
||||
@@ -444,6 +469,9 @@ export const createGhidraProviderClient = (input: {
|
||||
bridgeScriptPath: fileURLToPath(
|
||||
new URL("../../bridge/ghidra/ReaGhidraBridge.java", import.meta.url),
|
||||
),
|
||||
...(pspExtension?.success === true
|
||||
? { pspExtension: pspExtension.data }
|
||||
: {}),
|
||||
...(target.format === "dos-mz" ? { dosMz: true } : {}),
|
||||
...(target.format === "dos-com" ? { dosCom: true } : {}),
|
||||
...(languageOverride === undefined ? {} : { languageOverride }),
|
||||
@@ -475,6 +503,12 @@ export const createGhidraProviderClient = (input: {
|
||||
? {}
|
||||
: { expectedCompilerSpecId: languageOverride.compilerSpecId }),
|
||||
}),
|
||||
...(psp
|
||||
? {
|
||||
expectedLanguageId: "Allegrex:LE:32:default",
|
||||
expectedCompilerSpecId: "default",
|
||||
}
|
||||
: {}),
|
||||
...(context === undefined ? {} : { runId: context.runId }),
|
||||
logger: logger.child({ layer: "ghidra-bridge" }),
|
||||
});
|
||||
@@ -510,6 +544,7 @@ export const createGhidraProviderClient = (input: {
|
||||
const sessionLimitations = (): readonly string[] => [
|
||||
...providerLimitations,
|
||||
...targetLimitations,
|
||||
...(psp ? GHIDRA_PSP_LIMITATIONS : []),
|
||||
...ghidraExtensionLimitations(extensions),
|
||||
...seedLimitations,
|
||||
...(releaseLimitation === undefined ? [] : [releaseLimitation]),
|
||||
|
||||
Reference in New Issue
Block a user