Repository navigation
fix(apple): report __proto__ entries omitted from OpenStep property lists - #4105
Conversation
…ists The pinned OpenStep decoder assigns a `__proto__` dictionary key to the object's prototype, so the entry vanished before REA could count it and OpenStep keyed archives reported no omission, unlike the same archive in XML. The OpenStep pre-scan, which already walks every key for the depth limit, now counts keys that decode to `__proto__`; quoted keys with escapes are decoded by the pinned decoder itself. The rebuilt value still drops any prototype a key replaced. Fixes #3892 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: beba6611a8
ℹ️ 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 (parent?.next === "key") { | ||
| if (isOpenStepPrototypeKey(text.slice(cursor, end))) prototypeKeys += 1; |
There was a problem hiding this comment.
Count compound keys that coerce to
__proto__
A valid OpenStep compound dictionary key such as (__proto__) = hidden; is accepted by the same grammar covered by the existing compound-key test, and the decoder's obj[key] = value coerces its one-element array key to __proto__, silently dropping or replacing the prototype. This branch only counts scalar tokens while the dictionary is awaiting a key; the opening ( bypasses it and __proto__ is scanned as an array element, so this input still reports zero omissions. Count compound keys after their decoded property-key coercion as well.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Valid, fixed in 8045be3. Root cause: the scan only checked scalar tokens in key position, but the decoder's obj[key] = value coerces any key to a property name. A one-element array key such as (__proto__) therefore becomes __proto__. A container opened while its dictionary awaits a key now records its start offset. When it closes, its source is decoded by the pinned decoder's parseOpenStep and counted when String(value) === "__proto__", the same coercion the assignment performs, so REA does not reimplement it. isOpenStepPrototypeKey uses the same rule for escaped quoted keys. New test: (__proto__) and (("__proto__")) are counted. ("__pro", "to__") (key __pro,to__) and the value list = (__proto__) are not. Both counted cases fail on beba661. Validation: npx vitest run src/domain src/artifacts/apple passed 188 files (3,274 tests), npm run check:fast passed, and the issue's CLI repro still reports one omission.
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. |
[Medium impact] The PR appears safe to merge; the previous compound-key issue is addressed. SummaryOpenStep property lists now report omitted
Reviews (2) · Last reviewed commit: "fix(apple): count OpenStep compound keys..." · Reviewed by Greptile |
Review follow-up. A compound dictionary key such as `(__proto__)` is coerced by the decoder's `obj[key]` assignment to the property name __proto__, but the scan only checked scalar keys. Containers opened in key position are now decoded by the pinned decoder on close and counted when their property-name coercion is __proto__. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Fixes #3892. An OpenStep-format keyed archive with a
__proto__dictionary key lost that entry without any omission limitation. The same archive converted to XML reports1 dictionary entry keyed __proto__ was omitted…. OpenStep inputs now report the same omission.Problem and expected behavior
parseXmlPropertyList(src/domain/propertyListKeys.ts) sends OpenStep text to the pinnedplistdecoder. It then counts own__proto__properties withomitPrototypeKeys. The decoder (parse-openstep.js) assignsobj[key] = value, so a__proto__key never becomes an own property:In both cases the count was always 0. A decoded-value walk cannot recover a string-valued entry, so the source has to be counted.
Reproduced with the issue's archive and a real
/usr/bin/plutil -convert xml1copy, throughrea inspect-keyed-archive --json:{"kept":"visible"},truncated: false, no omission limitation, 2,274 bytes, 492 ms1 dictionary entry keyed __proto__ was omitted because REA results cannot represent that key., 2,466 bytes, 442–455 ms (warm){"kept":"visible"}, omission limitation, 2,470 bytes, 470 msThe OpenStep output grows only by the limitation that was missing. Timing is unchanged.
Change and scope
scanOpenStepand now also returns the number of keys that decode to__proto__:(__proto__)), are decoded by the pinned decoder's own exportedparseOpenStepand counted whenString(value)is__proto__, the same coercionobj[key]performs, so REA does not reinterpret escapes or coercion. For example,"\_\_proto__"counts, while"\137_proto__"decodes to137_proto__and does not.parseXmlPropertyListreports that count for OpenStep. It still returns theomitPrototypeKeysrebuild, which yields plain objects even when a key replaced a prototype.Contract and boundary impact
Semantic owner and earliest changed stage: shared property-list parsing (
parseXmlPropertyList/ OpenStep pre-scan), used by keyed archives and the other plist consumers.Contribution scope fit and linked maintainer decision: a bug fix within the existing static, read-only boundary; not applicable.
CLI and MCP/tool-catalog contract: schemas unchanged. An OpenStep result with such keys gains the existing omission limitation.
Provider, bridge, target-format, or platform compatibility: OpenStep plists only.
Evidence, artifact, provenance, or reconstruction contract: omissions are now disclosed instead of silent.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Evidence and regression coverage
src/domain/propertyListKeys.test.tsadds one case that counts four keys decoding to__proto__: unquoted, quoted, escape-spelled, and a nested key with a dictionary value. The case also checks that a__proto__value, an array element__proto__and"\137_proto__"are not counted, and that the nested object keepsObject.prototype. It fails on main (count 0) and passes with the fix.plutil, and both files were inspected through the built CLI as tabulated.__proto__was available.Validation performed
npx vitest run src/domain/propertyListKeys.test.ts— 38 passed; against main, 1 failed as expected.npx vitest run src/domain src/artifacts/apple tests/boundary/filesystem— 376 files: 5,902 passed, 2 failed. The two failures (productCatalog.test.ts,setupSkill.test.ts) compare against generated artifacts that were stale in my local checkout. They pass undernpm run test:focused -- tests/boundary/filesystem/productCatalog.test.ts tests/boundary/filesystem/setupSkill.test.ts(26 passed), which regenerates those artifacts, and neither involves this change.npm run check:fast— passed.Compatibility, safety, and release
plutilfor the control file.Author readiness
Human owner:
Before merge
type(scope): outcome.🤖 Generated with Claude Code