mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
* fix(app-bundle): apply the plist decode budget to the XML branch * test(app-bundle): cover the XML plist decode budget * decode xml plist once, pass the text to the decode preflight * fix(app-bundle): keep OpenStep plists out of the XML preflight, keep budget failures typed OpenStep Info.plist text is not XML, so quoted markup inside it is string data. Run the XML entity-expansion preflight only on actual XML input, using the same format check the parser already uses. A valid OpenStep bundle with a DOCTYPE-looking quoted string no longer fails the budget. Budget exhaustion also keeps its own error: the resolver now returns a typed bundle_info_plist_decode_budget_exceeded failure naming the 16 MiB allowance instead of the malformed-plist diagnosis. * Fix test names and budget error classification after the merge * fix: regenerate user-visible error catalogue for plist budget constraint * test: pin budget-exceeded bundle target to its catalogue row * refactor(plist): give Info.plist decoding a shared owner --------- Co-authored-by: Dextheking1 <Dextheking1@users.noreply.github.com> Co-authored-by: benjaminkincses <4175097+benjaminkincses@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import { mkdir, writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
import { expect, it } from "vitest";
|
|
|
|
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
|
|
import { decodeOpenStepPropertyList } from "../domain/propertyListOpenStep.js";
|
|
import { resolveAppleBundleExecutable } from "./AppBundleExecutable.js";
|
|
|
|
it("resolves the declared executable from a commented OpenStep Info.plist", async () => {
|
|
const root = await createTestTempDirectory("rea-openstep-bundle-");
|
|
const bundle = join(root, "Fixture.app");
|
|
const programs = join(bundle, "Contents", "MacOS");
|
|
const executable = join(programs, "Fixture");
|
|
const infoPlist = join(bundle, "Contents", "Info.plist");
|
|
const source =
|
|
" \t/* header */\n// executable selection\n{ CFBundleExecutable = Fixture; }";
|
|
await mkdir(programs, { recursive: true });
|
|
await writeFile(infoPlist, source);
|
|
await writeFile(executable, "fixture - never executed");
|
|
|
|
expect(await resolveAppleBundleExecutable(bundle)).toEqual({
|
|
ok: true,
|
|
value: { executable, infoPlist },
|
|
});
|
|
});
|
|
|
|
it("resolves an OpenStep Info.plist with quoted XML-looking text", async () => {
|
|
const root = await createTestTempDirectory("rea-openstep-doctype-");
|
|
const bundle = join(root, "Fixture.app");
|
|
const programs = join(bundle, "Contents", "MacOS");
|
|
const executable = join(programs, "Fixture");
|
|
const infoPlist = join(bundle, "Contents", "Info.plist");
|
|
const source = `{ CFBundleExecutable = Fixture; Note = "<!DOCTYPE plist [ <!ENTITY x 'ok'> ]>"; }`;
|
|
expect(decodeOpenStepPropertyList(source)).toEqual({
|
|
CFBundleExecutable: "Fixture",
|
|
Note: "<!DOCTYPE plist [ <!ENTITY x 'ok'> ]>",
|
|
});
|
|
await mkdir(programs, { recursive: true });
|
|
await writeFile(infoPlist, source);
|
|
await writeFile(executable, "fixture - never executed");
|
|
|
|
expect(await resolveAppleBundleExecutable(bundle)).toEqual({
|
|
ok: true,
|
|
value: { executable, infoPlist },
|
|
});
|
|
});
|