mirror of
https://github.com/morluto/rea.git
synced 2026-11-22 22:45:47 +00:00
* fix(native): retain selected Mach-O slice identity * fix(native)!: own Mach-O load commands in binary reader * fix(native): preserve malformed Mach-O and image base limits * fix(native): preserve leading BOM in Mach-O names * test(native): update Mach-O provenance verification * fix(native): retain completed Mach-O inspection on cleanup failure * fix: bound Mach-O projected section output * fix(native): own retained Mach-O command bytes * fix(native): retain Mach-O outcomes on final cancellation * fix(cli): preserve caller path in partial evidence * fix: reserve Mach-O projection envelope budget
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { writeFile, rm } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
import { NativeMacOSProvider } from "../../../../src/native/NativeMacOSProvider.js";
|
|
import {
|
|
dylibCommand,
|
|
LC,
|
|
machoImage,
|
|
} from "../../../../src/artifacts/apple/MachoImage.fixture.js";
|
|
import { createTestTempDirectory } from "../../../fixtures/temporaryDirectory.js";
|
|
import {
|
|
NativeFixtureRunner,
|
|
nativeFixture,
|
|
nativeMachoTargetForFile,
|
|
} from "../../../fixtures/nativeCommands.js";
|
|
|
|
it("retains native re-export dependencies alongside ordinary and identity commands", async () => {
|
|
const directory = await createTestTempDirectory("rea-reexport-");
|
|
try {
|
|
const path = join(directory, "libOuter.dylib");
|
|
await writeFile(
|
|
path,
|
|
machoImage({
|
|
fileType: 6,
|
|
commands: [
|
|
dylibCommand(LC.ID_DYLIB, "@rpath/libOuter.dylib"),
|
|
dylibCommand(LC.REEXPORT_DYLIB, "@rpath/libLeaf.dylib"),
|
|
dylibCommand(LC.LOAD_DYLIB, "/usr/lib/libSystem.B.dylib"),
|
|
],
|
|
}),
|
|
);
|
|
const runner = new NativeFixtureRunner({
|
|
lipo: await nativeFixture("lipo-thin.txt"),
|
|
});
|
|
const client = new NativeMacOSProvider({}, runner, "darwin").createClient(
|
|
await nativeMachoTargetForFile(path),
|
|
);
|
|
const result = await client.execute("inspect_macho", {});
|
|
if (!result.ok) throw result.error;
|
|
expect(result.value.result).toMatchObject({
|
|
dependencies: {
|
|
exhaustive: true,
|
|
total: 2,
|
|
items: [
|
|
expect.objectContaining({
|
|
kind: "LC_REEXPORT_DYLIB",
|
|
path: "@rpath/libLeaf.dylib",
|
|
}),
|
|
expect.objectContaining({
|
|
kind: "LC_LOAD_DYLIB",
|
|
path: "/usr/lib/libSystem.B.dylib",
|
|
}),
|
|
],
|
|
},
|
|
load_commands: {
|
|
items: expect.arrayContaining([
|
|
expect.objectContaining({ kind: "LC_ID_DYLIB" }),
|
|
]),
|
|
},
|
|
});
|
|
} finally {
|
|
await rm(directory, { recursive: true, force: true });
|
|
}
|
|
});
|