[PR #7166] fix(apple): observe keyed-archive dates when the offset table reaches the trailer #7690

Open
opened 2026-11-03 13:39:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7166
Author: @devreddy1015
Created: 10/25/2026
Status: 🔄 Open

Base: main ← Head: fix/keyed-archive-date-table-bounds


📝 Commits (4)

  • b150d13 fix(apple): observe keyed-archive dates when the offset table reaches the trailer
  • e88c07c fix(apple): rebuild a complete trailer when cloning plist scalars
  • f7bcbea Merge remote-tracking branch 'origin/main' into fix/keyed-archive-date-table-bounds
  • fa44319 fix(apple): keep every source byte when cloning plist scalars

📊 Changes

3 files changed (+146 additions, -12 deletions)

View changed files

📝 src/artifacts/apple/KeyedArchiveReader.test.ts (+131 -1)
📝 src/artifacts/apple/PlistScalars.ts (+12 -8)
📝 src/artifacts/apple/PropertyListDecodeBudget.ts (+3 -3)

📄 Description

Summary

inspect_keyed_archive reported a sub-millisecond NSDate as an exact timestamp when the binary plist's offset table runs into the trailer, a layout the keyed-archive preflight admits and plist@5 decodes. Expected output is the documented unknown date: iso8601: null plus the unknown-date limitation.

Change

  • scanBinaryPlistScalars bounds offset-table reads by end of file instead of the trailer, matching decoder bounds. Strict callers are unchanged.
  • Reconciled with #7820: its append-only rewrite already fixes the truncated-trailer crash Greptile found, so my earlier size helper is dropped.
  • Codex follow-up: the rewrite now copies the whole source buffer, including the old trailer, before appending clones, the new table and a new trailer. Before, an object stored in the trailer's spare bytes after an overlapping table was overwritten, and plist@5 threw Unsupported int size: 256. The offset width and both budget estimates now count the extra trailer.

Evidence

  • Three regressions in KeyedArchiveReader.test.ts cover the table running into the trailer: a sub-millisecond date, an overlapping date (Greptile's case), and an object in the trailer's spare bytes (Codex's case). All three fail on current main and pass here.
  • src/artifacts/apple/ and src/native/parsers/: 367 tests pass. keyedArchivePostTable.test.ts from #7820 passes. Typecheck, lint and format pass.
  • Not run: the full CI suite. Tested on Linux x64 with Node 26.12.1. The build's metadata check needs the pinned Node 24, so I compiled with npm run compile.

Scope: a static parsing fix within existing boundaries, with no CLI/MCP contract, package or metadata change.

Author readiness

Human owner: @devreddy1015

  • 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/7166 **Author:** [@devreddy1015](https://github.com/devreddy1015) **Created:** 10/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/keyed-archive-date-table-bounds` --- ### 📝 Commits (4) - [`b150d13`](https://github.com/morluto/rea/commit/b150d13e3586358a4302b7199500f816dd4c09f5) fix(apple): observe keyed-archive dates when the offset table reaches the trailer - [`e88c07c`](https://github.com/morluto/rea/commit/e88c07c5117e03cca7fcb007fa724a8d5d4f52c5) fix(apple): rebuild a complete trailer when cloning plist scalars - [`f7bcbea`](https://github.com/morluto/rea/commit/f7bcbea84d5c1eecdda9bdb36b729726acb5fdf5) Merge remote-tracking branch 'origin/main' into fix/keyed-archive-date-table-bounds - [`fa44319`](https://github.com/morluto/rea/commit/fa443194b1fa4b6bad8b2b64d00d42423aa4b86c) fix(apple): keep every source byte when cloning plist scalars ### 📊 Changes **3 files changed** (+146 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/apple/KeyedArchiveReader.test.ts` (+131 -1) 📝 `src/artifacts/apple/PlistScalars.ts` (+12 -8) 📝 `src/artifacts/apple/PropertyListDecodeBudget.ts` (+3 -3) </details> ### 📄 Description ## Summary `inspect_keyed_archive` reported a sub-millisecond `NSDate` as an exact timestamp when the binary plist's offset table runs into the trailer, a layout the keyed-archive preflight admits and plist@5 decodes. Expected output is the documented unknown date: `iso8601: null` plus the unknown-date limitation. ## Change - `scanBinaryPlistScalars` bounds offset-table reads by end of file instead of the trailer, matching decoder bounds. Strict callers are unchanged. - Reconciled with #7820: its append-only rewrite already fixes the truncated-trailer crash Greptile found, so my earlier size helper is dropped. - Codex follow-up: the rewrite now copies the whole source buffer, including the old trailer, before appending clones, the new table and a new trailer. Before, an object stored in the trailer's spare bytes after an overlapping table was overwritten, and plist@5 threw `Unsupported int size: 256`. The offset width and both budget estimates now count the extra trailer. ## Evidence - Three regressions in `KeyedArchiveReader.test.ts` cover the table running into the trailer: a sub-millisecond date, an overlapping date (Greptile's case), and an object in the trailer's spare bytes (Codex's case). All three fail on current main and pass here. - `src/artifacts/apple/` and `src/native/parsers/`: 367 tests pass. `keyedArchivePostTable.test.ts` from #7820 passes. Typecheck, lint and format pass. - Not run: the full CI suite. Tested on Linux x64 with Node 26.12.1. The build's metadata check needs the pinned Node 24, so I compiled with `npm run compile`. Scope: a static parsing fix within existing boundaries, with no CLI/MCP contract, package or metadata change. ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @devreddy1015 - [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 <!-- Draft PRs may leave pending items unchecked. Resolve material scope and authority questions before integration. --> - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7690
No description provided.