Merge branch 'feat/dylib-resolution' into feat/dyld-shared-cache

# Conflicts:
#	docs/product-catalog.json
#	docs/verification/managed-conformance-manifest.json
#	skills/reverse-engineer-anything/SKILL.md
#	src/generatedMcpToolCatalog.ts
This commit is contained in:
Kaoru0822
2026-10-07 12:26:24 +00:00
139 changed files with 1750 additions and 462 deletions
+6 -3
View File
@@ -246,9 +246,12 @@ class ArtifactClient implements AnalysisClient {
"unavailable",
"trace_dylib_resolution requires an active Mach-O or .app bundle target",
);
const bundle = this.target.sourcePath?.toLowerCase().endsWith(".app")
? this.target.sourcePath
: undefined;
// Only a target opened from an app bundle directory carries its Info.plist;
// a regular file whose name ends in .app is a standalone image.
const bundle =
this.target.bundleInfoPlist === undefined
? undefined
: this.target.sourcePath;
const result = await traceDylibResolution({
rootPath: bundle ?? dirname(this.target.path),
targetPath: this.target.path,
+23 -8
View File
@@ -143,14 +143,29 @@ const asarFailure = (
path: string,
operation: string,
cause: unknown,
): ArtifactReaderFailure =>
cause instanceof ArtifactReaderFailure
? cause
: new ArtifactReaderFailure(
"format",
`Malformed or unreadable ASAR during ${operation}: ${path}`,
{ cause },
);
): ArtifactReaderFailure => {
if (cause instanceof ArtifactReaderFailure) return cause;
if (isFilesystemFailure(cause))
return new ArtifactReaderFailure(
"io",
`Could not ${operation} ASAR at ${path}: ${cause.message}`,
{ cause },
);
return new ArtifactReaderFailure(
"format",
`Malformed ASAR during ${operation}: ${path}`,
{ cause },
);
};
const isFilesystemFailure = (
cause: unknown,
): cause is NodeJS.ErrnoException & Error =>
cause instanceof Error &&
"errno" in cause &&
typeof cause.errno === "number" &&
"syscall" in cause &&
typeof cause.syscall === "string";
const isMissingFile = (cause: unknown): boolean =>
typeof cause === "object" &&
+1 -1
View File
@@ -85,7 +85,7 @@ export class DirectoryArtifactReader implements ArtifactReader {
);
const handle = await open(
entry.adapterKey,
constants.O_RDONLY | constants.O_NOFOLLOW,
constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK,
);
try {
const observed = await handle.stat();
@@ -237,6 +237,15 @@ describe("Mach-O load command reader failures", () => {
}));
const facts = await read(fatImage(slices));
expect(facts.status === "parsed" && facts.slices).toHaveLength(24);
// An empty table is not a Java class file, whose major version is nonzero.
for (const magic of [
[0xca, 0xfe, 0xba, 0xbe],
[0xbf, 0xba, 0xfe, 0xca],
])
expect(await read(Uint8Array.from([...magic, 0, 0, 0, 0]))).toEqual({
status: "malformed",
reason: "FAT header declares no architectures",
});
});
it("rejects string commands too short to hold their string offset", async () => {
+8 -5
View File
@@ -96,11 +96,14 @@ export const readMachoImage = async (
const littleEndian = magic === FAT_CIGAM || magic === FAT_CIGAM_64;
const count = view.getUint32(4, littleEndian);
const wide = magic === FAT_MAGIC_64 || magic === FAT_CIGAM_64;
if (
count === 0 ||
count > MAX_FAT_ARCHITECTURES ||
8 + count * (wide ? 32 : 20) > size
)
// A Java class file's nonzero major version reads as the count, so an
// empty architecture table can only be a malformed universal header.
if (count === 0)
return {
status: "malformed",
reason: "FAT header declares no architectures",
};
if (count > MAX_FAT_ARCHITECTURES || 8 + count * (wide ? 32 : 20) > size)
return { status: "not-mach-o" };
const table = viewOf(
await readExact(readAt, 8, count * (wide ? 32 : 20), "FAT table"),