feat(native): admit raw binaries with caller-supplied architecture and entry (#1868)
* feat(native): admit raw binaries with caller-supplied architecture and entry * fix(native): honor raw-binary preparation and entry identity * fix(ghidra): stream raw snapshot attestation with cancellation * fix(native): preserve and validate raw lifecycle entries --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
@@ -140,6 +140,7 @@ export const hopperLoaderArgsForTarget = (
|
||||
return ok(["-l", "WinPE", flag]);
|
||||
case "dos-mz":
|
||||
case "dos-com":
|
||||
case "raw-binary":
|
||||
return err(
|
||||
new ProviderAdapterError("hopper", "resolve_analysis_profile"),
|
||||
);
|
||||
|
||||
@@ -5,6 +5,27 @@ import { silentLogger } from "../logger.js";
|
||||
import { HopperProvider } from "./HopperProvider.js";
|
||||
|
||||
describe("Hopper provider capabilities", () => {
|
||||
it("declines headerless raw-binary targets with a Ghidra-directed reason", () => {
|
||||
const config = parseConfig({});
|
||||
if (!config.ok) throw new Error("expected valid configuration");
|
||||
const provider = new HopperProvider(config.value, silentLogger, {});
|
||||
expect(
|
||||
provider.inspectTargetSupport({
|
||||
path: "/tmp/ecu.bin",
|
||||
sha256: "a".repeat(64),
|
||||
kind: "executable",
|
||||
format: "raw-binary",
|
||||
architecture: "arm",
|
||||
availableArchitectures: ["arm"],
|
||||
entryPoint: "0x8000000",
|
||||
entryPointSource: "0x8000000",
|
||||
}),
|
||||
).toMatchObject({
|
||||
status: "unsupported",
|
||||
code: "target_format_unsupported",
|
||||
reason: expect.stringContaining("Ghidra"),
|
||||
});
|
||||
});
|
||||
it("declines DOS MZ targets with a provider-specific support reason", () => {
|
||||
const config = parseConfig({});
|
||||
if (!config.ok) throw new Error("expected valid configuration");
|
||||
|
||||
@@ -123,6 +123,14 @@ export class HopperProvider implements AnalysisProviderCandidate {
|
||||
reason: "REA's Hopper adapter does not admit MIPS targets.",
|
||||
diagnostics,
|
||||
};
|
||||
if (target.format === "raw-binary")
|
||||
return {
|
||||
status: "unsupported",
|
||||
code: "target_format_unsupported",
|
||||
reason:
|
||||
"Headerless raw-binary analysis requires the Ghidra adapter with a caller-supplied architecture and entry point.",
|
||||
diagnostics,
|
||||
};
|
||||
if (target.format === "dos-mz" || target.format === "dos-com")
|
||||
return {
|
||||
status: "unsupported",
|
||||
|
||||
Reference in New Issue
Block a user