Commit Graph
1225 Commits
Author SHA1 Message Date
morluto 61b4ada453 fix(errors)!: split reader path refusals from malformed target bytes
ArtifactReaderFailure("format") covered two different facts: target
bytes that violate their format, and a selected path that is not a
regular file. The shared selected-file projections
(projectOwnedArtifactInputFailure and classifyProviderFailure's file
step) mapped both to invalid_request with an invalid_format path
issue, so corrupt BEAM files and PE certificate table bodies were
reported as caller argument errors.

Split the reason at its producers:

- Path-kind refusals now use the existing "path" selection reason:
  regular-file admission, the stable root, directory, ZIP, ASAR and
  PyInstaller entries, dyld inputs, the UEFI flash source and extract
  occurrence selection. They stay invalid_request.
- The BEAM parser and the PE certificate table parser raise the format
  owner's ParseFailureError (malformed or truncated, format "beam" or
  "pe-certificate-table"). A short file that does not start with FOR1
  is malformed, not truncated. A PKCS#7 name encoding the decoder does
  not implement is unsupported, not malformed.
- Short reads inside an admitted range (kernel module, kernel build
  config, ELF unwind ranges) are integrity read-coverage failures,
  because the file changed during the read.
- Internal contract breaks (stream chunk size, a non-Buffer keyed
  archive chunk) are invariant violations; an impossible descriptor
  byte count is an I/O failure.

The shared projections now treat only "path" as a selection error.
They take the malformed-target facts from the reader failure's own
parseFailure, which artifactParseFailure sets once from the owner's
ParseFailureError and rebuilt failures keep through primaryFacts.
ArtifactOperationError carries the same facts, so inspect_artifact
refusals (for example Android boot images) now include
details.format_failure, format, offset and field. Android boot entry
planning raises the format owner's malformed failure, and the
redundant shortcut and API-contract format branches are removed.

BREAKING CHANGE: callers that parse `code` see unsupported_target
instead of invalid_request for malformed or truncated bytes from
inspect_erlang_beam and from the inspect_pe_certificates certificate
table body. Truncated reads of a file that changed during
inspect_kernel_module, inspect_kernel_build_config and
inspect_elf_unwind_ranges now report artifact_changed. inspect_artifact
malformed and truncated refusals gain details.format_failure and
details.format. Existing fields are unchanged.
2026-11-23 20:11:49 -05:00
morluto 89c1dd3c32 fix(errors): refuse malformed target bytes as a target, not invalid input (#14195)
* fix(errors): refuse malformed target bytes as a target, not invalid input

parseFailureAnalysisError is the shared owner that turns a byte-format
parser's ParseFailure into a public refusal. It mapped malformed and
truncated bytes to an AnalysisInputError on the path field. The envelope
then reported invalid_request, with inspect_input_contract recovery and
"correct the listed fields". The arguments were valid; the target bytes
were the problem. Readers that wrap the ParseFailureError in an
ArtifactReaderFailure, and ArtifactOperationError reason=malformed, were
classified the same way.

Add AnalysisMalformedTargetError. It keeps the parser's kind, format,
detail, offset and field, and projects as unsupported_target with
details.format_failure. Its recovery is to choose another operation or a
well-formed copy of the target. Route both parser entry points through it
and reclassify ArtifactOperationError reason=malformed. Argument and
selection errors (missing files, directories, symlinks, JSON arguments)
stay invalid_request.

Fixes #14170

* docs(maven): describe duplicate variant names as malformed metadata

Duplicate Gradle variant names go through malformedInput, which now
reports unsupported_target with details.format_failure: malformed.
Point the earlier statement at that section instead of the old
invalid_format code.

* test(errors): expect malformed-target refusals from CLI byte-format readers

Truncated IPS, ELF, PE and shortcut bytes now project as unsupported_target with format_failure=malformed. Update the CLI acceptance cases that still expected invalid_request.

* fix(errors): keep a cancelled read a cancellation whatever its abort reason

projectOwnedArtifactInputFailure read the reader failure's cause without
checking the reader's own reason. A cancelled read carries the caller's
opaque abort reason as that cause, so aborting with a ParseFailureError
turned the cancellation into a non-retryable malformed-target refusal
before the shared cancellation projection ran. Only a reader whose own
reason is malformed or truncated now yields a malformed target.

The ELF dependency checkpoint cancellation test now also aborts with a
parser failure as the reason, through the public provider read.

* test(pe): expect malformed-target refusals from the PE filesystem boundaries

Short non-PE bytes now refuse the target rather than the request field.
The missing-file, directory, symlink and child-path controls keep their
caller-input expectations.

* fix(elf): refuse malformed ELF note bytes as a target, not invalid input

inspect_elf_notes shared this PR's root cause: its parser reported
structural violations as a reader "format" failure, which the shared
stable-artifact projection treats as a request-field error, so truncated
or non-ELF bytes still returned invalid_request. The parser now raises
malformed or truncated ParseFailureErrors, which the shared projection
reports as a malformed target with format_failure and format facts.

Consumers that interpreted the old reader reason now use the parser's
facts: debug-link build-id observation keys on ParseFailureError kinds,
and binary hardening drops its rewrap of note-parser format failures
into BinaryFormatFailure, which the parser's own failure supersedes.

* test(errors): own the byte readers' malformed-target projection in one CLI table

The PR repeated the same malformed -> unsupported_target mapping in a
dedicated CLI test per command and again in each provider's filesystem
boundary test. The stable-artifact parser-failure CLI table now owns it:
every byte reader it covers (now including ELF dependencies, debug link,
unwind ranges and native initializers) refuses a truncated ELF header as
a malformed target with operation, path, format_failure, retained file
identity and no argument recovery.

Removed as redundant with that table: the truncated or non-ELF/non-PE
CLI tests for ELF debug link, dependencies, unwind ranges and notes,
native initializers, and PE imports and certificates; and the
malformed-file blocks in thirteen filesystem boundary tests, which keep
their directory, symlink, missing-file and child-path controls. Format
specific refusals (a truncated IPS body, a wrong shortcut CLSID, DWARF
units) keep their own tests, as do the owner tests in
parseFailureAnalysisError and ArtifactOperationFailure.

* test(errors): expect malformed target bytes as unsupported_target in acceptance tests

The first full acceptance run of this PR found five expectations still
asserting invalid_request for target-byte failures: the timing test's
truncated ELF, a truncated DTB, duplicate Rust dependency JSON, and PE32
and PE64 load-config images without an MZ header. Assert the
unsupported_target code, with format_failure malformed where the
non-MZ PE path matches the already-updated PE imports test.
2026-11-24 00:44:40 +00:00
morluto c4fa5b475c fix(cli)!: accept only the documented kebab-case option spelling (#14204)
* fix(cli)!: accept only the documented kebab-case option spelling

REA's argv parser kept incur's second spelling of every option: the
camelCase schema key (`--maxRows`) bound like the documented
`--max-rows`, although help, completion and manifests list only the
kebab-case form. That hidden alias let wrong spellings survive in the
guides.

The parser now binds only the documented flag. A schema key spelling,
including its `--no-` negation, fails as a typed `flag_spelling`
failure rendered as PARSE_ERROR that names the documented flag:
"Unknown flag: --maxRows. Did you mean --max-rows?". Completion no
longer resolves camelCase option names. The sensitive-value scan still
treats `--sensitiveValue` as a declaration so its value stays redacted
from the refusal.

Guides, the inspect-api-contract option description and tests now use
the kebab-case flags.

BREAKING CHANGE: camelCase option spellings such as `--maxRows` or
`--dryRun` are refused; use the kebab-case flag that `--help` lists.

* test(cli): exercise invalid dry-run values with the documented flag spelling

The invalid dry-run cases in strictPositionals and cliSetup appended
--dryRun=false as a later valid override. The parser now refuses that
schema key spelling before it validates the dry-run value, so each case
failed on flag spelling and never checked that a later override cannot
hide an earlier invalid value. The override is now --dry-run=false, and
each case asserts the dry-run failure message, so a spelling refusal can
no longer satisfy it.

The --dryRun=abc case in cliSetup's malformed-value list is removed: it
was the --dry-run=abc case under a spelling the parser now refuses
before reading the value, and argvParser.test.ts owns that refusal.

* test(cli): keep one public case for the flag spelling refusal

cliOptionAliases repeated argvParser's three token shapes (bare, inline
value, negation) through the full CLI. The parser test owns those shapes
and asserts the structured flag_spelling failure with its flag and
documented spelling; the CLI keeps one case for the documented
PARSE_ERROR projection, whose message is part of the CLI contract.

The camel-case sensitive-value case also dropped its trailing
--no-<literal> token: the spelling refusal stops parsing before it, so
the token no longer exercised anything.
2026-11-23 19:36:23 -05:00
morluto 8ed819573b fix(artifacts): route native images to static readers and name their architecture (#14189)
* fix(artifacts): route native images to static readers and name their architecture

inspect_artifact sent every PE, ELF and Mach-O root straight to
open_binary (PE first to inspect_managed_artifact, whatever its CLI
header) and left architecture null on every inventory node and on the
inspection subject, although the header parsers already know the CPU.

Inventory classification now returns the header's CPU family with the
format, from the same ELF, Mach-O and PE record parsers target admission
uses, so each thin image node (including universal slices and archive
members) names its architecture; an undecoded machine stays null, and a
universal container node names none. When the inventory root is the
open target's own bytes, its Evidence subject carries the architecture
target admission parsed, as it already carried the selection.

Native next probes now list the provider-free readers for the format
before open_binary: PE imports, exports, load config, resources,
hardening and release exposure; ELF dependencies, exports, hardening and
release exposure; Mach-O inspect_macho, inspect_signature, hardening and
release exposure. inspect_managed_artifact leads only when the PE
declares a CLI header, is omitted when it declares none, and stays a
conditional probe for directory members whose declaration is unknown.
The PE hypothesis that inventory cannot tell managed from native is kept
only for that unknown case.

Fixes #14157

* fix(artifacts): keep native readers for executables that carry a package

An executable whose contents inventory as an embedded package (Godot
PCK, PyInstaller, Node SEA, Deno, Bun or a .NET single-file bundle) is
also a native image. Previously inspection proposed only the package
reader and hid the native side.

The inspection now takes the native image facts that target admission
parsed for the root's own bytes, not only the PE CLI-header flag. When
inventory reads those bytes as a package, the package reader comes
first, then the carrier's static readers, then open_binary.

A probe names exactly one operation, so the static readers cannot be
grouped into one entry without changing the advertised schema. They
stay separate rows and share one short rationale, because each tool's
description already says what it reads. Each format's reader list is
now a table.

* fix(artifacts): bind a deep provider for managed PEs only at a native boundary

A PE declaring a CLI header recommended open_binary with generic
function-level advice, so pure managed assemblies were steered to a
deep native provider. Its rationale again requires managed inspection
to report a native or mixed boundary, and a PE whose header is unknown
states the same condition.

* test(artifacts): assert universal slice inventory per host and prune probe snapshots

The universal Mach-O test assumed slice inventory on every host, but the
slice reader runs native lipo and is skipped off macOS, so it failed on the
Linux test shards and portable tests. The test now selects the host platform
through a HostPlatform mock: the slice inventory case runs only on a macOS
host, and the other-host case asserts unknown container coverage with only
the file occurrence on every host. Both keep the selected-slice subject
architecture and static reader order.

Pruning in the probe tests:
- Merge the ARM64 PE, ELF and Mach-O single-image probe tests into one
  parameterised case that asserts subject and root-node architecture, the
  complete static reader list, and that open_binary is the only probe beyond
  artifact bytes.
- Remove the Deno carrier ordering case from the native image probe test;
  the Deno CLI acceptance test covers the same three carriers through the
  public workflow and now asserts the same ordering and authority facts.
- Replace full next-probe arrays in the Bun, Deno, dotnet-bundle and
  PyInstaller CLI/MCP tests with a shared carrier assertion: package readers
  lead, the carrier's format reader is present, and open_binary is last and
  the only non-artifact-bytes probe. The per-format reader list stays owned
  by the native image probe test.

Malformed-header (undecoded machine), unknown architecture and package
subject identity coverage are unchanged.
2026-11-24 00:27:11 +00:00
morluto 03f68dbcba style(tests): format the SQLite acceptance test (#14209)
#14206 updated an expectation in this file without formatting it, so
format:check fails on main and on every branch built from it.
2026-11-23 18:14:22 -05:00
morluto 7b056d2ff8 fix(sqlite): state the runtime requirement in supported-runtime terms (#14206)
The capability reason, worker failure, tool description and skill
reference told users to run Node.js 24.15 or newer, below the 24.22.1
and 26.12.1 floors REA itself requires. Keep the gate on the native
DatabaseSync.limits API floor, and say instead that every supported
Node.js 24.x and 26.x runtime provides it and Node.js 22.x does not.
2026-11-23 18:01:23 -05:00
morluto 609b58b109 perf(debugger): stop repeating command results as raw_result (#14146)
* perf(debugger): stop repeating command results as raw_result

GDB console/startup, Rizin debug, Cutter and reverse-engineering command
Evidence set rawResult to a copy of result, contrary to the raw_result
contract. Every interactive debugger reply therefore carried its records
and output twice. Omit rawResult where no distinct provider
representation exists; tests assert the same facts on normalized_result.

Closes #14145

* test(debugger): assert command results on normalized_result in remaining suites

The composition, CLI delivery, acceptance and MCP suites still read
command output through raw_result, and one fixture built a parent
Evidence record that repeated its result as raw_result. They now assert
the same fields on normalized_result and that raw_result is null.
2026-11-23 17:55:57 -05:00
Anurag SinghandAnurag Singh 604e087c31 fix(adb): report macOS ownership preparation failures as typed host prerequisites (#14140)
Since adb runs under owned supervision, a failed macOS ownership helper
build reached the adb version probe as an unreadable result, so one broken
toolchain failed all of binary_session. adb now reports the shared
ownership_preparation failure that apktool, JADX and Ghidra report, and its
availability probe turns it into runtime_unavailable.

When the host refuses the helper's compiler for capacity (EMFILE), that
retryable constraint now stays primary over the helper root it could not
remove, which remains a retained cleanup dependency.

The four providers build the preparation error through one owner,
ownershipPreparationError, next to the availability check that reads it.

Fixes #13943

Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>
2026-11-23 19:35:58 +00:00
morluto 4bbaf17512 refactor: centralize owned finalization and configuration failures (#14071)
* refactor(config): propagate typed configuration failures

* refactor(lifecycle): centralize completion and cancellation

* fix(config): preserve Hermes YAML edit refusal guidance
2026-11-23 13:40:10 +00:00
morluto a324181ccc refactor(domain): one ByteSource representation for streaming parsers (#14044)
* refactor(domain): one ByteSource representation for streaming parsers

* refactor(nuget): adopt ByteSource across NuGet and APK parsers (#14047)

refactor(nuget,apk): adopt ByteSource and drop the NuGet in-memory parse branch

* test(elf): remove obsolete byte source fixture declarations
2026-11-23 13:25:13 +00:00
hhangandhhang 5aed462db4 perf(views): page exact Playwright trace index hits directly (#14031)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
2026-11-23 08:09:52 -05:00
morluto 71cea564fb fix(v8): preserve verified code cache results and require exact payload reads (#14067) 2026-11-23 12:57:52 +00:00
morluto a5f735c67b fix(devicetree): validate retained report ranges and coverage (#14066) 2026-11-23 12:37:46 +00:00
morluto 2e47bc09f3 fix(erlang): require complete positional BEAM reads (#14045) 2026-11-23 12:13:25 +00:00
morluto 4ff98b84fb fix(python): validate marshal coverage and consolidate pyc tests (#14036) 2026-11-23 06:55:30 -05:00
gensokyo-devandgensokyo-dev a148da56cc feat(analysis-view): filter native exports and ELF dependencies by name prefix
Retained native-exports and elf-dependencies views matched only exact names, so counting the exports or imports in one namespace meant paging every row. Add name_prefixes to the exports collection and to every named elf-dependencies collection. A prefix filter combines with exact names, and coverage.total counts every match, so limit 1 returns a count. ELF export prefixes follow the exact-name identity rules: non-ASCII names compare their UTF-8 bytes, and names that are not valid UTF-8 never match. The tool descriptions now name the filter.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-23 17:41:53 +08:00
morluto d0a9e6b912 refactor(rust): consolidate binary parser checks on positional reads (#14033) 2026-11-23 07:31:43 +00:00
gensokyo-devandgensokyo-dev c01c168336 fix(uefi): attribute a refused output directory to output_directory
An existing output directory was reported as an invalid path issue, which points callers at the firmware image instead of the directory they chose. Route destination refusals through outputDirectoryAdmissionRefusal, as firmware extraction already does.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-23 14:58:56 +08:00
gensokyo-devandgensokyo-dev e617a55385 perf(uefi)!: summarize firmware extraction by default over MCP
A whole-image extraction of a 4 MiB OVMF image lists 560 files in about 553 KB of structured content, which exceeds client result limits. MCP extract_uefi_firmware now retains the complete manifest and returns its summary unless the caller passes detail complete. Targeted extractions fit in the summary's file preview. An optional view returns the first uefi-extraction page in the same call; later pages use inspect_analysis_view. The one-shot CLI command still returns complete Evidence.

BREAKING CHANGE: MCP callers that need every published file inline must pass detail: "complete" to extract_uefi_firmware.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-23 14:58:56 +08:00
morluto 68cc2b9bb0 refactor(go): consolidate native parser checks on positional reads (#14027) 2026-11-23 06:56:52 +00:00
morluto fabe0da74b fix(elf): preserve kernel config framing and location provenance (#14021) 2026-11-23 06:38:04 +00:00
morluto be32625b29 refactor(elf): consolidate kernel module checks on positional reads 2026-11-23 01:18:06 -05:00
RRFZ 4c27f48667 fix(gpu): mark conflicting CUDA shared sections partial and clear register provenance (#13963) 2026-11-23 00:24:21 -05:00
gensokyo-devandgensokyo-dev 11ac37a42f perf(uefi)!: summarize firmware inspection by default over MCP
A complete map of a 4 MiB OVMF image is about 514 KB of structured content, which exceeds client result limits. MCP inspect_uefi_firmware now retains the complete map and returns its summary unless the caller passes detail complete. An optional view returns the first uefi-firmware page in the same call; later pages use inspect_analysis_view. The one-shot CLI command still returns complete Evidence.

BREAKING CHANGE: MCP callers that need every volume, file and section inline must pass detail: "complete" to inspect_uefi_firmware.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-23 13:12:02 +08:00
morluto 6ce7f932bd perf(apk-signature): stream APK signature inspection over FileHandle (#13877)
* perf(apk-signature): stream APK signature inspection over FileHandle

* fix(apk-signature): preserve bounded reads and file identity

* fix(apk-signature): handle deflate EOF and repair verifier bounds

* fix(apk-signature): recognize internal pipeline cancellation at EOF
2026-11-23 03:18:38 +00:00
morluto 99c2104da9 fix(objc): preserve class import reader failures (#13892) 2026-11-23 03:00:10 +00:00
RRFZ a46bc22117 fix(dwarf): reject PE long section names when PointerToSymbolTable is zero (#13889) 2026-11-22 21:50:05 -05:00
morluto 8c16d7d18f fix(javascript): verify Expo context getter ownership (#13803) 2026-11-23 01:21:54 +00:00
wei 6542e81a12 fix(hermes): resolve nested HERMES_HOME selection from the override root (#13792)
The configured override root now owns its sticky selection: setup reads active_profile and resolves the named profile beneath that same root, even when the override sits inside the native Hermes home. The native home's selection no longer determines an override's destinations, so a nested override selecting 'other' plans into its own profiles/other, and an override with no selection plans into the override root itself.

This is a contract change from the native-root rule the docs and tests previously locked in (PR #4145 only documented that rule; it did not change the resolver). The maintainer has not ruled on the change. The override root is still validated with physicalPath before its selection is read, so an unreadable path or dangling alias stays unresolved instead of silently planning into the root.

Refs morluto/rea#3939
2026-11-23 01:18:46 +00:00
RRFZ c1cef729c9 perf(parsers): replace quadratic trailing-quantifier regexes with linear edge scans (#13757)
* perf(parsers): replace quadratic trailing-quantifier regexes with linear edge scans

* test(har): assert response.bodySize in zero negative-exponent lexeme test
2026-11-23 01:11:05 +00:00
morluto 4a62303717 fix(elf): read build IDs without decoding unrelated notes (#13776) 2026-11-23 00:53:05 +00:00
morluto 7c75a5f91b fix(elf): validate core paths before charging mapping output (#13771) 2026-11-23 00:42:23 +00:00
morluto a4f9c2309b fix(elf): respect compressed note storage across inspectors (#13762)
* fix(elf): respect compressed note storage across inspectors

* test(elf): preserve independent hardening note failures
2026-11-23 00:31:02 +00:00
RRFZ b0216a0a7a fix(firmware): report malformed linux,phandle and leave references unresolved (#13734) 2026-11-22 19:11:44 -05:00
RRFZ e6b30f945e fix(native): validate SHT_GNU_HASH bounds and fall back to DT_GNU_HASH (#13713) 2026-11-22 23:47:57 +00:00
morluto f18de40af6 fix(artifacts): preserve DMG verification cancellation at the deadline (#13616) 2026-11-22 21:24:30 +00:00
morluto 3c74128353 fix(flutter): distinguish Dart snapshot exports from local symbols (#13576)
* fix(flutter): distinguish Dart snapshot exports from local symbols

* test(flutter): assert missing snapshot symbol facts
2026-11-22 20:30:28 +00:00
morluto 4d507e8612 fix(managed): isolate invalid string loads from member coverage (#13588) 2026-11-22 20:26:34 +00:00
morluto fa35707313 test(javascript): consolidate exported callable binding proofs (#13575) 2026-11-22 20:06:20 +00:00
morluto df8785796f fix(setup): preserve unresolved registration settings (#13573) 2026-11-22 19:57:02 +00:00
morluto 110b990c68 fix(apk): disclose v1 scan scope without duplicate names (#13572) 2026-11-22 19:39:25 +00:00
morluto c70d1af416 test(rust): consolidate carrier and public Evidence coverage (#13571) 2026-11-22 19:34:07 +00:00
morluto 61c7f2b47f test(gpu): consolidate AMD note provenance coverage (#13568) 2026-11-22 14:25:21 -05:00
morluto 3b6734bfae test(pe): consolidate certificate parsing and public error proofs (#13565)
* test(pe): consolidate certificate parsing and public error proofs

* test(pe): keep lifecycle coverage linked to the BER proof
2026-11-22 14:21:25 -05:00
morluto 503e134ec1 test(javascript): consolidate public loader authority coverage (#13567) 2026-11-22 14:20:24 -05:00
morluto 917ab7f5fd test(python): consolidate pyc parser and CLI coverage (#13566) 2026-11-22 19:08:08 +00:00
morluto 2be4cc468e fix(gpu): keep kernel resources in their owning coordinate space (#13564) 2026-11-22 19:07:59 +00:00
morluto 3f1046d0f8 test(pe): consolidate resource coverage through public adapters (#13562) 2026-11-22 19:04:01 +00:00
morluto fd28d85c9b test(artifacts): consolidate PyInstaller CLI archive coverage (#13563) 2026-11-22 19:00:50 +00:00
Afloat b43084c7fd fix(maven): preserve property value spelling (#13442)
Read property values through the same Java String.trim semantics as other
POM scalar declarations. Preserve non-ASCII boundary characters and
nonempty Unicode-only properties before transport credential removal.

Exercise compiled CLI, stdio MCP and retained Evidence with property
references, ASCII controls, URL redaction and unchanged artifact bytes.
2026-11-22 12:58:07 -05:00