Repository navigation
fix(plist): read XML plists containing a __proto__ key - #885
Conversation
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 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a08be51e9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (start < 0 || end < start) return null; | ||
| return jsonValueSchema.parse( | ||
| parseXmlPlist(output.slice(start, end + "</plist>".length)), | ||
| parseXmlPropertyList(output.slice(start, end + "</plist>".length)).value, |
There was a problem hiding this comment.
Report omitted keys in signature results
When codesign emits an entitlements plist containing a __proto__ key, this extracts only .value and discards omittedPrototypeKeys; #inspectSignature therefore returns a successful but incomplete entitlement set without adding anything to limitations. Propagate the omission count into the signature result so analysts are not led to treat the remaining entitlements as complete.
AGENTS.md reference: AGENTS.md:L54-L58
Useful? React with 👍 / 👎.
| bytes.subarray(0, 8).toString("ascii") === "bplist00" | ||
| ? parseBinary(bytes) | ||
| : parse(bytes.toString("utf8")); | ||
| : parseXmlPropertyList(bytes.toString("utf8")).value; |
There was a problem hiding this comment.
Mark Interface Builder results partial after omitting keys
For an XML NIB containing a __proto__ key, this discards omittedPrototypeKeys and returns the reduced object as a successfully decoded document. Consequently archive_decode can remain complete and the result has no limitation even though archive data was removed; carry the omission metadata into the analysis coverage and limitations.
AGENTS.md reference: AGENTS.md:L54-L58
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, fixed in #894. decode_interface_builder marks archive_decode partial with reason dictionary_entries_omitted, sets graph.truncated, and adds a per-document limitation.
| let placeholder = "__rea_prototype_key__"; | ||
| while (text.includes(placeholder)) placeholder = `_${placeholder}`; |
There was a problem hiding this comment.
Reserve placeholders using decoded key values
The collision check searches raw XML text, so a legitimate key such as <key>__rea_prototype_key__</key> does not match text.includes(placeholder) but is decoded by the plist parser to the chosen placeholder. withoutKey then removes that unrelated entry and falsely reports it as an omitted __proto__ key, even when no such key existed; determine collisions from decoded <key> values or use a substitution that cannot alias source keys.
AGENTS.md reference: AGENTS.md:L54-L56
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, fixed in #894. The placeholder is now reserved against the entity-decoded text, so <key>__rea_prototype_key__</key> is kept and only the real __proto__ entry is omitted.
…ace Builder morluto#885 decodes XML plists that contain a __proto__ key by omitting those entries, but signature entitlements and Interface Builder plists dropped the omission count. inspect_signature returned an entitlement set that looked complete, and archive_decode stayed complete. Both now report the omission: a signature limitation, and a partial archive_decode facet with reason dictionary_entries_omitted and a per-document limitation. The placeholder that stands in for __proto__ was reserved against the raw XML text, so an entity-encoded key such as &morluto#95;&morluto#95;rea_prototype_key__ decoded to the placeholder and was omitted as if it were __proto__. The placeholder is now reserved against the decoded text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(plist): read XML plists containing a __proto__ key
…ace Builder morluto#885 decodes XML plists that contain a __proto__ key by omitting those entries, but signature entitlements and Interface Builder plists dropped the omission count. inspect_signature returned an entitlement set that looked complete, and archive_decode stayed complete. Both now report the omission: a signature limitation, and a partial archive_decode facet with reason dictionary_entries_omitted and a per-document limitation. The placeholder that stands in for __proto__ was reserved against the raw XML text, so an entity-encoded key such as &morluto#95;&morluto#95;rea_prototype_key__ decoded to the placeholder and was omitted as if it were __proto__. The placeholder is now reserved against the decoded text.
Summary
__proto__is a legal plist dictionary key (plutil -lintreports OK), but theplistpackage's XML decoder throws on it (__proto__ keys can lead to prototype pollution. More details on CVE-2022-22912). Every REA site that decodes XML plists failed on such a key:Info.plist, from #857)target_unavailable,app has no readable CFBundleExecutable. One unrelated<key>__proto__</key>is enough to keep an app out of every REA tool.inspect_plist, plutil XML route (data/date/large-integer plists)app has no readable CFBundleExecutable/ decode failureinspect_plist, plutil JSON route__proto__keysinspect_signatureentitlements, XMLinspect_keyed_archive, Interface Builder plistsA new shared reader,
src/domain/propertyListKeys.ts, swaps each element key that decodes to__proto__(literal, entity-encoded, or CDATA) for a unique placeholder before theplistdecoder runs. Comments and CDATA text are consumed whole, so only real<key>elements are touched. The reader then omits those entries and returns how many it dropped. REA results cannot carry the key, because validation strips it, so it is reported rather than invented:inspect_plist(both routes) andinspect_keyed_archive(XML) add the limitation1 dictionary entry keyed __proto__ was omitted because REA results cannot represent that key.Prototype safety is unchanged: entries are rebuilt with
Object.fromEntries, and the omitted value is never assigned.Not covered: the
plistpackage's binary decoder assignsdict["__proto__"] = value, which silently drops the key or replaces the object's prototype. Binary keyed archives and binary NIB plists are therefore unchanged by this PR. BinaryInfo.plistandinspect_plistgo throughplutiland are covered.No schema or catalog change.
Verification
tests/boundary/filesystem/binaryTarget.test.ts: an app opens when its XMLInfo.plistalso holds a literal or entity-encoded__proto__entry, including one whose value contains a forgedCFBundleExecutable. Fails onmain.tests/boundary/cli/nativePlistPrototypeKeyCli.test.ts(darwin, real plutil): JSON-expressible and data-bearing plists inspect successfully with the limitation, and the omitted value does not appear. Fails onmain.src/artifacts/KeyedArchiveReader.test.ts: an XML archive with a__proto__entry decodes and reports the limitation. Fails onmain.src/domain/propertyListKeys.test.tscovers the literal, CDATA, and entity spellings. It also checks that comments, CDATA strings,__proto__with spaces, and the placeholder spelling itself stay intact.npm run check:changed(22 files, 164 tests),npm run docs:check,npm run verify:keyed-archive(real Foundation), and the native plist/signature/keyed-archive/provider boundary tests all pass. 7 NIB/storyboard tests fail identically on unmodifiedmainon this host, because this Mac has only the Command Line Tools and noibtool.No Hopper/Ghidra/IDA verification is needed.
🤖 Generated with Claude Code