mirror of
https://github.com/morluto/rea
synced 2026-10-26 06:16:17 -04:00
70611713e1
* fix(targets): compare the Info.plist bplist prefix without ASCII folding The six-byte prefix check used an encoding that maps high-bit bytes onto bplist, so a non-binary property list could be sent to the binary decoder. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(targets): satisfy the strict index check in the plist prefix test Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
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 });
|
|
}
|
|
});
|
|
});
|