Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(targets): compare the Info.plist bplist prefix without ASCII folding (#2100)

Faheem Ahmad70611713e140
diff --git a/src/application/AppBundleExecutable.test.ts b/src/application/AppBundleExecutable.test.ts
new file mode 100644
index 000000000..942a00112
--- /dev/null
+++ b/src/application/AppBundleExecutable.test.ts
@@ -0,0 +1,34 @@
+import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+
+import { describe, expect, it } from "vitest";
+
+import { resolveAppBundleExecutable } from "./AppBundleExecutable.js";
+
+describe("app bundle Info.plist magic", () => {
+ it("does not decode a high-bit fold of bplist as a binary Info.plist", async () => {
+ const root = await mkdtemp(join(tmpdir(), "rea-bplist-fold-"));
+ try {
+ const bundle = join(root, "Fixture.app");
+ const plistPath = join(bundle, "Contents", "Info.plist");
+ await mkdir(join(bundle, "Contents"), { recursive: true });
+ const plist = Buffer.from("bplist00");
+ plist[0] = (plist[0] ?? 0) | 0x80;
+ await writeFile(plistPath, plist);
+ let decoded = false;
+ const result = await resolveAppBundleExecutable(bundle, {
+ readFile: async () => plist,
+ realpath: async (path) => path,
+ decodeBinaryPlist: async () => {
+ decoded = true;
+ return "Fixture";
+ },
+ });
+ expect(decoded).toBe(false);
+ expect(result.ok).toBe(false);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+ });
+});