Merge the literal-pool and split-immediate guides into one firmware MMIO
guide covering both instruction tables, the shared access rows and groups,
attribution basis, budgets and the firmware-mmio view. Update the
documentation index, firmware overview and skill reference.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses
* fix(firmware): tighten SVD interval inheritance and split-immediate register tracking
* fix(firmware): bound inherited SVD block expansion and decode exact destination GPRs
* fix(firmware): clear Rs across acquire-ordered ARM64 CAS and CASP variants
* chore(mcp): sync advertised schema summary and budget projection with main
* fix(firmware): bound CMSIS-SVD numeric widths before BigInt and index expansion
* fix(firmware): keep rejected SVD addressBlocks distinct from omitted spans
* fix(firmware): bound MMIO representation growth and preserve SVD ambiguity
* perf(firmware): memoize SVD address lookups and pre-rank peripheral names
* fix(firmware): scan a whole application image by default for MMIO syntheses
On the 1.36 MB IROM segment of the MicroPython 1.24.1 ESP32-C3 image, a
default call scanned 256 KiB and kept 512 of 713 matching accesses. The
omitted rows were not in the retained Evidence, so the agent had to repeat
the call with larger controls or page by scan_offset. Defaults now scan
4 MiB and keep up to 32,768 syntheses within a 16 MiB representation
allowance, matching the literal-pool tool. Retained summary delivery still
sizes what reaches the agent. The image completes in about 1 s with 4,073
syntheses.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* refactor(firmware): use MMIO synthesis maximums as their defaults directly
The default scan, synthesis and representation constants only repeated
their maximums, which Knip reports as duplicate exports. The budgets and
the parser fallback now name the maximums.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(firmware): bound SVD match cache weight, exclude RISC-V flash, and report scan-limit stops
---------
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads
Disassemble PC-relative literal-pool load instructions (`arm-thumb` 16-bit
LDR and 32-bit Thumb-2 LDR.W, `arm-a32` LDR, and `xtensa` L32R) from local
firmware images at an explicit `base_address` without target execution:
- Byte-granular `PoolByteBitset` suppresses forward and backward pool byte
ranges even at `4k + 2` unaligned file offsets (`base_address` ending in 2).
- Two-pass Xtensa pool discovery preserves `L32R` alignment after leading or
interleaved 4-byte literal pools and preserves valid `21 36 01` encodings.
- Indexed `O(log M)` CMSIS-SVD disjoint `<addressBlock>`/`<register>` matching
with cycle-safe multi-hop `derivedFrom` resolution, `mapped_image` bounds
precedence, exact ARMv7-M/v8-M SCS sub-blocks, and `arm-a32` SoC neutrality.
- Cooperative `setImmediate` event-loop yields with `AbortSignal` cancellation,
complete retained Evidence with `detail: "summary"` and `inspect_analysis_view`
(`firmware-literal-pools`), `max_svd_nodes` parameter budget, and
field-specific `invalid_request` validation.
* fix(firmware): bound SVD and candidate memory, preserve overshadowed loads, and report required_value
* fix(firmware): resolve SVD derivedFrom chains iteratively and restore lifecycle test title
* fix(firmware): bound Xtensa trace and SVD representation memory, make Evidence cooperative, and preserve unaligned literal loads
* fix(firmware): retain completed literal-pool scans on late cancellation and avoid repeated SVD string hashing
* fix(firmware): walk SVD register clusters, sweep dense overlaps linearly, and preserve XML depth recovery
* fix(firmware): enforce profile-wide cooperative SVD cluster expansion budget and sync schema
* fix(firmware): pre-parse SVD cluster templates, inherit defaults, and keep Xtensa framing
* fix(firmware): share inherited SVD template chains and count compact arrays as single intervals
* fix(firmware): replace SVD override chain links with persistent O(log K) treap
* fix(firmware): default max_references to the representation-bounded maximum
The IROM segment of the MicroPython 1.24.1 ESP32 image resolves 35,179
literal-pool loads. A default call scanned it and then refused at 16,384
references, so the agent had to repeat the whole scan with a larger
max_references. The count is checked after scanning, and
max_representation_bytes already bounds the Evidence these rows build. The
default is now the maximum; the same image completes in 1.4 s with a 12 MB
complete result.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* refactor(firmware): use the max_references maximum as its default directly
Knip reported DEFAULT_LITERAL_POOL_MAX_REFERENCES as a duplicate export of
MAX_LITERAL_POOL_REFERENCES. The budget now names the maximum as its
default, and the provider test reads the default from the budget.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(firmware): preserve inherited SVD register widths and addressBlock spans
---------
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(firmware): classify privileged system-register, CSR, and port-I/O instructions
Add `inspect_procedure_hardware_instructions` (`rea inspect-procedure-hardware-instructions`)
to extract and classify architectural non-MMIO hardware instructions from
`read_function_instructions` across `arm`, `arm64`, `riscv`, `xtensa`, `mips`,
`x86`, and `x86_64`.
- Parse provider `<nativeAddress>: <assembly>` lines through the shared native
address grammar (`OBSERVED_NATIVE_ADDRESS_PATTERN` / `nativeAddressInputSchema`)
without stripping 2-hex-letter mnemonics (`dc`) or discarding address spaces
(`rom:0x1000`, `overlay%3Aspace:0x1000`).
- Normalize conditional A32/T32 system, coprocessor, barrier, wait, and trap
mnemonics (`mrcne`, `mcrgt`, `mrsne`, `msreq`, `cpsie.w`, `wfene`, `wfine`,
`sevne`, `svcne`) while preserving original disassembled mnemonics, and cover
AArch64 `dc`/`ic`/`at`/`tlbi` maintenance operations.
- Parse complete 8-bit immediate x86 port tokens (`0x00..0xff` across `0x`,
Intel `h`, `$`/`#`, and decimal syntax), keep register-selected `DX` ports as
`unresolved_register`, and separate symbolic or unparsed port tokens as
`unresolved_operand`.
- Classify zero-source RISC-V CSR set/clear pseudo-instructions (`csrsi csr, 0`,
`csrci csr, 0`, `csrs csr, zero`, `csrc csr, x0`) as `read` consistently with
their canonical `csrrs`/`csrrc`/`csrrsi`/`csrrci` encodings.
Refs #7955
* chore(firmware): refresh the hardware-instruction advertised schema summary
The shared Evidence output schema on main now advertises its string
patterns, so the summary recorded on the older base was stale.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
---------
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs
* fix(firmware): preserve MCP caller inputs, x32 decoder width, and bounded ELF tallies
* fix(firmware): leave M-profile variant and PPC width unresolved and report observed file size
* chore(firmware): remove unused exported types flagged by knip
* fix(firmware): recognize x86_64 leave;ret functions, keep uImage ppc width unknown, and preserve MIPS ELF flags
* fix(firmware): preserve MIPS/ARM decoder uncertainty and partial scan stages
* fix(firmware): preserve MIPS16 and microMIPS ELF ASE mode declarations
* fix(firmware): admit Cortex-M vector tables with filled reserved slots
The Raspberry Pi Pico SDK fills reserved vector slots with its default
handler. The detector required them to be zero, so it missed the vector
table and load base of the MicroPython 1.24.1 RP2040 image and offered only
an instruction-census guess. Reserved slots may now hold a Thumb handler in
the Reset region; any other value still rejects the table.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* feat(firmware): identify ESP-IDF images from their header chip_id
The detectors found no candidate for the MicroPython 1.24.1 ESP32 image.
They have no Xtensa signature, and the chip is named in the image header.
A new esp-image-header detector recognizes the ESP-IDF header at offset 0
or a ROM bootloader offset, and takes the ISA from the existing ESP-IDF chip
table. The chip_id field now has one reader shared with the ESP image
parser. ESP32 images report Xtensa and ESP32-C3 images RISC-V.
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
---------
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
A plugin install has no `rea setup` registration to carry a WABT
tool directory, so the only way to enable inspect_wasm_artifact was a
client-wide environment variable, even though #3016 persisted the other
host-stable tool paths.
Add REA_WABT_BIN_DIRECTORY to PERSISTED_SETTINGS and the environment
schema as an absolute path, so `rea config --set`,
`rea config --get --json` and startup precedence (env > config > auto)
behave like REA_ILSPY_CMD_PATH and HOPPER_LAUNCHER_PATH. The value is
merged into the effective environment before the WASM provider reads it,
so no provider change is needed. Setup still leaves saved values in the
file rather than copying them into a client registration.
* fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget
Neither tool had a detail input or a summary view, so their complete
Evidence was always delivered inline: about 200-480 KB of CLI JSON for
stock kernel32.dll, shell32.dll and explorer.exe, and over 1 MB over MCP.
Both now follow the inspect_deb_package pattern. With detail omitted,
complete Evidence is returned when it fits the agent result budget, and
otherwise the retained summary with delivery facts; detail complete always
returns everything, and inspect_analysis_view evidence-json pages the
retained record. The CLI gains --detail and --evidence_output.
The imports summary carries image identity, imphash, coverage with DLL
and function counts, issue/limitation counts and one name/function_count/
delay_load row per DLL, bounded to 16 KiB of rows with an omitted count.
The resources summary carries image identity, the resource directory,
coverage, directory/resource/icon-group counts and resource counts by type
and by language, each bounded to 8 KiB of rows with an omitted count.
The byte-bounded leading-prefix rule extract_artifact's summary used is
now byteBoundedList, shared by the three summaries.
BREAKING CHANGE: inspect_pe_imports and inspect_pe_resources output is now
complete Evidence or, when detail is omitted and the Evidence exceeds the
agent result budget, the inspect_analysis_view summary with delivery facts.
Callers that need the complete record inline pass detail "complete"
(CLI --detail complete); otherwise follow delivery.next.
Fixes#15619
* test(pe): cover byte-bounded lists and named resource identities in summaries
* fix(cli): withhold an over-budget summary answer and print its paging facts
The CLI printed {summary, evidence_bundle, delivery} for over-budget Evidence without measuring it, so a summary larger than a smaller configured agent result budget was printed whole. Like MCP since #15591, the CLI now measures that answer and, when it is over the budget, prints the bundle receipt and the delivery facts marked withheld, whose next call pages the saved Evidence.
* feat(evtx): page event records with offset and report page facts
inspect_evtx_archive stopped walking at max_records, so records past the first 20,000 (the newest events of a default-size Application log) could not be listed. The walk now covers every record. max_records stays a 20,000-record page bound, which limits retained Evidence. A new zero-based offset selects the first record listed. The result reports page { offset, limit, returned, total, next_offset }, and the record-limit-reached diagnostic names offset=next_offset. Coverage now describes parse loss only, so a page that leaves records out by selection is no longer partial, and chunk ending facts and endpoint checks cover records past the page.
Fixes#15612
* feat(evtx)!: qualify the file-tail offset for small and wrapped logs
The suggested tail offset is now the larger of 0 and page.total minus max_records, so a log smaller than one page gets a valid offset. File order is oldest first only in a log that has not wrapped; the guide and descriptions now say how chunks[] locates the newest records in a wrapped log.
BREAKING CHANGE: inspect_evtx_archive results now require page. Evidence saved before this change has no page, and inspect_analysis_view refuses to summarise it. Re-run inspect_evtx_archive on the log to produce current Evidence.
* fix(artifacts)!: report reader admission limits as resource_constraint
An artifact read refused by a reader limit (artifact_limits.*) or a
release-fixed allowance was code partial, which the error contract
reserves for a result cut short by a delivery or decode limit. The
read was refused at admission, so it is now resource_constraint, like
every other admission limit. The retry class is unchanged: change_first
when the limit can be raised, never when it cannot. A limit without
admission facts, such as a parser budget, stays partial.
The reader's own recovery, which names the parameter, its supported
range and the next step, and the reader_limit fact are unchanged.
Refs #15323
BREAKING CHANGE: artifact refusals with details.reason "limit" and a
details.reader_limit or fixed allowance report code and category
resource_constraint instead of partial. Match resource_constraint, or
read details.reason and details.reader_limit, which are unchanged.
* fix(errors): catalogue each artifact admission limit with the retry it returns
The catalogue listed one row for reader limits and fixed allowances with
change_first, though a fixed allowance and a reader limit already at its
maximum return never, and the release-fixed row still said partial.
List the raisable reader limit, the reader limit at its maximum and the
release-fixed allowance as separate rows, and test each row against the
error it projects.
The package, process, directory, feature and service listings reported a
caller-selected page only as a limitation sentence, and marked the result
coverage partial whenever the page omitted rows. A requested page is the
caller's selection, not lost coverage, and the next offset had to be
read out of prose.
pageListingItems now returns a page record, which each listing reports as
page: { offset, limit, returned, total, next_offset }, the shape
inspect_elf_unwind_ranges already serves. coverage reports parse loss
only, and the paging limitation sentence is removed.
Refs #15324
BREAKING CHANGE: list_adb_packages, list_adb_processes,
list_adb_directory, list_adb_features and list_adb_services no longer set
coverage partial or add a paging limitation when a page omits rows. Read
page.next_offset (null when none remain) and page.total instead.
lib.exe records the absolute object path it was given, such as
C:\build\Release\decode.obj, as the member name. The ar reader passed
that name to the shared path validator, which rejects absolute names,
so every such member was dropped and a static library built this way
looked empty with unknown coverage.
An absolute member name names a build-host location, not archive
structure. The reader now lists it under its last component, as
`llvm-ar x` writes it, keeps the recorded name in source_path, and adds
one reader-level limitation counting such members. Coverage stays
complete. A last component that is itself unsafe (empty, `.`, `..`)
is still refused and counted as before.
The absolute-name rule now has one owner in ArtifactPaths:
absoluteArtifactPathBasename classifies drive-absolute and POSIX-rooted
names, and normalizeArtifactPath uses it for its refusal.
Fixes#15618
Logs exported with wevtutil epl keep all-zero 64 KiB slots after the chunks the file header declares. The inventory diagnosed each as invalid-chunk, added chunk-count-mismatch and reported partial coverage although every record was read. Following libevtx and omerbenamram/evtx, an all-zero slot past the declared count is now unused space. A nonzero slot there, and a zero slot inside the declared count, are still diagnosed.
Fixes#15611
Microsoft lib.exe archives, including import libraries, use the ar
signature and keep long member names in the "//" table, but as
NUL-terminated strings rather than GNU's "/\n"-terminated entries.
The name table rejected every such reference, so members with names
longer than 15 characters were dropped from the inventory and
counted as undecodable, with unknown coverage.
The name table now decides its convention once from its final byte:
a table ending in NUL resolves entries that start at offset 0 or
after a NUL and end at the next NUL. GNU tables keep their existing
"/\n" rule, and the ar reader and Debian parser share the change.
Fixes#15452
Co-authored-by: Anurag Singh <211784907+Anurag-5ingh@users.noreply.github.com>
* fix(adb): refuse device directories before pulling
adb pull copies a directory tree with no byte limit. pull_adb_file accepted
a directory device_path (for example /sdcard), and pull_adb_package accepted
a pm path line naming a directory; adb then pulled the whole tree under the
600 s timeout, the tool reported that the result could not be read back, and
the tree stayed on disk unrecorded.
Both pulls now run the existing test -d probe that push already uses.
pull_adb_file refuses a directory as invalid_request on device_path and
names list_adb_directory; pull_adb_package refuses a pm path directory with
reason directory_device_path before creating output. A probe that cannot
establish the answer fails the call rather than pulling.
Refs #15326
* fix(adb): keep the pm path answer when a directory probe fails
A failed directory probe now retains the completed pm path paths and the
entry being checked as a partial observation, and the pull_adb_file
directory refusal escapes the device path for display.
extract_uefi_firmware with an exhausted output budget reported one generic
size-truncated gap per withheld payload (2995 with max_output_files 5),
empty limitations for a whole-image target, and nothing naming the limit.
Each budget gap now starts with the parameter and value that stopped it
(max_output_files or max_output_bytes), and the first limitation states how
many payloads and bytes the budget withheld, which parameter stopped them,
its maximum and how to continue. Depth-limited gaps name max_depth. A target
offset that maps nothing names inspect_uefi_firmware as the way to find valid
offsets.
Refs #15343
* fix(frida): give detached and unknown sessions lifecycle recovery
A session whose target detached was refused with the unknown-session error,
"No open Frida session; start one with start_frida_session", although the
session is still held, frida_session_status still returns its remaining
messages and close_frida_session must still release it. Following the advice
abandoned the session and its messages.
load_frida_script and resume_frida_session now refuse a detached session with
a capability refusal naming frida_session_status, then close_frida_session.
Unknown session and script IDs conform to the input contract, so their
recovery names the lifecycle tools instead of schema guidance, matching the
gdb and rizin session errors.
Refs #15329
* fix(frida): track session phase and report why a session detached
ManagedSession kept attachment as a `detached` boolean beside
`cleanupStarted` and `resumeAfterDetachPending`, and the `detached`
signal handler ignored Frida's (reason, crash) arguments, so an agent
could see that a session detached but not whether the target exited,
crashed, or the connection dropped.
The session now has one phase: attached, detached with its detachment,
or closing with the detachment seen so far and whether a paused spawn
still owes a resume. The signal arguments are parsed at the native
boundary; a detach seen only through isDetached() is recorded as
`unobserved`. frida_session_status, start_frida_session and
instrument_with_frida report an optional `detachment` with Frida's
reason and crash summary, and the detached-session refusal names the
reason. close_frida_session cleanup is unchanged.
Refs #15329
* fix(frida): report whether a retained crash summary was truncated
A crash summary is bounded to 4096 bytes; detachment output now carries
crash_summary_truncated so a clipped summary is not presented as
complete. The detached-session test also proves messages captured before
the detach stay readable. Commits the advertised schema summary for
start_frida_session.
* docs(frida): state why the crash summary bound is fixed
* fix(frida): keep Frida's one-line crash summary complete instead of capping it
The 4096-byte cap had no format, protocol or resource reason, and cutting
the summary left no way to read the rest. The summary is now kept whole
apart from credential redaction, so the truncation flag and constant are
removed.
* fix(browser): redact literal credentials in browser scenarios unless retained
capture_browser_scenario records the scenario in Evidence parameters as
written. A literal Authorization header value or cookie seed therefore stayed
verbatim in Evidence, while the same record's network events redacted it.
Literal values of transport-credential headers (isTransportCredentialHeader)
and cookie seeds are now redacted like declared secrets. One domain owner,
scenarioLiteralCredentials, lists them with their redaction identities; the
capture session adds them to its redaction set, and Evidence parameters and
scenario_sha256 record the redacted scenario. A caller that wants the literal
kept sets retain_literal_credentials: true. Other literals stay ordinary
evidence; secrecy is not inferred from names.
Refs #15340
* test(browser): assert whole-value redaction instead of any change
not.toBe(value) also passed for partial redaction, such as a marker appended
with the secret left in place. Assert that each redacted value is exactly one
marker and that no fragment of the secret or its JSON-escaped form remains in
text, bytes, URLs or protected response bodies.
Refs #15340
* fix(browser): redact the trimmed spelling of padded literal credentials and commit the schema summary
* fix(browser): treat a credential header's prefix as part of its literal credential and retain fingerprint fixtures
* fix(browser): keep the bare literal token redacted beside the prefixed header
* fix(evidence): resolve web script and WASM comparison sources through the shared Evidence input owner
export_web_scripts accepts its capture as declared Evidence input: a
complete record, a retained reference, or a retained inspect_analysis_view
summary, which reads its retained parent. compare_wasm_interfaces admits
both sides through resolveEvidenceRequest, so a malformed side is a
bounded evidence_integrity_mismatch and a summary reads its parent. The
summary-to-parent rule lives in the shared resolver as completeProducers.
A catalog test checks that every declared Evidence input resolves a
retained reference through the shared resolver.
Refs #15341
* fix(evidence): retain an inline web script capture before publishing and commit the schema summary
Inventory FWS and CWS files through the shared artifact reader. Preserve the
carrier and normalized identities, top-level tag counts, and individual
DefineBinaryData occurrences. Use the existing selected-extraction pipeline and
per-call artifact admission controls.
Refs #3614
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
* fix(javascript): scope the missing-listener rule to proven Node emitters
A listener method called without a listener argument passes `undefined` to
Node's `checkListener`, which throws before anything is registered or
removed, so no event operation exists. That rule currently applies to every
receiver, including objects that only look like an emitter.
Restrict it to a receiver whose stable initializer is `new EventEmitter()`
resolved through a proven `events` load, or a call Node's own
`child_process` factories answer with a `ChildProcess`. The proof is
withdrawn when `Function.prototype.call` was replaced, when the class
reference or its prototype object escaped to a call, when any member of the
shared `events` module was written, or when the selected method, the
receiver's own prototype or an earlier escape of the instance may have
replaced it. An effect that runs after the call cannot change whether it
threw.
Any other receiver keeps its operation as an unresolved candidate, as it did
before the missing argument was considered. Those include EventEmitter-style
APIs that define a one-argument form, such as Socket.IO's `socket.off("x")`,
which removes every listener for the event.
* fix(javascript): verify native emitter constructor and prototype ownership
* fix(javascript): retain escaped prototype constructor aliases
* fix(javascript): track acquired builtin module mutations
* fix(javascript): charge module acquisition to phase allowance
* fix(javascript): recognize computed builtin getter keys
---------
Co-authored-by: gongfpp <22683417+gongfpp@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* fix(javascript): keep parameter members a function overwrites unresolved
Wrapper tracing binds a traced function's parameters to the call-site
arguments. JavaScriptSymbolicBindings#identifier returned that bound value
before consulting the binding's recorded member writes, so a member the
function writes, deletes or redefines was still read from the argument. A
wrapper that rewrites def.channel before ipcMain.handle(def.channel, ...)
produced an exact wrapper-substituted channel from the stale argument
member, and a preload wrapper that replaces api.ping before exposing api
produced a call path through the replaced function.
Apply the binding's existing write facts to the bound value per member. A
written member reads as "overwritten object members" wherever the value
flows (aliases, destructuring, spreads, returns, forwarded arguments), and
members() lists it, so spreads and exposed-API inventories do not fall back
to an earlier value. Unwritten members, and loader calls through a
parameter whose properties a module sets, keep their values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(javascript): share parameter member-write views across reads
#withMemberWrites rescanned a binding's writes and copied the bound value
on every read, so W writes and R reads of one parameter did W x R work
outside the symbolic evaluation budget and left R copies in the
evaluation cache.
Collect each binding's written top-level members once, and keep one view
per bound value and binding that every read returns. Building a view is
charged against the evaluation budget before its copies and merged
member sets are allocated, as added conditions already are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): apply rest parameter writes to spread elements
A rest parameter's view recorded its written members, but a call spread
expanded the array's elements unchanged, so a wrapper that rewrites
args[0] before ipcMain.handle(...args) still supplied the caller's
channel. An index read after a written length also returned an element
the write may have removed.
Rewrite the array's elements when building the parameter's view: a
written index becomes unknown, and a written length or an index past the
end leaves one unknown element for the rest, as for any dynamic spread.
Unwritten elements before that point keep their values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(javascript): state how rest parameter writes resolve
The wrapper-substitution passage said that an argument's unwritten members
keep their values. For a rest parameter, a written length leaves every
element unresolved, and an index written past the end leaves the elements
after the known ones unresolved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): leave arguments after an unknown-length spread unplaced
arguments() expanded a spread of unknown length as exactly one unknown
element, so the arguments after it kept fixed positions. With
function f(...a){a.length=2; return g(...a, "fallback")}, g's second
parameter read "fallback", although at runtime it is the original second
argument; a helper that picks an argument this way supplied a false
wrapper-substituted IPC channel. The same held for any spread whose value
is not a known array.
Mark the element that stands for an unknown number of further elements
(unknownCount), and stop the argument list after it, so later parameters
read as unknown. A rest parameter bound past that point is the same
open-ended unknown, and a rest array's written length or index past its
known elements produces the marker instead of a fixed-length element.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): pass one element of an unknown-length list as one argument
A fixed parameter bound from a spread of unknown length, and an index
read of a rest array whose length the function writes, kept the
unknown-count marker that stands for the rest of a list. Passed on as an
ordinary argument, that one value made the callee's argument list look
open, so a later rest parameter took the marker and a spread of it
dropped the arguments after it. With function first(x){return x} and
function h(x,...rest){return k(...rest,"app:ping")}, h(first(...xs))
lost "app:ping", although rest is always empty there.
A value selected from one position of an argument list or array is now a
plain unknown, so it supplies exactly one argument wherever it goes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(javascript): resolve a channel after a rest list left empty by one value
The symbolic tests for one value selected from a list of unknown length
check the resolver, but the loss shows at the wrapper boundary. A rest
parameter that one selected value leaves empty looked open, so a channel
placed after it in a helper call went unresolved and the wrapper's
app:ping registration disappeared.
Add two wrapper rows to electronWrappedCallPaths.test.ts. In the first,
register(first(...extraArguments)) supplies one argument, so the rest
parameter of register is empty and choose(...extra, "app:ping") picks
app:ping. In the second, forward(args[0]) after args.length = 0 supplies
one argument, so choose(...rest, "app:ping") picks app:ping. Node with a
stub electron module registers app:ping in both cases for every
extraArguments list tried ([], ["x"], ["x", "y"]).
Validation: with the source of the previous commit reverted, these two
rows and the two symbolic rows fail (4 of 322 tests in
javascriptSymbolicBindings.test.ts and electronWrappedCallPaths.test.ts,
the app:ping row is missing) and every other test passes. With the source
as committed, all 322 pass.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* docs(javascript): state that one value read from a list is one argument
The guide says arguments after a spread of unknown length stay
unresolved because their positions are unknown. A reader can take that to
cover a value read from such a list, but a value read from one position of
a spread or of a rest array supplies exactly one argument, so a rest
parameter after it is empty and a channel placed after that rest list
still resolves.
State the rule beside the spread rule it qualifies. The behavior comes
from the selected-element rule of "pass one element of an unknown-length
list as one argument". The symbolic rows of that commit and the wrapper
rows of the test commit after it assert it.
Validation: npx oxfmt --check on the guide passes. node
scripts/check-doc-facts.mjs needs a built dist/ and did not run.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(javascript): do not grow a rest array for an out-of-range delete
`function f(...args) { delete args[2]; return pick(...args, "fallback") }`
with two known rest arguments always passes `fallback` third: `delete`
neither creates the element nor changes the length. The written member
set lost the operation, so the index past the end appended an
unknown-count element and the fixed-position argument was dropped.
Only members that a write other than `delete` reaches can now grow the
array. A delete inside the known elements still makes that element
unknown, and a delete plus an assignment of the same index still grows.
Validation: the two delete rows fail on the previous head and pass now;
the delete-then-assign control stays unknown. vitest on
electronWrappedCallPaths.test.ts and javascriptSymbolicBindings.test.ts:
365 passed (365). tsc --noEmit is clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): separate member enumeration from value invalidation
* fix(javascript): preserve rest-array enumeration and snapshot order
* fix(javascript): preserve conditional writes and pre-mutation array membership
* fix(javascript): invalidate added array indices after length writes
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* feat(artifacts): extract stored Unix ar members
* test(artifacts): assert structured thin ar extraction refusal
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* fix(javascript): resolve Electron paths held in definite constants
A preload, utilityProcess.fork module path, serviceName or loadFile path
written inline as path.join(__dirname, "preload.js") resolves, but the same
expression stored in a const first stays dynamic, because staticPathFact
returned undefined for every identifier. The ESM idiom
const __dirname = path.dirname(fileURLToPath(import.meta.url)) left
path.join(__dirname, ...) unresolved for the same reason.
The path intrinsic query now also returns the initializer of a single,
unreassigned, unprojected const whose initializer the shared lexical index
proves has run at the read (the proof constant BrowserWindow options use).
staticPathFact and the filesystem-context check recurse into that
initializer, so a source-directory base survives, and the source-directory
and source-file identity proofs follow const aliases. Each constant is
substituted at most once per evaluated expression, which keeps work and
spelling bounded by the source text.
let and var bindings, reassigned, destructured or shadowed constants, reads
that may run before initialization and URL objects stay unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): bound constant alias chains in static path facts
Root cause: staticPathFact and isFilesystemPathExpression recurse once
per substituted constant, and the once-per-initializer set only stops a
revisit. A linear chain of shallow declarations (const c1 = c0; const
c2 = c1; ...) admits every link, so a long enough chain exhausts the
call stack (12,000 `c + "a"` links throw RangeError in the domain test
worker). For plain aliases the same chain was quadratic instead:
isFilesystemPathExpression asked the source-directory proof at every
step, and that proof walks the whole remaining chain (4,096 aliases took
about 55 s). That proof reads initializers outside the per-expression
set, so a source-directory alias read twice, path.join(DIR, DIR, "x"),
still resolved. isFilesystemPathExpression also matched the name
__filename before following a constant of that name, so an ES module
const __filename = "service" got filesystem context, unlike the inline
string.
Structural fix, one bound owned where constants are substituted:
- The path query admits constant substitutions
(admitConstantSubstitution): at most SEMANTIC_EXPRESSION_DEPTH_LIMIT
per expression, the budget the expression shape resolver already uses
for alias chains. substitutingConstantsOnce asks it, so a refused read
is unknown, never a partial or truncated literal. A refusal records
the expression-depth resource limit, so the examination is limited and
the unresolved path still counts as an unknown finding.
- The source-directory proof's alias walk (constantTarget) asks the same
question, and once the proof holds its top-level aliases are spent
from the per-expression set like any other constant read.
- isFilesystemPathExpression follows a constant to its initializer
before the name-based identity checks.
The guide documents the bound. Not changed: constants inside
new URL(CONST, import.meta.url) stay unknown, and the inline
path.join(__dirname, __dirname, "x") still resolves as before.
Validation:
- npm run test:local with the PR test file and nine neighbours:
Test Files 10 passed (10), Tests 763 passed (763).
- With the two source files at 7d7180515 and the new tests, the rows for
12,000 concatenations (RangeError: Maximum call stack size exceeded),
4,096 aliases (resolved after about 55 s), 256 aliases to a source file,
a chain of 256 aliases, both directory-alias rows and the __filename
row fail; the 255-alias controls pass.
- npm run check:fast passed; oxfmt --check passed on the four files.
- Not run: the acceptance and boundary tests that need test:focused.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(javascript): read the constant alias bound from the semantic precision
Main (#9706) removed SEMANTIC_EXPRESSION_DEPTH_LIMIT: the expression-depth
bound is now state.precision.expression_depth (default 256), so a caller
can raise or lower it per analysis. The constant-alias bound added by this
PR read the removed constant, so the tree merged with main did not compile.
Read the bound from index.bindings.precision, like the other semantic
evaluators. The test takes the default from
JAVASCRIPT_SEMANTIC_PRECISION_DEFAULTS and imports
analyzeParsedJavaScriptStaticSource from tests/fixtures, where main moved
it (#10275). Behavior at the default bound is unchanged.
Validation: npm run check:fast passed on the merged tree.
npm run test:local on javascriptStaticPathConstants.test.ts: Tests 34 passed
(34). The same command on 42 static-analysis test files (this one, the
javascriptStaticAnalysis* files and the electronStaticAnalysis app-path and
identity files): Tests 1004 passed (1004).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(javascript): keep file URLs with an unknown base unresolved
staticFileUrlPathFact read only the spelling of its argument's path fact,
so the unknown base that main's #11991 rejects through staticPath was
dropped. `fileURLToPath(path.join("file:", __dirname, "preload.js"))`
spells `file:/preload.js` after the leading source directory, and the
Electron findings reported `/preload.js` instead of an unknown path.
The reader keeps this branch's shared substitution set and now rejects a
fact whose base is unknown before it converts the URL.
Validation: the two new controls (inline and through a constant) fail on
the previous head with `/preload.js` and pass now. vitest on
javascriptStaticPathConstants.test.ts and
javascriptStaticPathResolution.test.ts: 153 passed (153).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): resolve a constant inside a source-relative URL
`const REL = "./preload.mjs"; fileURLToPath(new URL(REL, import.meta.url))`
stayed unknown while the inline literal resolved, because
staticSourceRelativeUrlPath read its first argument with stringValue only.
The decoder now takes the path query and follows a `const` chain to a
string literal, spending the same substitution bound as other constant
reads. A `let` binding, a joined path and a source-directory path inside
the URL stay unknown, and a stored URL object is still not followed.
Validation: the constant, alias and constant-path rows fail on the
previous head and match the inline result now; the three controls stay
unknown. vitest on javascriptStaticPathConstants.test.ts: 43 passed (43).
tsc --noEmit is clean. The CLI acceptance test needs the built runtime
and runs in CI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(javascript): share source path substitution budget
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* fix(javascript): recover webpack chunks with array module tables
Webpack writes a chunk's module table as a sparse array when numeric
module ids are dense (webpack 5 moduleIds natural/size, webpack 4
production builds), and webpack 4 registers chunks on webpackJsonp.
Chunk registration accepted only object tables and *Chunk* globals, so
these chunks recovered no modules while coverage stayed complete.
Read object, sparse-array and Array(n).concat([...]) tables through one
moduleTableEntries helper (index plus offset is the module id) and
recognize webpackJsonp as a chunk runtime.
* fix(javascript): mark webpackJsonp chunks as webpack vendor
A minified webpack 4 chunk whose factories never spell
__webpack_require__ now yields a webpackJsonp registration with
bundler "webpack", but detectVendors matched only __webpack_require__
and webpackChunk, so the same file reported no webpack vendor and the
artifact graph's vendor_markers stayed empty.
Add webpackJsonp to the webpack vendor markers, next to webpackChunk,
so the marker and the chunk-runtime classification agree. This also
covers the not-examined path, which reports vendors without
registrations.
* fix(javascript): validate intrinsic array module table offsets
* fix(javascript): guard inherited array slots in table recovery
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* feat(artifacts): inventory standalone Unix ar archives offline
* test(artifacts): align standalone ar assertions and comparison docs
* fix(artifacts): preserve ar names, admission and permission uncertainty
* chore(contracts): refresh ar admission schema summaries
* fix(artifacts): handle GNU thin references and exact name budgets
* perf(artifacts): cache ar name-table observations
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* fix(process): quote Windows batch operators cmd.exe keeps literal
cmd.exe with delayed expansion off keeps & | < > ( ) ^ ! literal inside quotes. Empty tokens and %name% spans are still refused, including when that name is unset, because the child environment can define it.
* fix(process): report a refused batch path as invalid configuration
A percent expansion or an unusable COMSPEC is configuration_invalid. Packet capture does not append the Wireshark install remediation, and an apktool decode does not report a capability gap.
* fix(process): refuse percent spans joined across batch tokens
cmd.exe expands a percent span on the joined command line. Tokens that
are legal alone are refused when joining them forms a span. The spawn
regression kills its child if that child is still running after 10 seconds.
* test(process): include the Windows batch regression in CI
The curated Windows lane now runs WindowsBatchCommand.test.ts.
* fix(domain): preserve a configuration error's caller message
ConfigurationError accepted userMessage and dropped it, so the public
projection replaced the caller text with the generic doctor sentence.
The constructor now stores that message.
* fix(pcap): keep a batch refusal in the public configuration message
A Windows batch refusal stays in the configuration error the caller
sees, including the refused path and the percent-expansion reason.
* fix(apktool): report a decode batch refusal as invalid configuration
Inspection still reports not_configured. Decoding reports
configuration_invalid and names the launcher that cmd.exe cannot receive.
A percent span that appears only after the quoted tokens are joined is
refused the same way.
* test(process): own the Windows batch regression in the package lane
The curated Windows job already runs WindowsBatchCommand.test.ts. The package scope did not name that file, so the lane ownership check reported it as unowned.
* fix(javascript): scope candidate this event receivers
Preserve lexical receiver scopes and possible local inheritance links without asserting runtime this identity. Keep decorator evaluation outside method receiver and callable boundaries.
Fixes#3360
AI-assisted implementation and verification with OpenAI Codex; human PR ownership and readiness remain unfilled.
* fix(javascript): retain receivers through type wrappers
Reuse the canonical expression normalizer to preserve object function receiver identity through transparent wrappers. Keep arrows, computed keys and non-transparent expressions separate. AI-assisted implementation and verification with OpenAI Codex.
* fix(javascript): retain enclosing receivers for computed keys
Apply the existing computed-method-key evaluation boundary before non-arrow receiver selection. Cover object method keys and bodies through semantic IR and CLI/MCP regressions.
---------
Co-authored-by: Codex <codex@openai.com>
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.
* fix(process): report denied inspection as typed cleanup failures
Preserve the native ps diagnostic through owned-worker cleanup and finalize one-shot JavaScript analysis before Evidence delivery. Retain mandatory inspection and existing cleanup authority.
Preserve the inspector diagnostic when the initial process-table read succeeds but pre-signal revalidation fails, and remove the unreachable typed-error branch so retained artifact retry failures project through the existing cleanup contract.
* fix(resources): preserve independent close failure ownership
* fix(cli): retain cleanup recovery and nested close evidence
* refactor(providers): classify rejected closes at the shared boundary
* test(cli): preserve bundle metadata and physical inspection failures
* fix(cli): preserve the JavaScript failure envelope after finalization
* test(cli): validate the JavaScript error envelope at its boundary
* fix(providers): preserve unnamed close failure resources
* fix(cli): retain invocation owners through outer cleanup
* test(cli): distinguish reported cleanup failures from uncaught errors
* fix(cli): compose each runtime’s declared cleanup owners
* test(cli): preserve the original cleanup rejection
* test(cli): allow cleanup retry recovery after a reported failure
* fix(cli): report final cleanup after returned results
* fix(cli): preserve launcher executable mode
* test(cli): retain invocation cleanup in file sessions
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* 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>
* fix(devicetree): read later FDT versions backwards compatible with v17
The header reader admitted only versions 16 and 17 and consulted
last_comp_version only to reject a value above the version. DTSpec 5.1
requires a client to accept any version backwards compatible with
version 17, and libfdt reads such a blob with the version 17 header.
Admit a later version whose last_comp_version is 17 or lower and read it
with the version 17 layout, reporting the declared version. A later
version that needs a newer reader and any version below 16 stay
unsupported, and v16 and v17 outcomes are unchanged. FIT recognition
shares the reader, so it now claims a FIT in such a version as well.
* test(devicetree): cover a later FDT version backwards compatible with v17
Parse the shared fixture with version 18 and last_comp_version 16: the
header is read with the version 17 layout and the tree decodes as it
does for v17. Raising last_comp_version to 18 keeps the blob
unsupported. FIT recognition, which shares the header reader, covers
the same version.
On the previous reader the version 18 parse and the version 18 FIT
recognition fail, because version 18 was refused before
last_comp_version was read.
* docs(devicetree): describe later FDT versions backwards compatible with v17
* test(devicetree): keep the unsupported-version cases on an incompatible header
The CLI and MCP error cases used version 18 as an arbitrary unsupported
version, but their fixture declares last_comp_version 16, which is now
read as a version 17 blob. Declare last_comp_version 18 there so both
cases still reach unsupported_target through the public paths.
The shared fixture takes the declared compatibility version for this,
and the parser case uses it instead of patching the header word.
* test(devicetree): cover compatible versions through CLI and MCP
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* refactor(iso9660): read both-endian halves through one helper
Split the half reading out of readBothEndian, and name the failure it
raises, so a caller can keep a disagreeing big-endian copy or raise the
same failure itself. The agreement check and its failure are unchanged.
* fix(iso9660): read a directory record's data length from its little-endian half
One directory record whose big-endian data_length copy differed from its
little-endian half refused the whole image as malformed, wherever the
record sat in the tree, so no member was inventoried. Linux isofs,
libarchive and pycdlib read only the little-endian half of a record's
data length, because mastering programs have written images whose
big-endian copy is wrong.
Records inside directory extents now use the little-endian half and keep
a disagreeing copy, which the entry reports as a limitation with both
values. A descriptor's own root record still requires both halves to
agree, as libarchive does, and every other both-endian field keeps its
agreement check.
The boundary case that pinned the refusal now lists the file or the
directory by its little-endian length and reads the rest of the tree.
* test(iso9660): keep descriptor root records strict about data length halves
A primary or Joliet descriptor whose root record stores a big-endian
data length copy that differs from its little-endian half stays
malformed at that field, so the little-endian reading of records inside
directory extents does not reach the descriptors.
* docs(iso9660): describe the little-endian data length of directory records
* test(iso9660): name each disagreeing section of a multi-extent file
Damage the big-endian data length copy of both sections of a contiguous
multi-extent file followed by a clean file. The file keeps its summed
little-endian size and verified hash, and its entry names both records
with their own values, in section order. The next file carries no
disagreement, so the per-member list is neither lost between sections
nor carried into the following member.
* test(iso9660): print the section limitation filter as an expanded chain
The formatter prints the three-group chain in the multi-extent case,
rows.get(path)?.limitations.filter(...), one member per line when it
does not fit on one line. The previous commit kept it on one line, which
failed format:check.
* fix(iso): retain directory-link length disagreements
---------
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
* fix(iso9660): read a directory record whose identifier padding byte is not zero
A record whose even-length identifier was followed by a nonzero padding
byte failed as malformed, and the walk ended the whole inventory on it.
The byte takes no part in decoding: Linux isofs, libarchive, pycdlib and
7-Zip step over it, and 7-Zip notes that some discs store another value
there.
The value is no longer checked. A record too short to hold the padding
byte stays malformed.
* test(iso9660): read a nonzero identifier padding byte in the Joliet tree
Joliet identifiers are UCS-2, so every file and directory record in
that tree has the padding byte. The case now damages the record of the
tree the reader walks and checks that tree was the one listed.
* docs(iso9660): describe the unchecked identifier padding byte