[PR #4981] [CLOSED] fix(plist): decode XML data as CoreFoundation does #6709

Closed
opened 2026-11-01 21:42:27 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4981
Author: @avichal-08
Created: 10/18/2026
Status: ❌ Closed

Base: main ← Head: fix/plist-data-base64


📝 Commits (2)

  • 87bfcbd fix(plist): decode XML data as CoreFoundation does
  • 4cf6cac perf(plist): preallocate decoded XML data bytes

📊 Changes

3 files changed (+55 additions, -5 deletions)

View changed files

📝 src/domain/propertyListXml.test.ts (+14 -0)
📝 src/domain/propertyListXml.ts (+30 -4)
📝 tests/acceptance/applications/keyedArchiveXmlNumbers.test.ts (+11 -1)

📄 Description

Summary

Fixes #4978. XML <data> values in property lists were decoded with WHATWG atob, so REA reported bytes that Apple's native reader never produces, or refused archives the native reader accepts. They are now decoded the way CFPropertyList does.

Problem and expected behavior

  • <data>AQI</data>: native result is empty data; REA reported 0102 as observed.
  • <data>AQ!ID</data>: native result is 010203; REA failed with artifact_operation_failed.

atob pads an incomplete trailing quartet and rejects non-alphabet characters. CFPropertyList skips non-alphabet characters and emits only completed quartets.

Change and scope

decodeXmlPropertyList, the shared XML value owner, now decodes <data> with a small CF-compatible decoder: skip non-alphabet characters, treat = as a zero digit, emit only completed quartets, and shorten the final quartet by the trailing = run.

Not included: CDATA/comment handling inside <data> (the issue reports those as natively rejected) and any numeric behavior (#4852).

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/propertyListXml.ts, XML value decoding.

  • Contribution scope fit and linked maintainer decision: not applicable (bug fix).

  • CLI and MCP/tool-catalog contract: unchanged; data values for the affected spellings now match native decoding.

  • Provider, bridge, target-format, or platform compatibility: XML plists only; binary plists unaffected.

  • Evidence, artifact, provenance, or reconstruction contract: unchanged shape; corrects observed data bytes.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:

    • src/domain/propertyListXml.test.ts: data decoding cases (the four native rows from #4978, plus padding, whitespace and empty input).
    • tests/acceptance/applications/keyedArchiveXmlNumbers.test.ts: AQI and AQ!ID through inspect-keyed-archive over CLI and MCP; title generalized from "numbers" to "scalars".
  • Base reproduction: the new domain cases on base b83b9caf4 fail exactly the two issue rows (AQI, AQ!ID); the others pass before and after.

  • Native oracle: the four rows observed by the reporter with plutil + plistlib in #4978. The AQ==, AQI= and AQ= = cases and non-ASCII handling are source-derived from the CFPropertyList data parser, not natively executed.

  • Remaining proof gaps: acceptance test not run locally (see below); no macOS native rerun by me.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Windows 11, Node 24.18.0:

  • npm run test:local -- src/domain/propertyListXml.test.ts src/domain/propertyListXmlText.test.ts src/domain/propertyListKeys.test.ts: 91 passed (rerun after the preallocation change).
  • Same domain test file with the base decoder restored: 2 failed (AQI, AQ!ID), 38 passed.
  • npx tsc --noEmit: no errors.
  • npx oxfmt --check (3 changed files): clean.
  • npx oxlint (changed files): no new warnings; the two existing decodeXmlPropertyList warnings (max-lines-per-function, complexity) are also present on base.
  • npm run test:focused -- tests/acceptance/applications/keyedArchiveXmlNumbers.test.ts: not run. The compiled tests need the Windows native addon, and rea-agents@6.6.0 is not yet on npm to restore it from. Relying on CI.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none needed; macOS native behavior taken from the #4978 reproduction.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: decoding only; no new I/O.

Author readiness

Human owner: @avichal-08

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4981 **Author:** [@avichal-08](https://github.com/avichal-08) **Created:** 10/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/plist-data-base64` --- ### 📝 Commits (2) - [`87bfcbd`](https://github.com/morluto/rea/commit/87bfcbd70fab3e199521d69b7567ccd62e6d5e89) fix(plist): decode XML data as CoreFoundation does - [`4cf6cac`](https://github.com/morluto/rea/commit/4cf6cac14a656c37c20dcf4a0baa0e3e75be510d) perf(plist): preallocate decoded XML data bytes ### 📊 Changes **3 files changed** (+55 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/propertyListXml.test.ts` (+14 -0) 📝 `src/domain/propertyListXml.ts` (+30 -4) 📝 `tests/acceptance/applications/keyedArchiveXmlNumbers.test.ts` (+11 -1) </details> ### 📄 Description ## Summary Fixes #4978. XML `<data>` values in property lists were decoded with WHATWG `atob`, so REA reported bytes that Apple's native reader never produces, or refused archives the native reader accepts. They are now decoded the way CFPropertyList does. ## Problem and expected behavior - `<data>AQI</data>`: native result is empty data; REA reported `0102` as observed. - `<data>AQ!ID</data>`: native result is `010203`; REA failed with `artifact_operation_failed`. `atob` pads an incomplete trailing quartet and rejects non-alphabet characters. CFPropertyList skips non-alphabet characters and emits only completed quartets. ## Change and scope `decodeXmlPropertyList`, the shared XML value owner, now decodes `<data>` with a small CF-compatible decoder: skip non-alphabet characters, treat `=` as a zero digit, emit only completed quartets, and shorten the final quartet by the trailing `=` run. Not included: CDATA/comment handling inside `<data>` (the issue reports those as natively rejected) and any numeric behavior (#4852). Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/domain/propertyListXml.ts`, XML value decoding. - Contribution scope fit and linked maintainer decision: not applicable (bug fix). - CLI and MCP/tool-catalog contract: unchanged; data values for the affected spellings now match native decoding. - Provider, bridge, target-format, or platform compatibility: XML plists only; binary plists unaffected. - Evidence, artifact, provenance, or reconstruction contract: unchanged shape; corrects `observed` data bytes. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: - `src/domain/propertyListXml.test.ts`: data decoding cases (the four native rows from #4978, plus padding, whitespace and empty input). - `tests/acceptance/applications/keyedArchiveXmlNumbers.test.ts`: `AQI` and `AQ!ID` through `inspect-keyed-archive` over CLI and MCP; title generalized from "numbers" to "scalars". - Base reproduction: the new domain cases on base `b83b9caf4` fail exactly the two issue rows (`AQI`, `AQ!ID`); the others pass before and after. - Native oracle: the four rows observed by the reporter with `plutil` + `plistlib` in #4978. The `AQ==`, `AQI=` and `AQ= =` cases and non-ASCII handling are source-derived from the CFPropertyList data parser, not natively executed. - Remaining proof gaps: acceptance test not run locally (see below); no macOS native rerun by me. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Windows 11, Node 24.18.0: - `npm run test:local -- src/domain/propertyListXml.test.ts src/domain/propertyListXmlText.test.ts src/domain/propertyListKeys.test.ts`: 91 passed (rerun after the preallocation change). - Same domain test file with the base decoder restored: 2 failed (`AQI`, `AQ!ID`), 38 passed. - `npx tsc --noEmit`: no errors. - `npx oxfmt --check` (3 changed files): clean. - `npx oxlint` (changed files): no new warnings; the two existing `decodeXmlPropertyList` warnings (max-lines-per-function, complexity) are also present on base. - `npm run test:focused -- tests/acceptance/applications/keyedArchiveXmlNumbers.test.ts`: **not run**. The compiled tests need the Windows native addon, and `rea-agents@6.6.0` is not yet on npm to restore it from. Relying on CI. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: none needed; macOS native behavior taken from the #4978 reproduction. - Package or release metadata impact: none. - Security, privacy, process, or containment review: decoding only; no new I/O. ## Author readiness Human owner: @avichal-08 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:42:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6709
No description provided.