Skip to content

fix(native): report unidentified text plists as unknown - #4320

Merged
morluto merged 3 commits into
morluto:mainfrom
Y0UW1SH:fix/4294-plist-source-format
Oct 17, 2026
Merged

morluto merged 3 commits into
morluto:mainfrom
Y0UW1SH:fix/4294-plist-source-format

Conversation

@Y0UW1SH

@Y0UW1SH Y0UW1SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #4294. inspect_plist.format now describes the selected source: OpenStep text, including a data-only value such as <deadbeef>, reports unknown instead of xml. Explicit XML and binary identities remain supported; an explicit JSON identity now reports the existing json variant.

Problem and expected behavior

Generic file -b text descriptions do not establish XML. Neither does plutil's XML conversion. The follow-up prefix probe also mistook OpenStep data delimiters for XML markup and missed BOM-marked UTF-16 XML without a declaration.

Change and scope

Keep source classification in NativeMacOSProvider.plistSourceFormat. Honor explicit identities, then inspect up to 4 KiB of generic text for XML markup using UTF-8 or a UTF-16 byte-order mark. A lone opening angle bracket or an unrecognized prefix remains unknown.

Add 14 provider-boundary cases and seven macOS CLI source-format cases. Preserve decoded values, selected paths, command provenance and conversion limitations. Update the owning documentation and split existing CLI test groups to meet the lint limit.

Contract and boundary impact

  • Semantic owner: native provider source-format classification.
  • Contribution scope: ordinary correction within existing static inspection; maintainer scope decision not applicable.
  • CLI/MCP schemas and arguments: unchanged. Incorrect XML labels become unknown; explicitly identified JSON uses the existing json enum.
  • Platform/provider: existing native macOS file and plutil paths.
  • Evidence: source identity remains separate from converted values; provenance and limitations are retained.
  • Authority/cleanup: selected-file reads and existing inspection subprocesses; the bounded probe closes its file handle.
  • Generated metadata, dependencies, packaging and installation: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.

The subprocesses are the existing inspection tools; the target application is not launched.

Evidence and regression coverage

On a26197c, six provider-boundary regressions failed for the expected format mismatch: three OpenStep data roots reported xml, explicit JSON reported unknown, and two declarationless UTF-16 XML sources reported unknown. Eight controls passed. All 14 pass after the fix.

The original reproduction also failed three OpenStep cases on base 1bd5c5c. Representative boundary results now retain format: "unknown" with value: {"Name":"Example","Items":["a","b"]}, or the data-only value {"$plist_type":"data","base64":"3q2+7w=="}. These provider assertions replay native command results; they are not a real macOS execution claim.

  • 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

Linux x64, Node 24.18.0/npm 11.16.0, locked dependencies:

  • npm run test:focused -- tests/boundary/providers/native/plistSourceFormat.test.ts src/native/parsers/plist.test.ts tests/boundary/cli/nativePlistCli.test.ts: build succeeded; 23 passed, 17 macOS-only CLI tests skipped. Repeated successfully after the final test typing correction.
  • npm run check: all six tasks and architecture guards passed; 0 lint errors and 1,521 existing warnings. The first run caught a test-table typing error, which was corrected before the passing run.
  • npm run verify:test-discovery: all 1,399 test files discovered exactly once.
  • node scripts/check-doc-facts.mjs and git diff --check: passed.
  • Independent review of the complete PR and follow-up diff: no actionable findings.

Current-head CI run 38874377490 passed at 0f1ea4e: static checks, source tests, all five portable test shards, package verification, documentation generation and the real Apple artifact CLI/MCP lane. The macOS job log confirms all 17 native plist CLI tests passed, including both data-only OpenStep regressions; its complete focused selection recorded 239 passed and 4 skipped.

A further review reran the local focused selection (23 passed, 17 macOS-only tests skipped locally) and exercised 14 additional standalone production-boundary probes against the compiled head: explicit JSON without the text word, generic JSON, quoted XML literals, OpenStep comments, oversized data roots, both UTF-16 data byte orders, XML processing instructions/doctype/scalar roots, UTF-8 BOM/whitespace, exhausted prefixes and unidentified non-text descriptions. All passed. These additional probes replay command results through the production runner seam; they do not claim real macOS tool execution. No code change was needed.

Coverage limits: real macOS execution is unavailable locally. The broader native-provider suite was previously blocked before its 46 tests by this host's process-ownership preparation. A fresh, independent Node child-process probe still makes ps -axo ... fail with exit 1 and fatal library error, lookup self. This is not reported as a passing broader suite. The focused plist boundary tests do run here.

Compatibility, safety, and release

No breaking schema, migration, dependency or release-metadata changes. The source probe is bounded and leaves an unrecognized prefix unknown. No target execution, injection or mutation is added. Real macOS plist coverage passed in the existing Apple CI lane; Hopper/Ghidra/IDA verification does not apply.

Author readiness

Human owner: @Y0UW1SH

  • 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

  • Concrete bug, linked issue, focused outcome and conventional title.
  • Existing inspection scope and authority retained.
  • Regression coverage and owning documentation updated.
  • Diff checked for unrelated changes, credentials, generated outputs and unsupported claims.
  • Required CI and real macOS checks pass on the latest head.
  • Human author readiness completed.

Require explicit XML identification in file output instead of treating all
text as XML. Preserve decoded plist values and source-format provenance
when plutil falls back to XML conversion.

Add provider-boundary regressions and real macOS CLI controls for OpenStep,
data-bearing OpenStep, XML, UTF-16 XML and binary property lists.

Fixes morluto#4294
@Y0UW1SH
Y0UW1SH marked this pull request as ready for review October 16, 2026 01:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T08:39:08.713597Z 0f1ea4e New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, subject to the required CI and macOS checks.

Summary

Corrects inspect_plist.format without changing decoded values.

  • Plist inspection reports the selected file's format.

The previous finding is fixed. This review used source inspection; it did not run tests or real macOS tools. Checking whether another PR replaces this one was blocked by missing GitHub authentication.

Reviews (3) · Last reviewed commit: "fix(native): distinguish OpenStep data f..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d09db2a67

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/native/NativeMacOSProvider.ts Resolved
@kaoru0822-kitauji kaoru0822-kitauji added the ci-fix-wip Claimed by the CI-fix track label Oct 16, 2026
`file -b` names XML only when a document declaration is present, so the
narrowed `\bXML\b` check reported a declaration-less XML plist as unknown and
broke the real-plutil `decodes xml plists that plutil cannot express as JSON`
CLI test. When `file` reports only text, read the source head once and label it
XML only when its first non-whitespace character (after a UTF-8 BOM) is `<`;
OpenStep and other text stay unknown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

CI/conflict track. Fixed the Real Apple artifact CLI/MCP E2E failure, which this PR caused, in a26197cd6.

Root cause: decodes xml plists that plutil cannot express as JSON writes an XML plist without an <?xml …?> declaration. file -b reports such a file as ASCII text, with no line terminators, exactly as it reports OpenStep text. Narrowing the check to /\bXML\b/ therefore reported it as unknown instead of xml. A file description alone cannot tell the two apart.

Fix: plistSourceFormat keeps binary and xml from file when it names them. When file reports only text, it reads the first 4 KiB of the source once and labels it xml only if the first non-whitespace character (after a UTF-8 BOM) is <. OpenStep and other text stay unknown, as this PR intends. Open errors keep the existing plist error mapping. I updated the PR's doc paragraph to match.

Test: plistSourceFormat.test.ts adds a BOM-and-whitespace-prefixed XML case that file reports as ASCII text and expects xml; the OpenStep cases still expect unknown.

Validation (macOS, real file/plutil): nativePlistCli.test.ts failed on the previous head (1 failed / 14 passed) and passes now. plistSourceFormat + nativePlistCli: 22 passed. npm run check:fast and npm run docs:check pass. The remaining Source tests/shard/Portable tests failures are main's 7 cleanup/cancellation tests (#4345).

Comment thread src/native/NativeMacOSProvider.ts Resolved
@kaoru0822-kitauji kaoru0822-kitauji removed the ci-fix-wip Claimed by the CI-fix track label Oct 16, 2026
Recognize XML markup instead of treating every leading angle bracket as XML.
Keep data-only OpenStep sources unknown, honor explicit JSON identification,
and decode BOM-marked UTF-16 prefixes before detecting declarationless XML.
Add source-format regressions and macOS CLI cases for data-only sources.

Y0UW1SH commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@kaoru0822-kitauji Following up on your CI repair: the remaining source-format findings are fixed in 0f1ea4e, while preserving your fix for declarationless XML.

  • OpenStep data roots, including <deadbeef> and <>, now remain unknown rather than being mistaken for XML.
  • Explicitly identified JSON reports json; BOM-marked UTF-16 XML is recognized correctly.

The current-head CI run passed, including all five test shards and the real Apple lane. Its macOS log confirms all 17 native plist CLI tests passed. A fresh local rerun also passed 23 focused tests; the 17 macOS cases are skipped locally on Linux.

Both review findings are resolved, and the latest Codex and Greptile reviews cover this head without outstanding findings. The PR description has the current evidence and limitations.

Could you take another look at the current head when you have a chance?

@baron baron mentioned this pull request Oct 17, 2026
4 tasks done

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 0f1ea4efe20ee95a74de56b8ce87da1fe0433c50 across the source-format owner, plutil conversion/value parser and consumer output. No actionable source finding: explicit identities remain distinct from converted values, generic text only gets bounded markup recognition, UTF-16 BOM handling is at that boundary, and OpenStep data roots remain unknown. The probe closes its handle; provenance/limitations are retained. #4047's numeric-decoding change is conceptually compatible and does not replace this source classifier.

Executed in an isolated head snapshot with pinned Node 24.18.0 and an existing byte-identical-lock dependency tree: exact Vitest selection of tests/boundary/providers/native/plistSourceFormat.test.ts and src/native/parsers/plist.test.ts, 23/23 passed. Six separate real macOS /usr/bin/file + /usr/bin/plutil controls confirmed ASCII OpenStep dictionary/data/empty-data classification and declarationless UTF-8/UTF-16 LE/BE conversion. Those controls are real tool evidence, not a public REA CLI/MCP run. No build/install/full check, compiled CLI/MCP or disassembler/client verification was performed locally.

HOLD, not approval: open/non-draft, MERGEABLE/CLEAN, all 35 listed check runs pass or are legitimate skips, including the real Apple artifact lane. However, there is no current-head PR readiness status/check. The human declaration is filled but does not replace that CI gate; please run the readiness workflow before approval.

@morluto
morluto merged commit 4e14452 into morluto:main Oct 17, 2026
35 checks passed
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] inspect_plist reports OpenStep property lists as xml

4 participants