fix(ghidra): refuse ambiguous universal Mach-O imports

This commit is contained in:
Kaoru0822
2026-10-06 05:00:53 -07:00
parent e2c23f3640
commit 6582b2433a
2 changed files with 45 additions and 2 deletions
@@ -208,6 +208,33 @@ describe("Ghidra provider", () => {
});
});
describe("Ghidra Mach-O slice support", () => {
it("refuses universal targets whose selected slice cannot be enforced", () => {
const ghidra = provider();
const universal: BinaryTarget = {
path: "/tmp/fixture",
sha256: "a".repeat(64),
kind: "executable",
format: "mach-o",
architecture: "arm64",
availableArchitectures: ["x86_64", "arm64"],
};
expect(ghidra.inspectTargetSupport(universal)).toMatchObject({
status: "unsupported",
code: "architecture_unsupported",
reason: expect.stringContaining("universal Mach-O"),
diagnostics: {
architecture: "arm64",
available_architectures: ["x86_64", "arm64"],
},
});
expect(
ghidra.inspectTargetSupport(executableTarget("mach-o", "arm64")),
).toMatchObject({ status: "supported" });
});
});
describe("Ghidra platform support", () => {
it("keeps Windows annotation mutation unavailable independently of native controls", () => {
const ghidra = provider({ ...installationHost(), platform: "win32" });