Commit Graph
923 Commits
Author SHA1 Message Date
Vincent Koc f1c1787b8f refactor(elf): share kernel version report fields (#16286) 2026-12-03 08:28:57 +00:00
Vincent Koc eb779420bc test(dwarf): share compile-unit abbreviation fixtures (#16282) 2026-12-03 08:14:20 +00:00
Vincent Koc a52d543f73 refactor(pe): share import descriptor walking (#16225) 2026-12-03 04:57:56 +00:00
Vincent Koc 3ad95af7fa refactor(lnk): share LinkInfo block validation (#16219) 2026-12-03 04:25:29 +00:00
Vincent Koc 56f9215346 refactor(elf): share empty debug-link build ID records (#16135) 2026-12-02 23:12:02 +00:00
Vincent Koc 7fe0c023c2 refactor(elf): share GNU version record accounting (#16133) 2026-12-02 23:00:38 +00:00
Vincent Koc cadaa428b8 test(swift): reuse witness table fixture maps (#16055) 2026-12-02 17:25:45 +00:00
Vincent Koc 65b4706819 test(native): share Objective-C dispatch projection fixtures (#15892) 2026-12-02 11:33:36 +00:00
Vincent Koc 0ca5e5733e refactor(native): reuse prefix-backed hardening reads (#15882) 2026-12-02 10:42:55 +00:00
044f3309a8 test(native): change the Mach-O source size when simulating a mutation (#15798)
Two cleanup-retry cases rewrote the 21-byte source with another 21-byte
string. File identity compares stat fields, so on file systems whose
timestamps advance in coarse ticks, such as ext4, a rewrite in the same tick
kept the identity. The case that also fails descriptor close then expected
AnalysisArtifactChangedError and received the reader failure. Writing a
different size makes the mutation visible regardless of timestamp
resolution.

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 14:08:05 +08:00
Anurag Singh 0bfff49176 test(native): give the unaligned FAT slice case its spare byte explicitly
The FAT fixture now ends with its last slice, so shifting that slice by
one byte would run past the file and fail as truncated before the
alignment check. The case adds the byte it needs, like the matching
load-command reader test.

Refs #15534
2026-12-02 13:41:41 +08:00
Vincent Koc 8f8a8539fc refactor(text): share unpaired surrogate checks (#15770) 2026-12-02 03:59:29 +00:00
Vincent Koc b5bcc214bd refactor(swift): share Objective-C conformance reads (#15760) 2026-12-02 03:14:08 +00:00
Vincent Koc 160df1cda3 refactor(elf): share unwind-header result assembly (#15735) 2026-12-02 02:16:45 +00:00
Vincent Koc 34548945c5 refactor(apple-ips): share lossless JSON container parsing (#15730) 2026-12-02 01:58:17 +00:00
Vincent Koc 86239c716b refactor(elf): reuse debug section location outcomes (#15655) 2026-12-01 22:50:54 +00:00
morluto 0f1bedc65a fix(packages): report the declared ZIP entry total in entry-count refusals (#15634)
* fix(packages): report the declared ZIP entry total in entry-count refusals

inspect_vsix_package and inspect_nuget_nupkg reported the stopping counter
(max_entries + 1) as the requirement, so retrying with it failed one entry
later each time. The end-of-central-directory record declares the total
before enumeration; zipDirectoryRecords now carries that total with each
record, and the VSIX, NuGet and artifact ZIP readers report it as the
requirement (artifact_limits.zip.member_count now reports required_value).

inspect_pe_imports said the image "declares" max + 1 descriptors or
functions. Those tables are null-terminated and declare no total, so the
refusal now says the count is above the allowance and leaves the total
unknown.

Refs #15608

* test(zip): cover the ZIP64 entry total in member-count refusals
2026-12-01 16:35:49 -05:00
Vincent Koc c3dbd0f1e4 test(fixtures): share unsigned LEB128 encoding (#15630) 2026-12-01 21:20:18 +00:00
Vincent Koc 7c02d53b1f test(dos): share padded MZ image fixture (#15575) 2026-12-01 18:27:39 +00:00
morluto a69837647b test: fix false-pass assertions, consolidate suites, and close coverage gaps (#15519)
* test: fix false-pass assertions, consolidate suites, and close coverage gaps

* test: finish signal-0, unchecked close_binary, and vacuous .every() audit

* test(registration): run shared capture inside test so child inherits scaled deadline

* test(artifacts): bind final verification fault to reader source and post-read phase
2026-12-01 18:10:12 +00:00
morluto 9fabd0323f test(providers): assert the specific refusal behind each bare toThrow (#15528)
* test(providers): assert the specific refusal behind each bare toThrow

Replace bare toThrow() in adapter, artifact, parser and server tests with the errno code of a removed path or closed descriptor, the Zod issue path and code per case, the parse failure kind and message or reason per case, the cleanup retry failure and the resources it still holds, or the contract message each refusal reports.

* test(artifacts,ghidra): assert retained cleanup resources instead of their message

* test(artifacts): assert the keyed-archive truncation as its parse failure facts
2026-12-01 12:49:19 -05:00
Vincent Koc c72115f803 refactor(kernel-module): share section admission (#15511)
* refactor(kernel-module): share section admission

* fix(kernel-module): preserve section report literal types
2026-12-01 15:55:11 +00:00
Vincent Koc 8535d82158 refactor(elf): share version table admission (#15514) 2026-12-01 15:53:40 +00:00
Vincent Koc 57167985fa refactor(shortcuts): share LinkInfo string reading (#15492) 2026-12-01 15:06:15 +00:00
Vincent Koc ee3f887967 refactor(elf): share note table scanning (#15488) 2026-12-01 14:51:07 +00:00
Vincent Koc 963024935e refactor(dates): share Gregorian calendar day validation (#15463) 2026-12-01 11:50:28 +00:00
morluto db9a030020 test(artifacts): assert exact refusal reasons, limits and cleanup reports (#15379)
* test(artifacts): assert exact refusal reasons, limits and cleanup reports

Replace ok:false-only, bare toThrow, class-only, expect.any and negative-only checks in parser and artifact tests with the exact failure kind, reason, limit, cleanup report, classification and retained samples the producers report.

* test(uefi): assert the receipt issue path through the retained cause
2026-12-01 02:09:05 +00:00
2SinceJuly aea385cda1 feat(evtx): inventory Windows event log records offline
Inventory EVTX file, chunk and record headers with source-scoped identities, full timestamp precision and explicit partial coverage. Discover the reader from first-contact inspection.

Refs #9174.
2026-11-30 20:25:14 +08:00
a5aee4f9e9 feat(artifacts): inventory Android super image metadata (#14928)
* feat(artifacts): inventory Android super image metadata

Refs #14391

* fix(artifacts): preserve partial Android super metadata evidence

* fix(artifacts): recognize Android super PE overlays

Refs #14928

* fix(artifacts): reject an Android super device with no usable sector

A first usable sector at the device size was accepted, so extent checks
reported a different field. Keep stored copy failures to malformed,
truncated, and unsupported now that format failures include unrecognized.

* fix(artifacts): preserve Android super partial evidence on budget exhaustion

* fix(mcp): preserve existing provider partial observation contracts

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-11-30 06:15:43 -05:00
김준호 c552392248 fix(native): keep inspect_macho usable when dyld_info rejects the chained-fixups seg_count (#15147)
* fix(native): keep inspect_macho usable when dyld_info rejects the chained-fixups segment count

dyld_info exits 1 with 'chained fixups, seg_count does not match number
of segments' for every report on Docker Desktop 4.87's backend, whose
trailing __DWARF segment is not counted in dyld_chained_starts_in_image.
inspect_macho then failed as an unclassified execution_failure although
nm, dwarfdump and the load table still describe the slice. Admit this
refusal like the other slice refusals: imports are reported unavailable,
exports keep the nm observations, and the diagnostic is a limitation.

Fixes #15146

* test(native): cover the seg_count refusal on a chained-fixups trailing-__DWARF layout

Build the refused case from __TEXT, __LINKEDIT and a trailing __DWARF
segment with LC_DYLD_CHAINED_FIXUPS, and check that the chained import path
adds no nm call and no chained-table limitation. State the comment in terms
of the layout and the observed dyld_info reports.

* style(native): trim the seg_count refusal comments
2026-11-30 13:05:50 +08:00
ShuaixinHuangandShuaixinHuang 5c11199c59 fix(native): keep MIPS64 relocated initializers unresolved (#15106)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
2026-11-29 20:39:10 -05:00
Adolanium 06761f2993 fix(xml): bound element depth at the XML syntax boundary (#14998)
* fix(xml): refuse element depth at the syntax check

saxes keeps one handler per event and walks the open-element stack on
every start tag. checkXmlSyntax now owns opentagstart and closetag, runs
every caller handler after the depth check, and refuses depth above 1024
as xml-element-depth. 1024 stays above the desktop XML view cap and the
plist nesting cap. This release adds no runtime override.

* fix(xml): keep the depth limit when package parsers read XML

XAR TOC, installer XML, Maven POM, and VSIX manifest parsing wrapped
every syntax failure as malformed or a node budget. A depth limit is
returned as the limit failure those callers already accept.

* test(xml): cover element depth past the syntax ceiling

A document one element past 1024 fails the syntax check, including a
XAR TOC that used to parse because a later opentagstart handler replaced
the depth guard. A sibling range after a branch at the ceiling still
matches.

* test(plist): keep nesting refusals inside the XML depth ceiling

Plist fixtures deeper than 1024 now fail at syntax, so the nesting-limit
cases sit on the deepest document the syntax check admits. One plist and
one keyed archive assert the syntax limit past that ceiling.

* fix(xml): type the depth guard as a saxes start tag

opentagstart emits a start tag, not the finished SaxesTagNS. The handler call failed typecheck on that assignment.

* fix(xml): report element depth from the package providers

A VSIX manifest or Maven POM past the syntax ceiling is an XML limit. Those providers only translated their own format, so the refusal became an I/O error.

* fix(xml): report element depth as a fixed allowance

* fix(firmware): report SVD element depth as the XML ceiling

* fix(nuget): preserve XML element depth on package XML

* fix(capture): preserve XML element depth in SAZ metadata

* style(nuget): format the package fixture

* fix(plist): report XML element depth from native inspection

* fix(pkg): carry the XML depth allowance through a deep TOC

* test(plist): narrow the XML depth refusal before projection

The native depth failure is an analysis error. Project it after that check.
2026-11-29 13:08:39 -05:00
Akshat GuptaandAkshat 2a1a5e903f fix(macho): separate chained bind addends from import names (#14900)
* fix(macho): separate chained bind addends from import names

dyld_info prints a nonzero chained bind addend as a +0x suffix on the
import name, so rows such as __ZTVN10__cxxabiv117__class_type_infoE+0x10
were reported with name null and name_status "ambiguous". When the slice's
chained-fixup import table names the row's ordinal, a row that is that
name plus a hex suffix now reports the exact name and the suffix as
addend. A row equal to the table name keeps a literal suffix, and rows the
table does not settle stay ambiguous with the full expression in raw_name.

* fix(macho): take only dyld's 0x addend prefix and either ordinal spacing

An addend after the import-table name is accepted only with the lowercase
0x prefix dyld_info prints, so a +0X suffix stays ambiguous instead of
yielding an addend that fails the hex address schema. The arm64e CLI test
accepts one or two spaces after the ordinal, as the parser does.

---------

Co-authored-by: Akshat <akshatg9536@gmail.com>
2026-11-29 13:07:40 -05:00
Lewis WangandClaude Opus 5.5 86c27a9b55 fix(native): report ivar layouts that a Swift initializer assigns at load as unknown (#15095)
* fix(native): report ivar layouts that a Swift initializer assigns at load as unknown

A Swift class whose field layout is not fixed at compile time, for
example one holding an @Observable registrar or another resilient type,
sets RO_HAS_SWIFT_INITIALIZER in its class_ro_t. Swift stores 0 as the
placeholder offset of each field without a fixed offset, and size 0 and
alignment 1 for a field type without a fixed layout. The metadata
initializer writes the real values at load. inspect_native_dispatch_metadata
reported those placeholders as decoded offsets and sizes.

In such a class, a stored offset of 0 is now a null offset, and a
stored size of 0 nulls size, alignment and type encoding, which the
initializer replaces together. The row is partial with
ivar_layout_assigned_at_load. Classes without the flag keep their stored
values, including a genuine zero offset. The reader profile becomes
apple-metadata-reader-6 so earlier snapshots are not replayed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(native): state that a zero-size Swift field has placeholder bytes

In a class with RO_HAS_SWIFT_INITIALIZER, Swift stores a field of a
zero-size type such as Void with offset 0, size 0 and alignment 1, the
same bytes as a field whose layout the initializer assigns at load.
ivar_t does not record the field's type, so its size stays unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:06:25 -05:00
RRFZ 2c07552b64 fix(limits): report details.limit for KernelModuleProvider refusals (#14306)
* fix(limits): report details.limit for ELF dependency, unwind, and kernel reader refusals

Attach structured `details.limit` metadata to per-call budget refusals across
the remaining `src/native/elf/` providers (`ElfDependenciesProvider`,
`KernelModuleProvider`, `KernelBuildConfigProvider`, and
`ElfUnwindRangesProvider`), following the `#14243` shared-budget pattern:

- Generalize `elfReadBudgetLimit` in `src/domain/native/elfReadBudgets.ts` so
  ELF and kernel readers share one parameter-limit builder.
- Export `ELF_DEPENDENCIES_READ_BUDGETS`, `KERNEL_MODULE_READ_BUDGETS`,
  `KERNEL_BUILD_CONFIG_READ_BUDGETS`, and `ELF_UNWIND_RANGES_READ_BUDGETS` from
  their domain schemas so Zod input bounds and projected `details.limit`
  metadata have a single owner.
- Report `details.limit` for caller-selected file, entry, inflation, and record
  budgets, including `compressed_candidate_bytes` (`max_config_bytes`), while
  moving `KernelBuildConfigProvider` file-size handling onto
  `offlineArtifactFailureDialect.fileSize` and removing its unreachable
  `capacity` branch.
- Report `ElfUnwindRangesProvider`'s fixed 16 MiB `symbol_name_text_bytes`
  allowance through `fixedAllowanceOptions` with narrowing guidance and
  `related: { parameters: ["limit", "offset"] }`, registered in
  `scripts/verify/fixed-ceiling-registry.json` under `#14235`, rather than
  reporting an inverted `details.limit`.
- Remove `ElfDependenciesProvider.ts`, `ElfUnwindRangesProvider.ts`, and
  `KernelBuildConfigProvider.ts` from
  `scripts/verify/untyped-budget-refusal-baseline.json`, clearing all
  `src/native/elf/` entries from the baseline, and update
  `docs/reference/rea-limit-inventory.md` and
  `docs/reference/limits-and-recovery.md`.

Part of #14234

* test(elf): assert CLI details.limit and flags for kernel module budgets

* fix(elf): report required_value for KernelModuleProvider max_file_bytes and add MCP recovery test
2026-11-28 22:58:31 +08:00
gensokyo-devandgensokyo-dev 27612481f0 fix(elf): leave the unwind GOT base unknown when DT_PLTGOT is not established
resolveGotBase returned the first nonzero DT_PLTGOT, so a later row naming
another base, a table with no DT_NULL, or a table longer than the
4096-entry scan bound still produced a GOT base, and DW_EH_PE_datarel FDE
starts were reported with complete coverage. A PT_DYNAMIC outside the file
fell back to .got.plt or .got instead.

The table is now read through the shared dynamic-table walker. A base is
used only when the rows are read through DT_NULL and every nonzero
DT_PLTGOT agrees; rows after DT_NULL are ignored. Otherwise, or when the
declared table lies outside the file, the base stays unknown and the
affected ranges are omitted with partial coverage. Independently decoded
FDEs remain.

Fixes #12446

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-28 22:54:09 +08:00
gensokyo-devandgensokyo-dev a9180c0dfe test(elf): write caller-chosen dynamic rows in unwind fixtures
The unwind fixture can now declare its .dynamic rows in order, without an
implied DT_NULL, and a .got.plt section next to a DT_PLTGOT-only GOT, so
tests can build conflicting, unterminated or oversized dynamic tables.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-28 22:54:09 +08:00
RRFZ f9e9e8e4c0 fix(windows-shortcut): keep target_extension unknown when declared LinkInfo or RELATIVE_PATH is unread (#13946) 2026-11-28 22:16:39 +08:00
morluto 13f618e8e3 fix(native): report non-native bytes as unrecognized, not malformed (#14936)
* fix(native): report non-native bytes as unrecognized, not malformed

A file that is not the format a reader owns was reported as a broken file
of that format. `inspect_native_initializers` called a PE file or random
bytes a malformed target, and the thin Mach-O reader called any bytes
without Mach-O magic a malformed Mach-O.

Format owners can now say "these bytes are not my format": parse failures
and format target failures gain the `unrecognized` kind that target
failures already define ("no reader for this operation recognizes the
bytes"). The owners report it once:

- the thin Mach-O reader, for bytes without Mach-O magic;
- the shared native container reader, for bytes that are not ELF, PE or
  Mach-O (previously `unsupported`);
- the initializers provider, for a file with neither ELF nor Mach-O magic.

Function starts no longer pre-checks the header itself; the shared reader
owns that decision. IL2CPP keeps mapping unknown native bytes to its
unsupported-container reason. A recognized header that is cut off or
broken stays truncated or malformed.

* fix(resources): keep every format failure kind's facts through artifact wrappers

`ArtifactReaderFailure` kept the owner's facts only for its own list of
three format kinds, and `artifactOperationReason` had a second list. With
`unrecognized` added, `artifactFormatFailure` and `artifactParseFailure`
dropped its facts, so `translateArtifactFailure` raised an internal
invariant error instead of the target failure.

The format kinds are now one list, `FORMAT_TARGET_FAILURE_KINDS`, and
`isFormatTargetFailureKind` is the one guard. `FormatTargetFailure`,
`ParseFailureKind` and `BinaryFormatFailure` derive from that list, and
the reader-failure constructor and the operation-reason check both use the
guard, so a new kind cannot be carried by one wrapper and dropped by another.

* test(conformance): expect unrecognized for foreign bytes on native readers

The Go, Rust and native-initializers readers now report bytes that are not
ELF, PE or Mach-O as unrecognized, so their foreign-bytes conformance cases
expect that kind. The case names follow the kind.
2026-11-27 23:03:26 +00:00
morluto 1adba0f417 fix(native): do not count an object file's LINKEDIT tables as misplaced (#14933)
A relocatable object (MH_OBJECT) has no __LINKEDIT segment; clang places
its link-edit data after the sections, outside any segment. The placement
check counted every such table as outside __LINKEDIT, so a complete
data-in-code table in a valid object reported partial coverage. Only file
types that have the segment now count a table outside it. in_linkedit
stays false as an observation.
2026-11-27 21:39:30 +00:00
61fb6cf68a feat(native): list Mach-O function starts and data-in-code entries offline (#14897)
* feat(native): list Mach-O function starts and data-in-code entries offline

The diff adds a static reader for LC_FUNCTION_STARTS and LC_DATA_IN_CODE
on one thin Mach-O or one selected slice of a universal file. Starts are
absolute VM addresses from ULEB128 deltas off the __TEXT vmaddr, and
each data-in-code entry reports offset, length, kind, and the function
start that owns its address, with one offset and limit applied to each
selected table and counts covering every entry.
inspect_macho_function_starts and inspect-macho-function-starts expose
that report, require architecture only for a universal file, and refuse
a combined table above max_entries with no partial result. The shared
load-command walk now yields each command once and stores the Mach-O
segment name and vmaddr on load regions, and the guides and limit docs
record coverage, paging, and the read and entry budgets.

* build: add advertised schema summary for inspect_macho_function_starts

* Address review feedback

* fix(native): bound function-start decoding and page before building rows

- Check each start against an interval index of executable segments, built
  once, instead of scanning every segment per start.
- Walk LC_FUNCTION_STARTS once. Count and check every start and
  data-in-code entry, but build result objects only for the requested page,
  and resolve owners for that page during the same walk.
- Keep every declared Mach-O segment in the shared reader (macho_segments),
  so a __TEXT with no file bytes still anchors the deltas, as
  llvm-objdump does. LoadRegion no longer carries macho_segment.
- On 32-bit ARM, clear the Thumb tag (bit 0) from published starts and
  report it as `thumb`, keeping the tagged value for the next delta, as
  ld64 encodes and LLDB decodes. Wrap 32-bit images at 2^32.
- Intersect Evidence file ranges with the selected universal slice.

* refactor(native): normalize function-start format facts once

- One table, MACHO_DICE_KIND_NAMES, names data-in-code kinds for the
  reader, the schema and the report check, which each had their own copy.
- Each linkedit command's dataoff/datasize is normalized once against the
  slice (end, 32-bit fit, in-slice bytes) instead of the overflow check and
  the in-slice length being recomputed in three helpers.
- Name CPU_TYPE_ARM, VM_PROT_EXECUTE and UINT32_MAX after their headers.
- Report coverage.text_not_at_header when __TEXT does not map file offset
  0: llvm-objdump anchors the deltas on the __TEXT vmaddr and dyld on the
  mach_header address, and they disagree there.
- Pin the fixture's expected starts to literal addresses.

* build: refresh the inspect_macho_function_starts schema summary after merging main

* fix(cli): keep lipo's flag name out of --architecture help text

The architecture help for four commands said "as lipo -thin does", which
the CLI option-alias check reads as a registered short flag `-thin`.
Describe the lipo behavior without spelling its flag.

* Revert "fix(cli): keep lipo's flag name out of --architecture help text"

This reverts commit 68f25adf74.

* refactor(cli): use the shared universal-slice help for inspect-macho-function-starts

* fix(native): bound decoding by max_entries and map data-in-code from the header

- Refuse a data table above max_entries from its byte count, and stop the
  start walk at the remaining allowance, so the allowance bounds decoding
  work. The refusal no longer claims a required_value it did not measure.
- Map each data-in-code offset as the mach_header's VM address plus the
  offset, the way ld64 encodes it and dyld documents it. MH_OBJECT does not
  map its header, so its base is 0. The shared container now carries
  mach_header.filetype.
- Use the same header address for text_not_at_header, which also catches a
  header shifted by SG_HIGHVM.
- Report a list that ends without its zero terminator as
  unterminated_starts.
- Accept an observed empty section name in both result schemas.

* fix(native): tally LINKEDIT commands compactly and report a known entry total

- Count LC_FUNCTION_STARTS and LC_DATA_IN_CODE commands during the shared
  load-command walk into a compact tally (two 32-bit words per command)
  instead of retaining a view and an object for each one. The shared
  visitor now hands over the image's byte order.
- When the image has no starts to decode, a data table above max_entries is
  refused with its exact count as required_value.

* fix(native): report a non-Mach-O input as unrecognized, not malformed

Ask the shared Mach-O header recognizer before the thin reader. An ELF or
PE file passed without `architecture` has no Mach-O magic, so it is an
unrecognized target for this operation. A recognized Mach-O with a broken
or cut-off header still fails as malformed or truncated.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-27 20:29:07 +00:00
Lewis WangandClaude Opus 5.5 92b082bcaf fix(macho)!: select arm64e.x1 slices of universal Mach-O files by exact subtype (#14881)
* fix(macho): select arm64e.x1 slices of universal Mach-O files by exact subtype

macOS 27 system binaries such as /bin/ls and /usr/bin/codesign hold
x86_64, arm64e and arm64e.x1 slices. The caller's architecture selector
counted arm64e.x1 as arm64e and had no value of its own for it, so
inspect_native_initializers, inspect_go_binary, inspect_rust_binary and
inspect_dwarf_units refused arm64e as matching several slices and
rejected arm64e.x1 as an argument. Neither arm64e slice could be read.

Name each arm64e subtype exactly, as lipo -thin and otool -arch do:
arm64e reads only the arm64e slice and the new arm64e.x1 value only the
arm64e.x1 slice. arm64 keeps reading its family's only slice. A refusal
and the unread-slice limitation now offer arm64e.x1 where it selects one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(macho): record the advertised schemas that accept arm64e.x1

The architecture enum of inspect_native_initializers, inspect_go_binary,
inspect_rust_binary and inspect_dwarf_units gained arm64e.x1, which
changes their advertised input schemas. Commit the regenerated summaries
so verify-advertised-schemas matches the catalog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(macho): check the selected DWARF slice subtype and document arm64e.x1

inspect_dwarf_units accepted a report whose CPU family matched the
request, so an arm64e or arm64e.x1 request answered by the other arm64e
slice still produced Evidence. Validate the report's selected_slice with
machoSelectionAnswersArchitecture, as the initializer, Go and Rust
readers do.

The tool's architecture field, its CLI option and dwarf-units.md still
described a CPU family and listed only x86, x86_64, arm and arm64. Name
arm64e and arm64e.x1 and their exact-subtype rule there as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 10:56:06 -05:00
47daa05a84 feat(pe): report the overlay appended after a PE image's last section (#13245)
* feat(pe): report the overlay appended after a PE image's last section

* chore(schemas): add the inspect_pe_overlay schema summary

* test(pe): expect the shared non-PE refusal message in MZ admission

* test(cli): record completion goldens for inspect-pe-overlay

* fix(pe): preserve overlay diagnostics and validate certificate spans

Keep impossible security directory spans in measured overlay bytes and share bounded format recognition with inventory. Validate structured overlay facts in the domain while preserving provider diagnostics.

* docs(pe): move the PE overlay guide under docs/guides

* fix(pe): keep overlay format recognition within its probe

* Address review feedback

* fix(pe): keep header anomalies in the overlay report

parsePeOverlay dropped pe_header_anomalies from readPeImage, so a
SizeOfHeaders that ends before the section table reached the overlay
report without its warning. Carry header_anomalies through the output
contract and Evidence result, as the certificate, import and load
config reports already do.

* Address review feedback

* fix(pe): report adjustable max_file_bytes budget and preserve omitted caller parameters in inspect_pe_overlay

* fix(pe): preserve required_value on file-size limit and use executeArtifactInspection in PeOverlayService

* chore(schemas): update inspect_pe_overlay advertised schema summary

* fix(pe): include bflt in PE overlay leading formats

* test(pe): import BINARY_DIAGNOSTICS_TOOL_CONTRACTS in PE overlay tests

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
2026-11-26 22:07:19 +00:00
Leo Camusandgensokyo-dev a140853e9f fix(elf): read eight-byte DT_HASH entries on 64-bit s390x and Alpha (#14630)
* fix(elf): read eight-byte DT_HASH entries on 64-bit s390x and Alpha

On ELF64 s390x and Alpha every SysV hash entry (nbucket, nchain, buckets
and chains) is eight bytes wide; binutils readelf and glibc read them that
way and ld writes .hash with sh_entsize 8. The shared DT_HASH walker always
read 32-bit words, so on a big-endian s390x table it took the high half of
nbucket as the bucket count and the low half as nchain.

On Debian wheezy's s390x libz.so.1.2.7 (nbucket 97, nchain 105) this made
inspect-elf-dependencies report a false ".dynsym section declares 105
symbols, past the DT_HASH dynamic symbol count of 97" issue with partial
coverage, and inspect-native-exports refuse the same library without
section headers because DT_HASH (97) and DT_GNU_HASH (105) disagreed.

The walker now takes the entry layout from e_machine, the ELF class and
the byte order, and the dependency parser and both PT_DYNAMIC export paths
pass it.

* test(elf): cover eight-byte DT_HASH reads from a file handle

The s390x and Alpha .hash fixture now declares sh_entsize 8 to match the
entries it writes, and the sectionless export cases also run through
parseNativeExportsFromHandle, including a wide header that crosses the end
of its load mapping.

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
2026-11-27 05:28:24 +08:00
RRFZ 3624a9c1ab fix(elf): mark missing tables unreadable when dynamic counts are nonzero (#14291)
When an ELF PT_DYNAMIC table declares a nonzero count (DT_VERNEEDNUM,
DT_VERDEFNUM, or a hash-derived dynamic symbol count) without a matching
table address tag (DT_VERNEED, DT_VERDEF, or DT_SYMTAB) or section header,
ElfDependencyParser previously treated the missing table as absent and
reported coverage.status: "complete" with no table_unavailable issue.

Report a table_unavailable issue at PT_DYNAMIC (and mark
version_requirements or version_definitions "unreadable") whenever a
nonzero declared count cannot locate its table, while keeping zero counts
and section-backed tables complete. Add unit and compiled CLI regressions.
2026-11-26 13:34:27 -05:00
RRFZ d97b796076 fix(dwarf)!: bound PE COFF section-name decoding with max_structure_bytes (#14787)
BREAKING CHANGE: Oversized individual PE COFF long section names in inspect_dwarf_units now project an adjustable_budget refusal (boundary max_structure_bytes with details.limit) instead of fixed_ceiling (pe-section-name-bytes).
2026-11-26 13:13:09 -05:00
RRFZ 47875ba073 fix(native)!: bound Android packed relocations with max_structure_bytes (#14788)
BREAKING CHANGE: Oversized Android APS2 packed relocation tables in inspect_native_initializers now project a memory/adjustable_budget refusal (boundary max_structure_bytes with details.limit) instead of capacity/fixed_ceiling (native-index-capacity).
2026-11-26 12:48:22 -05:00
Beqa 4edb2c08ee fix(artifacts): explain ASAR PE signed-after-packing mismatches (#14702)
* fix(artifacts): explain ASAR PE signed-after-packing mismatches

When an unpacked PE companion fails ASAR integrity only because Authenticode
was applied after packing, record a verifiable signing_explanation on the
SHA-256 contradiction and error details instead of an opaque untrusted
mismatch. Bytes stay observed-untrusted; any other mutation remains an
unexplained contradiction.

Fixes #7212

* fix(artifacts): address signed-after-packing Greptile review

Catch ParseFailureError so unreadable PKCS#7 keeps the digest explanation,
share WIN_CERTIFICATE structural walks, index signer lookups, charge optional
reads to acquisition budgets with reported skips, preserve mismatch details
through cleanup failures, and inherit the shared MCP test deadline.

* fix(pe): walk WIN_CERTIFICATE entries lazily under max_entries

Convert the certificate-table walker into a generator so inspection stops at
the entry budget without materializing every range, and reconstruction can
validate structure with constant memory.
2026-11-26 10:31:54 -05:00
Lewis WangandClaude Opus 5.5 94c1c6aec0 fix(native): decode Objective-C categories that Swift lists in __objc_catlist2 (#14025)
* fix(native): decode Objective-C categories that Swift lists in __objc_catlist2

Swift lists categories on a class it reaches through a Swift class stub
in __objc_catlist2, and the Objective-C runtime loads that list like
__objc_catlist. inspect_native_dispatch_metadata read only __objc_catlist,
so these categories, their methods and protocols were missing while
objc_properties_categories coverage reported complete.

Read both lists. A stub's first word is a plain value from 1 to 15, as
the runtime's isStubClass checks, and it holds no class_t, so a category
whose class reference is a stub keeps a null class and coverage names
the reference instead of reading unrelated bytes as a class name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(native): version the dispatch reader profile for __objc_catlist2 categories

Reading __objc_catlist2 changes inspect_native_dispatch_metadata results,
but the reader still declared apple-metadata-reader-4, so a snapshot saved
before this change matched the current profile and replayed its empty,
complete category result. Declare reader version and revision 5 so those
snapshots are refused with a binding mismatch and the image is read again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 10:25:48 -05:00
RRFZ 5a283a5f87 fix(native): resolve Objective-C protocol _classProperties via pointer fixups (#14283)
Resolve a protocol_t `_classProperties` slot through `resolvePointer`
instead of `read.pointer(...) !== 0n`, sharing the undecoded class-property
slot check in `AppleObjcProperties.ts` with `AppleObjcCategories.ts`.
A bound slot now counts as present and undecoded, and an unreadable or
unknown-fixup zero slot keeps the protocol record and coverage partial
rather than treating the list as absent.
2026-11-26 10:24:35 -05:00