fix(plist): report omitted __proto__ entries in signatures and Interface Builder
#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 __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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
faaee693d5
commit
6729ee7636
@@ -39,6 +39,16 @@ it("keeps __proto__ text in strings, comments, and similar keys", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps an entity-encoded key that decodes to the placeholder", () => {
|
||||
const text = plist(
|
||||
"<dict><key>__rea_prototype_key__</key><string>kept</string><key>__proto__</key><string>x</string></dict>",
|
||||
);
|
||||
expect(parseXmlPropertyList(text)).toEqual({
|
||||
value: { __rea_prototype_key__: "kept" },
|
||||
omittedPrototypeKeys: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it("omits own __proto__ entries that JSON decoding creates", () => {
|
||||
const decoded: unknown = JSON.parse(
|
||||
'{"__proto__":{"x":1},"a":[{"__proto__":2,"b":3}]}',
|
||||
|
||||
@@ -75,8 +75,11 @@ const decodeXmlText = (text: string): string =>
|
||||
export const parseXmlPropertyList = (
|
||||
text: string,
|
||||
): PropertyListWithoutPrototypeKeys => {
|
||||
// The decoded text holds every key the decoder can produce, including
|
||||
// entity-encoded spellings of the placeholder, so no source key aliases it.
|
||||
const decoded = decodeXmlText(text);
|
||||
let placeholder = "__rea_prototype_key__";
|
||||
while (text.includes(placeholder)) placeholder = `_${placeholder}`;
|
||||
while (decoded.includes(placeholder)) placeholder = `_${placeholder}`;
|
||||
const substituted = text.replace(
|
||||
KEY_TOKEN,
|
||||
(token, plain?: string, cdata?: string) =>
|
||||
|
||||
Reference in New Issue
Block a user