fix(plist): read XML plists containing a __proto__ key
The `plist` XML decoder throws on the legal dictionary key `__proto__`
(its CVE-2022-22912 guard). An app whose XML Info.plist held such an
entry could not be opened at all ("app has no readable
CFBundleExecutable"), and entitlements, XML keyed archives, and
Interface Builder plists failed the same way. On the plutil JSON route,
validation silently dropped the key from `inspect_plist` results.
Decode XML plists through a shared reader that substitutes such keys
before the decoder runs, then omits and counts those entries.
`inspect_plist` and `inspect_keyed_archive` report the omission as a
limitation instead of failing or dropping it silently.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
507e8b3c7b
commit
a08be51e9f
@@ -243,6 +243,26 @@ describe("app executable filename fidelity", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
"<key>__proto__</key><dict><key>CFBundleExecutable</key><string>Forged</string></dict>",
|
||||
"<key>__proto__</key><string>x</string>",
|
||||
])("opens an app whose XML plist also holds %s", async (entry) => {
|
||||
const directory = await createTestTempDirectory("rea-app-xml-proto-");
|
||||
const app = join(directory, "Proto.app");
|
||||
const contents = join(app, "Contents");
|
||||
const executable = join(contents, "MacOS", "App");
|
||||
await mkdir(join(contents, "MacOS"), { recursive: true });
|
||||
await writeFile(
|
||||
join(contents, "Info.plist"),
|
||||
`<plist><dict>${entry}<key>CFBundleExecutable</key><string>App</string></dict></plist>`,
|
||||
);
|
||||
await writeFile(executable, thinMach(0xfeedfacf, 0x0100000c));
|
||||
const result = await parseBinaryTarget(app, directory, "arm64");
|
||||
expect(result.ok && result.value).toMatchObject({
|
||||
path: await realpath(executable),
|
||||
});
|
||||
});
|
||||
|
||||
it.skipIf(process.platform !== "darwin")(
|
||||
"preserves executable filename whitespace from native binary plists",
|
||||
async () => {
|
||||
|
||||
Reference in New Issue
Block a user