mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 21:23:45 +00:00
fix(app-bundle): apply the Info.plist decode budget to XML plists (#6699)
* 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>
This commit is contained in:
13 files changed
+218
-75
No files matched your search
@@ -4,6 +4,7 @@ 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 () => {
|
||||
@@ -23,3 +24,24 @@ it("resolves the declared executable from a commented OpenStep Info.plist", asyn
|
||||
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 },
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user