fix(native): preserve universal Mach-O container identity
Keep FAT container format distinct from selected slice architecture through target admission, Evidence, snapshots, and CLI/MCP lifecycle results. Preserve native, Hopper, Ghidra, extraction, and dylib routing for the Mach-O family. Reject selected FAT ranges overlapping their table or too short for a Mach-O header. Replace empty-slice fixtures with in-bounds executable headers and cover thin, universal, single-slice, FAT64, and swapped containers. Validation: static and architecture checks, generated docs, targeted producer and public MCP tests. Provider routing uses controlled fixtures; no live Hopper, IDA, JADX, or Ghidra analysis was performed for this change.
This commit is contained in:
@@ -250,6 +250,7 @@ const detectArtifactFormat = async (
|
||||
BinaryTarget["format"],
|
||||
| "analysis-database"
|
||||
| "mach-o"
|
||||
| "mach-o-universal"
|
||||
| "elf"
|
||||
| "pe"
|
||||
| "dos-mz"
|
||||
@@ -315,6 +316,7 @@ const isArchiveFormat = (
|
||||
BinaryTarget["format"],
|
||||
| "analysis-database"
|
||||
| "mach-o"
|
||||
| "mach-o-universal"
|
||||
| "elf"
|
||||
| "pe"
|
||||
| "dos-mz"
|
||||
|
||||
@@ -98,6 +98,26 @@ const entry = (
|
||||
};
|
||||
|
||||
describe("capability failure reasons", () => {
|
||||
it("admits physical universal Mach-O targets for native Mach-O operations", () => {
|
||||
expect(
|
||||
entry(
|
||||
"inspect_native_dispatch_metadata",
|
||||
status({
|
||||
open: true,
|
||||
kind: "executable",
|
||||
format: "mach-o-universal",
|
||||
capabilities: [
|
||||
{
|
||||
operation: "inspect_native_dispatch_metadata",
|
||||
available: true,
|
||||
reason: null,
|
||||
},
|
||||
],
|
||||
}),
|
||||
),
|
||||
).toMatchObject({ available: false, reason: "provider_missing" });
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
label: "requires a target",
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
} from "../contracts/toolOutputSchemaPrimitives.js";
|
||||
import type { ToolKind } from "../contracts/toolContractTypes.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { isMachOFormat } from "../domain/binaryTargetTypes.js";
|
||||
import type { ProviderAvailability } from "./AnalysisProvider.js";
|
||||
import { TOOL_CONTRACTS } from "../contracts/toolContracts.js";
|
||||
import {
|
||||
@@ -549,7 +550,7 @@ const targetAvailability = ({
|
||||
if (
|
||||
targetOpen &&
|
||||
MACHO_TARGET_OPERATIONS.has(name) &&
|
||||
(targetKind !== "executable" || targetFormat !== "mach-o")
|
||||
(targetKind !== "executable" || !isMachOFormat(targetFormat))
|
||||
)
|
||||
return {
|
||||
reason: "target_unsupported",
|
||||
|
||||
Reference in New Issue
Block a user