Files
rea/docs/README.md
T
dbbe334ec1 feat(artifacts): inventory macOS flat installer packages offline (#11377)
* feat(artifacts): inventory macOS flat installer packages offline

* fix(artifacts): keep refused pkg members unavailable during inspection

A XAR member whose decode failed or whose decoded size contradicted the
TOC stayed a readable entry, so shared inspection reopened it, hit the
same mismatch at stream flush and aborted the whole scan. Record those
members and have open() report them as unavailable content, so the scan
keeps the partial facts and the named refusal.

* fix(artifacts): report out-of-range installKBytes as unknown

The Distribution parser accepted any safe integer for a pkg-ref's
installKBytes, but the report field is uint32. A value such as
4294967296 parsed fine and then failed schema validation, which
rejected the whole inventory report. Bound the attribute to uint32
at parse time so an out-of-range value reads as unknown.

* fix(artifacts): charge decoded pkg archive bytes against the shared budget

The shared expansion budget charged each Scripts or Payload member by its
stored XAR size, so several small gzip members could each decode toward the
per-archive allowance while barely moving the total. Decode now stops at
what remains of the shared budget, the decoded size is charged, and an
archive that would exceed it is listed as not expanded.

gunzipBounded also recognizes Node's ERR_BUFFER_TOO_LARGE, which is what
maxOutputLength raises, so an oversize gzip member is reported as a limit
rather than as invalid gzip data.

* fix(artifacts): keep expanded pkg Scripts/Payload archives in inventory

Expanding a gzip-cpio Scripts or Payload member deleted the stored XAR
entry, so its heap offset, sizes and TOC checksums dropped out of
inventory and extraction. Keep the stored occurrence at a sibling
logical path (for example Payload.cpio.gz) with sourcePath still naming
the XAR member, so it sits alongside the expanded children.

* fix(artifacts): count pkg check scripts in UTF-8 bytes

scriptLength returned the JavaScript string length, so non-ASCII
installation-check and volume-check scripts reported the wrong byte
count. Measure the selected text with Buffer.byteLength.

* fix(artifacts): keep pkg FIFO and device members non-materializable

A cpio member that is not a directory, symlink or regular file (FIFO,
character or block device, socket) was inventoried as an empty regular
file. Emit it as a metadata declaration with a limitation naming its
type, keep its mode in format metadata, and refuse open() on it.

* fix(artifacts): bound pkg member archived range before reading it

Refuse a zlib-encoded XAR member whose archived heap range exceeds the
compress bound of its decode allowance, and never read the range of an
unsupported encoding, so a package-controlled archived length cannot
reach a buffer allocation unbounded.

* fix(artifacts): refuse installer XML with an unexpected root element

Distribution must have an <installer-gui-script> root and PackageInfo a
<pkg-info> root. Any other root is now a named malformed-input refusal
instead of a product or component identity with null fields.

* fix(artifacts): keep duplicate XAR TOC paths as distinct pkg entries

Key XAR file entries by their TOC occurrence instead of their path, so a
later record at the same path no longer overwrites the earlier one.
Expanded Scripts/Payload member keys now derive from their archive key
for the same reason.

* fix(artifacts): cap streamed XAR inflate output before forwarding it

maxOutputLength does not bound a zlib stream, so count emitted bytes in
createBoundedXarInflate and fail before forwarding past the allowance.
The member stream also fails as soon as decoded bytes pass the TOC
extracted size instead of waiting for EOF.

* fix(artifacts): read XAR TOC execute bits across owner, group and other

The XAR TOC <mode> was tested only on its last octal digit, so a mode
such as 0750 reported a non-executable entry. Parse the octal text and
test (mode & 0o111) like the cpio path.

* fix(artifacts): keep XAR TOC directories and link-only symlinks as pkg entries

TOC records without a heap body were dropped from the inventory, so
directories, symlinks declared only by <link>, and empty files vanished.
They now become their own occurrences: directories stay non-openable,
symlinks open as their declared target text, empty files open as zero
bytes, and other record types are kept as non-materializable metadata.
Installer document lookup only considers heap-backed records.

The shared lifecycle cases open the first entry, so they now use the
component package fixture, whose first TOC record is a heap-backed file.

* fix(artifacts): record Scripts and Payload presence from the XAR TOC

A listed Scripts or Payload archive is now present before expansion is
attempted. When the shared budget skips it or the XAR read is refused,
its compression is reported as "unread" instead of "absent".

* fix(artifacts): keep pkg coverage unknown when content was refused

Coverage was complete whenever no archive hit the shared expansion
budget, even when a heap range, encoding, decode, cpio or pbzx refusal
left content unread. Any refusal other than the header-version notice
now keeps coverage unknown.

* fix(artifacts): only treat the cpio archive limit as a shared budget stop

A zero or oversize cpio namesize raises the name limit, whose maximum is
4096 bytes. When exactly 4096 bytes of shared budget remained, that limit
was mistaken for the budget stop and the refusal was dropped. Match the
limit name as well as its maximum.

* fix(artifacts): keep cpio members read before a damaged tail

A Scripts or Payload archive whose cpio stream ends or breaks after
complete members used to discard all of them and report an empty
inventory with false script flags. parseCpioOdcPrefix now returns the
members read before the failure along with the failure itself, and the
pkg reader keeps those members as entries while recording the refusal,
so coverage stays unknown. A failure before any complete member is
still a plain refusal.

* fix(artifacts): keep an out-of-range XAR TOC mode unknown

Parse <mode> once in the TOC reader. Octal text that does not fit a
uint32 becomes null, so one bad entry no longer fails the inventory
schema check for the whole package.

* fix(artifacts): cancel paused memory-backed pkg members

A retained member streamed into a paused consumer kept its output open
after abort, because the in-memory source has no signal and the shared
stream owner defers cancellation until production finishes. The member
output now retires on abort while its final validation has not started.

* Address review feedback

* fix(artifacts): share one expansion allowance across XAR members

* fix(artifacts): count XAR TOC nodes before building the DOM

A small TOC could hold millions of ignored elements under the byte
limits, and each became a DOM node before the file count ran. Parse
the TOC through parseXmlDocumentWithinNodeLimit with a 256-per-file
node allowance and report a capacity limit past it.

* fix(artifacts): cancel a paused XAR decoder after its source retires

A highly compressed zlib member can finish reading its archived range
while the decoder is still paused on a slow consumer. The file source's
abort listener is gone by then and ownArtifactStream deferred abort until
production finished, so cancellation waited for the consumer to resume.

Once the source closes, an abort now destroys a decoder that has not
ended. The output's final validation only starts after the decoder ends,
so it keeps failure precedence.

* fix(artifacts): reset XAR reader state when preparation retries

When one caller cancelled preparation and another retried it on the
same reader, #prepare built fresh metadata but kept #entries and
#refusedContent from the cancelled attempt. The retry then skipped
members already refused without recording their refusals, so coverage
could report complete while open() still refused the member.

#prepare now clears both maps before it reads the package.

* fix(artifacts): align macOS pkg reader with format failure API and zlib output limits

* fix(artifacts): bound XAR TOC expanded paths, preserve valid TOC records, and populate symlink linkTarget

* fix(pkg): enforce package-wide cpio caps, strict UTF-8 names, root Distribution, and stored size checks

* fix(macos-pkg): bound package-wide installer metadata bytes and records

* fix(macos-pkg): tie installer metadata budgets to artifact_limits.expanded_bytes

Wire macOS flat package Distribution/PackageInfo byte, record, and XML-node
allowances into artifact_limits.expanded_bytes via macosPkgMetadataBudget:
- Preserve the 4 MiB total, 1 MiB per-document, 4,096-record, and 65,536-node
  defaults when artifact_limits.expanded_bytes is omitted so aliased-heap
  metadata bombs remain bounded.
- Charge every Distribution and PackageInfo read (including aliased stored
  heap ranges) against the shared expanded_bytes budget alongside zlib XAR
  members and Scripts/Payload expansion.
- Raise the byte allowances and scale record (1 per 1,024 bytes, min 4,096)
  and XML-node (16 per record) allowances when artifact_limits.expanded_bytes
  is set, and report effective limits with artifact_limits.expanded_bytes
  recovery on metadata limit refusals.
- Also add qualcomm-mbn to PE_OVERLAY_LEADING_FORMATS to resolve the typecheck
  conflict introduced by merging origin/main.

* fix(macos-pkg): strip repeated ./ prefixes and tie cpio limits to expanded_bytes

- Normalize cpio member paths with withoutCurrentDirectoryPrefix (handling
  repeated leading ./ segments and archive-root entries such as ./. and ././)
  both when counting retained path bytes and when forming logical paths,
  preserving the recorded name in sourcePath.
- Derive Scripts/Payload cpio archive-byte, member-count, and expanded
  path-byte allowances from artifact_limits.expanded_bytes via
  macosPkgCpioBudget (keeping 64 MiB / 4,096 members / 4 MiB defaults when
  omitted, removing hardcoded cpio clamps, and reporting effective limits with
  artifact_limits.expanded_bytes recovery).
- Update docs/macos-pkg.md and docs/reference/limits-and-recovery.md and add
  regression tests.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-26 23:29:05 +00:00

232 lines
11 KiB
Markdown

# Documentation directory
Find an installation step, investigation guide, or contributor reference by task.
The [REA website](https://rea.tools/) has worked examples and product pages.
## Getting started
- [Installation and setup](getting-started/installation.md)
- [Supported targets and requirements](reference/supported-targets.md)
- [Client configuration and troubleshooting](getting-started/client-configuration.md)
- [CLI and Evidence](getting-started/cli.md)
- [Guided MCP prompts and completion](getting-started/mcp-prompts.md)
## Desktop applications
- [Desktop installation directories](desktop-applications.md)
- [Desktop application capture](desktop-application-capture.md)
- [Desktop application state](desktop-application-state.md)
- [Desktop application tasks](desktop-application-tasks.md)
- [Desktop application export](desktop-application-export.md)
- [Desktop build computer](desktop-build-computer.md)
- [Desktop build witness](desktop-build-witness.md)
## Agent environments
- [Build RL environments with REA](agent-environments-quickstart.md)
- [Agent environments from recorded captures](agent-environments.md)
## Native binaries
- [Native binary investigation](guides/native/native-investigation.md)
- [Go binary build metadata](guides/native/go-binaries.md)
- [DWARF compile units](guides/native/dwarf-units.md)
- [Offline binary diagnostics](guides/native/binary-diagnostics.md)
- [ELF separate debug files](guides/native/elf-debug-link.md)
- [ELF and Mach-O initializer functions](guides/native/native-initializers.md)
- [ELF unwind function ranges](guides/native/elf-unwind-ranges.md)
- [Linux kernel build config](guides/native/kernel-build-config.md)
- [Recorded crash evidence](guides/native/recorded-crashes.md)
- [Windows Shell Link shortcuts](guides/native/windows-shortcut.md)
- [Acquired NTFS metadata](guides/native/ntfs-metadata.md)
- [Binary hardening](binary-hardening.md)
- [ELF note tables](elf-notes.md)
- [ELF dependency tables](elf-dependencies.md)
- [Linux kernel modules](kernel-modules.md)
- [PE Authenticode certificate tables](pe-certificates.md)
- [PE import and delay-load tables](pe-imports.md)
- [PE TLS callbacks and load configuration](pe-load-config.md)
- [PE x64 exception-directory function ranges](guides/native/pe-unwind-ranges.md)
- [PE overlay](guides/native/pe-overlay.md)
- [Match native functions across builds](native-function-matching.md)
- [Rust binary dependency metadata](rust-binaries.md)
- [Static CUDA and HIP code objects](gpu-code-objects.md)
## JavaScript and Electron
- [JavaScript Application Graph](guides/javascript/javascript-application-graph.md)
- [Cross-layer JavaScript application workflows](guides/javascript/javascript-application-workflows.md)
- [JavaScript artifact reconstruction](guides/javascript/javascript-artifact-reconstruction.md)
- [JavaScript source recovery](guides/javascript/javascript-recovery.md)
- [Passive Node and Electron runtime observation](guides/javascript/javascript-runtime-observation.md)
- [JavaScript static/runtime reconciliation](guides/javascript/javascript-runtime-reconciliation.md)
- [Electron file-page observation](guides/javascript/electron-observation.md)
- [V8 code cache inspection](guides/javascript/v8-code-cache.md)
- [Electron fuse state](electron-fuses.md)
- [Static JavaScript route inventory](javascript-route-inventory.md)
- [Bun standalone executables](bun-standalone.md)
- [Deno compile executables](deno-standalone.md)
- [Node.js single executable applications](node-sea.md)
## Browser and captured websites
- [Website observation with CDP](guides/web/browser-observation.md)
- [Browser scenario contract](guides/web/browser-scenario-contract.md)
- [Website runtime source attribution](guides/web/web-runtime.md)
- [Historical web network captures](guides/web/web-network-captures.md)
- [HTTP/3 capture lab](http3-capture-lab.md)
- [Captured website source locations](guides/web/web-source-location.md)
- [Captured website module relationships](guides/web/website-module-trace.md)
- [Captured website scripts and static JavaScript analysis](guides/web/website-script-export.md)
- [Offline Playwright traces](playwright-traces.md)
## Android applications
- [Static Android APK analysis](guides/android/android-analysis.md)
- [Apktool resource decoding](guides/android/apktool-resource-analysis.md)
- [ADB device inspection and acquisition](guides/android/adb-device-analysis.md)
- [Flutter build identification](guides/android/flutter-analysis.md)
- [Android boot and vendor_boot images](android-boot-image.md)
- [APK signature schemes](apk-signature.md)
## Apple applications
- [Apple Application Inventory Projection](guides/apple/apple-application-analysis.md)
- [Apple IPS crash reports](apple-ips.md)
## .NET assemblies
- [Managed-code analysis](guides/managed/managed-code-analysis.md)
- [NuGet packages](guides/managed/nuget-nupkg.md)
- [VS Code extension packages](guides/managed/vsix-package.md)
- [.NET single-file bundles](dotnet-bundles.md)
- [IL2CPP metadata](il2cpp-metadata.md)
## Firmware
- [Firmware analysis](guides/firmware/firmware-analysis.md)
- [Android OTA update payloads](guides/firmware/android-ota-payload.md)
- [Android Verified Boot vbmeta images](guides/firmware/android-vbmeta.md)
- [Android sparse images](guides/firmware/android-sparse-image.md)
- [UBI images](guides/firmware/ubi-images.md)
- [Flattened devicetree inspection](devicetree.md)
- [ESP flash images](esp-flash-image.md)
- [ESP images](esp-image.md)
- [U-Boot FIT images](fit-images.md)
- [Qualcomm MBN images](guides/firmware/qualcomm-mbn-images.md)
- [Intel HEX and S-record images](hex-records.md)
- [UF2 and DfuSe images](uf2-dfuse.md)
- [U-Boot legacy uImage containers](uimage.md)
- [uClinux bFLT flat executables](bflt-executables.md)
## HarmonyOS packages
- [Static HarmonyOS package inventory](guides/harmony/harmony-analysis.md)
<a id="additional-guides"></a>
## Packages and metadata
- [Offline API contract inventory](api-contracts.md)
- [CycloneDX dependencies](guides/native/cyclonedx-view.md)
- [Maven POM and Gradle module metadata](maven-gradle-metadata.md)
- [OCI image layouts](guides/artifacts/oci-image-layout.md)
- [Release exposure](release-exposure.md)
- [Model file declarations](model-artifacts.md)
- [Python packaged applications](python-packaged-applications.md)
- [Debian package inspection](deb-package.md)
- [CPython pyc inspection](python-pyc.md)
- [Erlang BEAM files](erlang-beam.md)
- [Godot PCK archives](godot-pck.md)
- [UnityFS AssetBundle archives](unityfs.md)
- [iNES containers](ines-containers.md)
- [Nintendo DS ROMs](guides/firmware/nds-roms.md)
- [WeChat mini-program wxapkg archives](wxapkg.md)
- [macOS flat installer packages](macos-pkg.md)
- [ISO 9660 disc images](guides/firmware/iso9660-images.md)
- [tar and gzip-compressed tar archives](tar-archives.md)
- [Nintendo Switch NSO and NRO executables](guides/firmware/switch-executables.md)
- [GPU asset headers: DDS, GLB, KTX and KTX2](gpu-asset-headers.md)
## WebAssembly
- [Offline WebAssembly artifacts](guides/wasm/wasm-artifacts.md)
## EVM contracts
- [Offline EVM bytecode](guides/evm/evm-bytecode.md)
## Databases and recorded packets
- [SQLite database snapshots](guides/data/sqlite-databases.md)
- [Recorded packet capture inspection](guides/data/packet-captures.md)
- [Packet capture summaries](guides/data/pcap-analysis.md)
## Process capture and instrumentation
- [Process capture](guides/runtime/process-capture.md)
- [Frida instrumentation](guides/runtime/frida-instrumentation.md)
## Provider setup and formats
- [Ghidra provider semantics](providers/ghidra-provider.md)
- [DOS MZ and COM analysis with Ghidra](providers/ghidra-dos.md)
- [Optional NativeAOT metadata recovery](providers/ghidra-nativeaot.md)
- [MIPS ELF analysis through Ghidra](providers/ghidra-mips.md)
- [PSP static ELF analysis through Ghidra](providers/ghidra-psp.md)
- [RISC-V ELF analysis through Ghidra](providers/ghidra-riscv.md)
- [Windows Ghidra P0](providers/windows-ghidra-p0.md)
- [Headerless raw-binary analysis with Ghidra](providers/raw-binary.md)
- [IDA provider](providers/ida-provider.md)
- [JEB instrumentation and analysis](providers/jeb-analysis.md)
- [GameCube DOL analysis through Ghidra](ghidra-dol.md)
- [PowerPC ELF analysis through Ghidra](ghidra-ppc.md)
- [Kuna provider](kuna-provider.md)
- [Reverse-engineering tool integrations](reverse-engineering-tools.md)
## Contracts and evidence
- [MCP runtime contracts](reference/mcp-contracts.md)
- [Target failures](reference/target-failures.md)
- [Directory identity](reference/directory-identity.md)
- [Reconstruction obligation ledgers](reference/reconstruction-obligation-ledgers.md)
- [Reconstruction coverage](reconstruction-coverage.md)
## Development and verification
- [Documentation ownership and authoring](development/documentation.md)
- [Settings and recovery](reference/limits-and-recovery.md)
- [REA limit inventory](reference/rea-limit-inventory.md)
- [MCP tool design](development/tool-design.md)
- [Testing REA](development/testing.md)
- [Client and agent verification](development/client-verification.md)
- [Reconstruction readiness conformance](development/reconstruction-readiness.md)
- [Releasing REA](development/releasing.md)
- [Testing lanes and provider verification](testing-lanes.md)
- [Measure MCP catalog costs in Codex](mcp-catalog-evaluation.md)
- [Static analysis in GitHub Actions](ci-analysis.md)
## Release migrations
- [Upgrading from REA 6.1 to 6.2](migrations/migration-6.2.md)
## Signal recordings
- [Recorded signal inspection](guides/signals/signal-recordings.md)
<a id="machine-owned-documentation"></a>
## Generated files and release records
| Path | Owner and update command |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `public/product-catalog.json` | Ignored contract projection; `npm run docs:generate` |
| `verification/managed-conformance-*.json` | Ignored managed conformance projections; `npm run evidence:generate` |
| `error-contract.schema.json` | Tracked schema from contracts; `npm run docs:error-schema` |
| `user-visible-errors.csv` | Generated error code and category per domain and provider-owned error case; `npm run docs:error-schema` |
| `releases/<version>.contributions.json` | Durable release contribution record; follow the [release guide](development/releasing.md) |
Regenerate catalogs and Evidence projections from their canonical source.
Release records preserve the exact commit messages and references for each release.
Guides share authored images in `assets/`.