Compare commits

..
Author SHA1 Message Date
Ysopwnableandgensokyo-dev 559083be29 docs(security): define REA threat model and security properties (#9384)
* docs(security): define REA threat model and security properties

* docs(security): clarify the HTTP MCP trust boundary

---------

Co-authored-by: gensokyo-dev <[email protected]>
2026-11-08 18:11:38 +01:00
morluto 5044e20171 test: focus diagnostics and evidence checks on behavior (#9303)
* test: focus configuration diagnostics on their owners

Preserve shape errors, selected paths, recovery guidance, and unchanged-file behavior across parser, setup, and uninstall boundaries.

* test: focus artifact and evidence checks on behavior

Retain format, identity, malformed-input, and cleanup coverage while removing fixed prose and closing the admitted test source.

* refactor(debugger): use configured session admission limits

* test: focus evidence and diagnostics on behavior

* fix(test): restore verifier export and formatting

* test(config): verify debugger limit ranges

* test(rizin): keep fixture executable authoritative

* test(rizin): isolate debugger fixture environment
2026-11-08 16:39:20 +00:00
Ysopwnableandgensokyo-dev 08637b0c24 fix(deps): patch Vite and isolate ASAR tooling (#9374)
Co-authored-by: gensokyo-dev <[email protected]>
2026-11-08 17:15:52 +01:00
morluto c5ed046d6e fix(ghidra)!: qualify memory effect coverage (#8651)
* fix(ghidra): qualify memory effect coverage

* fix(native): retain value trace source limitations

* fix(native): distinguish value trace policy commitments

* fix(ghidra): bind value-flow scope to snapshot profile

* test(ghidra): verify legacy value-flow snapshot recovery
2026-11-08 15:05:51 +00:00
03a3fcbcea feat(skills): build a computer-app environment from a request (#9049)
* feat(desktop): capture, draft, export and witness a task inside a build computer

- start_build_capture runs REA's capture inside the computer through a
  small controller over computer-exec, after a user-space apt-get update;
  mark_build_checkpoint returns once the capture confirms the checkpoint;
  stop_build_capture returns the draft between seed and end.
- export_build_environment exports with the requester's task inside the
  computer and fetches the bundle through data/get in bounded batches.
- check_build_task grades a computer's data/get with REA's evaluator and,
  through seed, after_edit, near_miss and after_reset stages, records a
  witness with the action log and the screen recording; act_on_build_computer
  gains reset.
- Capture progress lines carry window, checkpoint and refusal events; apps
  start in the home; a pack script builds the runtime archive; long tools
  send progress notifications.

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

* fix(desktop): make build capture and witness steps retryable, and close the near-miss reset hole

- A capture whose start answer is lost is stopped at once and kept
  unreleased until the stop is confirmed; a lost checkpoint answer is
  recovered from the capture's own log, and draft and export use the
  checkpoints its Evidence records; stop can be repeated to resume
  reading its result.
- A witness can check its seed again after a failed read, and keeps its
  stages in a saving state until the record is written, so a failed save
  can be retried without reading the app again.
- after_edit and near_miss count only click, drag, scroll, type and key,
  so a reset no longer stands in for the near-miss edit.
- A .deb build keeps its package file for capture and passes its URL to
  export; bundle downloads write each checked file before fetching the
  next; an apt-get update failure reports its exit code and log tail;
  reset sends progress while it waits.

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

* fix(desktop): keep the Trash out of seeds, bundle folders unwritten and first frames drawn

From the blind Inkscape rebuild:
- Paths in ~/.local/share/Trash get a desktop_trash reason and the
  shared_desktop role, so a file trashed before seed is neither owned nor
  seeded; the export names it in a limitation.
- The keep helper runs with PYTHONDONTWRITEBYTECODE=1, so starting a
  computer from a bundle folder no longer writes __pycache__ into it.
- start_build_computer waits, bounded, until the first frame is not one
  colour before returning it.
From review: a .deb that apt also offers exports from apt, since export
passes --package-url only when the capture says the package must come
from its file.

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

* fix(desktop): bound the first-frame wait's retries to the time left, with progress throughout

Each retry of the drawn-first-frame wait runs under an abort that fires at
the 10 s deadline, and the latest frame is returned when time runs out.
connect takes the first frame itself while its progress heartbeat still
runs, reporting "waiting for the desktop to draw". The wait moves to
DrawnScreenshot.ts.

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

* fix(desktop): serialize each build computer's calls, keep one recording id, and separate unreadable checks from failures

- One queue per computer: actions, capture steps and witness checks run one
  at a time, so two overlapping after_edit checks can no longer both be filed
  and let the witness hold without a near miss. Close cancels the running and
  queued calls; different computers still run concurrently.
- The witness keeps one recording request id per computer, so a seed retried
  after a lost reply recovers the recording it started.
- A check that could not read its file is undecided, not a failure, so a
  temporary read error can't satisfy seed, near_miss or after_reset; such a
  stage is refused and can be checked again.
- The export's file listing is written to a file and read back in bounded
  batches, so a large bundle no longer overruns exec's 1 MiB output.

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

* fix(desktop): treat failures on cut views as undecided, require a decided seed failure at export, and keep a close's cancellation

- A presence check that misses its line, row or pointed value in a view cut
  short is undecided rather than failed, since the data may sit in the part
  left out; a witness stage can no longer be proved by such a failure.
- Export counts only decided failures on the seed, and refuses a task whose
  every seed failure is undecided.
- A step whose turn was aborted by a close or the caller returns cancelled
  even when its work finished, so start_build_capture no longer reports
  success for a computer being removed.

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

* fix(desktop): keep a step's saved result when a cancellation arrives during its commit

Reporting cancelled for any step whose turn was aborted after its work
replaced a completed export or witness save with a bare cancellation, losing
what was saved and leaving the witness unreadable. Steps now return what they
completed; only start_build_capture, which commits nothing, checks its turn
after the post-launch screenshot and reports cancelled. Asking again for a
saved witness's final check returns its record.

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

* fix(desktop): refuse a saved witness's repeated check for another folder

Asking again for the check that ended a witness returned its saved record
whatever directory came with it, so a caller naming another folder got
success though nothing was saved there. A different folder is now refused,
as an unfinished seed's retry already is.

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

* test(desktop): assert the facts of cut-view and undecided outcomes, not their sentences

The new cut-view, missing-value, undecided-refusal and witness tests froze
whole descriptions, so a harmless rewording broke them. They now check each
outcome's id, passed and undecided exactly and the facts its message must
carry (file, pointer, line, row, stage) separately.

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

* feat(desktop): read XML with a plain DOCTYPE, and check an element's whole text

- Both readers accept a DOCTYPE with only a name and an optional PUBLIC
  or SYSTEM identifier, record it as the view's doctype, and never fetch
  the DTD or expand entities beyond XML's five; an internal subset, an
  external entity and a parameter entity stay refused alike.
- text_equals and text_contains compare the concatenated text of the
  element (or text node or attribute) a pointer reaches, as XPath
  string() does, with optional normalize_whitespace; both evaluators
  agree, and a text check on a truncated element is undecided.
- Whitespace-only text between elements is dropped only when the element
  holds no other text, so text split into runs keeps its spaces.
- The draft suggests text_equals for an element whose text changed.

So an AbiWord .abw reads as XML, and its paragraph's text is checked
whole however AbiWord splits it into <c> runs, as Writer's spans are.

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

* fix(desktop): draft whole-text checks on the paragraph, read only text as text, and skip asctime stamps

- A changed value is read at both ends, so text that became a run still
  marks its paragraph, and the drafted text_equals moves up out of mixed
  content to the nearest ancestor named by an attribute, such as
  AbiWord's p by its xid.
- Text checks accept only a text node or an attribute value; element
  names and doctype fields fail, in both evaluators.
- isTimestamp also recognises asctime dates (Www Mmm dd hh:mm:ss yyyy).
- XML files are drafted with the keyed diff the archive entries use, so
  no suggestion reaches an element by position; the shared logic moves to
  appTaskDraftNamed.ts.
- Text-check tests assert facts, not whole sentences.

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

* fix(desktop): keep checks on a changed attribute inside a paragraph whose text check replaces its runs'

A drafted whole-text check on a paragraph hid every change inside it, so a
link whose label and href both changed drafted only the paragraph's text and
the new destination went unchecked. The text check now covers text and runs
added or removed whole; a changed name or attribute of an element both
versions hold keeps its own check.

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

* fix(desktop): read an attribute called name or attributes as an attribute when the draft keeps its check

The owner of `.../attributes/name` was taken as `.../attributes`, so a
changed `name` attribute inside a paragraph with a text check was dropped
again. The owner is now read by segment, attributes first.

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

* fix(desktop): draft text checks from text in runs added whole, and name a text element by its own id before its container

Text typed into a run the diff lists whole was never read, so the draft kept
only a presence check on the run, which wrong text also passed. Such text now
marks the nearest element both ends hold, or, when none can take the check,
the added element's own text. The climb also names an element by an
identifier of its own (id, xml:id, xid) before a larger container, so a
headline under a long layer keeps a whole-text check that survives re-split
runs.

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

* test(desktop): expect the whole-text check where #8988's pairing test meets text checks

On this branch a changed element's text is drafted as `text_equals` on the
element, so the identity pairing test now expects that check, under the
same `[@role=body]` key.

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

* feat(skills): build a computer-app environment from a request

The product skill gains references/desktop-build.md, a procedure that
takes Claude from a request such as "an Inkscape environment where the
agent changes a poster's headline" to a witnessed bundle and a report,
through start_build_computer, act_on_build_computer, the build capture
tools, export_build_environment and check_build_task: questions asked
once upfront, pauses only when blocked, a seed made in the app, content
checks by selector, a witness with a near miss and a reset in a fresh
computer, and solver runs only within a budget. setup installs the new
reference; skillVersion 61.

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

* docs(skills): fold the blind Inkscape rebuild's friction into the build skill

key takes an array of one chord's keys; check for a text cursor before
typing in apps with single-key shortcuts; in Save As, click Documents and
type only the file name; anything saved before seed, the Trash included,
is part of the seed; dismiss first-run dialogs before seed; a bundle's app
starts with the seed's files but need not open the document; Inkscape's
window class is Inkscape.

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

* docs(skills): fold the held-out AbiWord build's friction into the build skill

Name the act fields and link the guide; a region screenshot becomes the
latest frame; a drawn caret is not focus; confirm dialogs with Return;
check the dialog's folder when the app shows only a name; an XML file the
draft shows as lines was read as text, so use short line checks; and keep
text checks to the value the edit types, since some apps save a reloaded
document differently. Later witness stages take no directory.

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

* docs(skills): state the export's seed rule, the Trash exception and draft refusals exactly

The export refuses a task unless at least one check fails on the seed and
every check passes at the end; a file moved to the Trash is left out of
the seed, so trash a stray file rather than starting over; a null draft
names its cause in draft_refusal; and a line check on a format read as
text only approximates a value, so bound it and call it approximate.

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

* docs(skills): teach the build skill to use DOCTYPE and whole-text checks

The skill now checks text an app splits into runs whole with text_equals or
text_contains, finds an AbiWord paragraph by its xid, and drops the Writer
revision-id workaround.

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

* docs(skills): point text checks at the paragraph, and say what the scrub replaces

From the AbiWord rebuild: point a text check at the paragraph or another
element the edit keeps, never at a run a reopened document splits; how to
name an unchanged element; the export replaces the host name, user@host
and home path while a bare user name stays; AbiWord's entry and class.

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

* fix(desktop): keep every text check on a cut element undecided, in both evaluators

The XML reader drops text deeper than its depth limit but keeps later
siblings, and an element's whole text joins both sides, so a text_contains
on a cut element could match text the file never holds ("at 3" + deep
"WRONG" + ":30 PM" read as "at 3:30 PM"). Any text check on an element of a
cut view is now undecided again, as #9050 had it, in REA's evaluator and the
exported verifier; a text node or attribute value stays decided. The text
check tests assert facts rather than sentences.

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

* fix(desktop): keep a reset applied when the screenshot asked after it fails

Once data/reset and the ready wait succeed, act_on_build_computer's reset
is applied in the action log and returns success; a screenshot asked of it
that is then refused or throws is named in the result's screenshot_error,
with no frame, so the next after_reset stage is not refused. Cancellation
still propagates.

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

* fix(desktop): keep checks for elements without text beside a text edit, and normalize DOCTYPE system id line endings

A review found two gaps.

- A paragraph's whole-text check covered every element added or removed
  inside it, including ones holding no text: an image frame, a line break.
  A solver who typed the text but never inserted the image passed. Such an
  element now keeps its own presence or absence check.
- The Python reader kept a DOCTYPE system literal's CRLF where TypeScript
  normalizes it to LF. Both now report LF.

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

* fix(desktop): wait out long build commands, fail a reset that restores nothing, and tie the witness to its bundle

A review found five gaps.

- Commands in the computer answer only when they end, but fetch stops
  waiting for headers after 300 s. So a slow export, draft or start always
  failed. A command with its own deadline now waits on node:http, bounded
  by that deadline.
- after_reset held whenever some check failed, so a reset that changed
  nothing passed on the near-miss state. Each check must now come out as it
  did at the seed.
- A failed or partial apt-get update left lists that looked complete, so a
  second start skipped the update. The update is now recorded only when it
  succeeds, and rerun otherwise.
- A witness on a bundle computer graded whatever task it was given. Its
  seed stage now refuses a task whose steps or checks differ from the
  bundle's.
- A task too large for one command argument (96 KiB) is refused before the
  export runs, instead of failing with E2BIG in the computer.

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

* fix(desktop): advertise a checkpoint-name pattern that compiles in every JS regex mode

main's advertised-pattern test compiles every input schema pattern in v
mode, which refuses an unescaped hyphen in a character class. The
checkpoint name's hyphen is now escaped, and it means the same in u mode.

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

* test(desktop): import textSyntaxFormat once in the state format tests

main's mixed-case JSON suffix fix and this branch both added the import,
and the merge kept both.

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

* fix(desktop): keep a completed reset, an unread seed, and a failed apt update

A cancel after data/reset no longer drops the restore from the action log,
so a near miss cannot treat the restored seed as an edit. An unreadable
seed check that later passes leaves after_reset undecided instead of
failing the witness. apt-get update is kept only when Error-Mode reports
success and a package list was fetched. The controller reply schema lives
with the controller, and capture progress lines are read by their domain
parser.

* fix(desktop): keep a whitespace-only run under the paragraph text check

A run whose only text is whitespace is still text the paragraph check
reads. It no longer gets its own presence check, which a later save of
the same words without that run would fail. Images and breaks, whose
text is empty, still keep their own checks.

* fix(desktop): keep an unread reset and a cut text check undecided

after_reset stays undecided when any check was not read, even if another
check still fails and the unread result's boolean matches the seed. A
text check for a child past a truncated view is undecided in both
evaluators. A reset whose reply is lost blocks a near miss until a later
input or a reset whose reply arrives.

* fix(desktop): retry a witness recording and a published record's cleanup

A recording that fails to end or download is not written into the witness
folder, and a manifest already received is fetched again without ending
the recording twice. A folder that is published while its handles fail to
close keeps that record and retries the same cleanup instead of writing
the folder again.

* fix(desktop): keep a published witness error and tag an app data refusal

A second failure to close a published witness returns the original error,
so its record and cleanup lease stay bound. A reset the app itself
refuses is an AppDataRefusal; only a reply that is not that refusal stays
unsettled. A missing child of a cut view is undecided with the same
description in both evaluators, and the shared cases cover it.

* fix(desktop): align a cut view's missing text with the Python check

A missing child of a truncated view is undecided for the same sentence in both evaluators, including the pointer the view does not contain.

* fix(desktop): keep one published witness cleanup across retries

A published record and its bound cleanup error stay together. A later close failure returns that error, and the unused path that built a fresh adapter error is gone.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: morluto <[email protected]>
Co-authored-by: morluto <[email protected]>
2026-11-08 22:19:28 +08:00
325 changed files with 3952 additions and 2540 deletions

No files matched your search

@@ -1,8 +1,8 @@
---
name: reverse-engineer-anything
description: Reverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.
description: Reverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.
metadata:
version: "60"
version: "61"
---
# REA
@@ -140,6 +140,10 @@ explicit path or endpoint and do not need it.
- Task for a desktop application's exported environment, from a
`capture-desktop-application` folder: read
[desktop application tasks](references/environments.md#tasks-for-a-desktop-application-environment).
- Environment of a Linux desktop app with a task, from a request such as
"build me an Inkscape environment where the agent changes a poster's
headline": read [desktop builds](references/desktop-build.md). You drive the
app on a build computer from `start_build_computer`, then export and witness.
- Fiddler Everywhere traffic or a native `.saz` capture: read the
[Fiddler workflow](references/runtime-observation.md#fiddler-everywhere-traffic-debugging).
Inspect saved SAZ with `inspect_web_network_capture` and `format: "saz"`;
@@ -539,6 +543,8 @@ as complete while required questions remain open.
[references/environments.md](references/environments.md)
- Tasks for a desktop application's exported environment:
[references/environments.md](references/environments.md#tasks-for-a-desktop-application-environment)
- A desktop app environment from a request, built and witnessed on build
computers: [references/desktop-build.md](references/desktop-build.md)
## Finish the task
@@ -0,0 +1,290 @@
# Desktop app environments from a request
Use this when someone asks for an environment of a Linux desktop app with a
task, such as "Build me an Inkscape environment where the agent changes a
poster's headline and saves it". You are the building agent: you drive the
app on a build computer through REA's MCP tools, write the task, export the
bundle and witness it in a fresh computer. REA runs no model. The tools are
MCP-only and need Docker, `REA_AGENT_ENV_COMMAND` and
`REA_BUILD_COMPUTER_REA_ARCHIVE` where the REA server starts; when a start
reports one missing, tell the person what to set and stop.
For the whole build:
- Drive the app only with `act_on_build_computer`. Never script it, run
commands in the computer or write its files another way.
- Ask the upfront questions once, then work on your own. Pause only when
blocked.
- The seed's content is synthetic. Never put real personal data in it.
- Close every computer you start, on success and on failure.
- Note the time you start; the report gives the build time.
## Ask once, upfront
In one message, ask only what the request leaves open, and keep the list for
the report:
1. The app and the task, if either is unclear: what changes, in which
document.
2. Whether they have a starting file of their own; otherwise you make one.
3. Whether they want solver runs after the witness: how many (the budget)
and with which model.
4. If so, whether they want to review the task before those runs.
## When you are blocked
Stop, say what you need and wait only for:
- a licence the app or its installer asks someone to accept: never accept it
yourself; name it and where to read it, and go on only once the person
says they accept it;
- credentials: they may only be typed as handles you never see, and the
build tools have none yet, so say the app needs a sign-in and stop. Never
ask for a password in chat;
- a signed-in state in the seed: ask before seeding one;
- an install this flow cannot do, below.
Decide everything else yourself and note it in the report.
## Choose the install
The computer is Ubuntu 24.04 (noble) on this host's architecture only. Use
the first source that has the app:
| Source | `install` |
| ---------------------------- | --------------------------------------------------------------------------------- |
| Ubuntu archive | `{"kind": "archive", "package": "inkscape"}` |
| PPA or vendor apt repository | `{"kind": "apt_repository", "package", "uri", "suite", "components", "key_file"}` |
| `.deb` by URL | `{"kind": "package_file", "url", "sha256", "architecture", "dependencies"}` |
- A PPA's `uri` is `https://ppa.launchpadcontent.net/OWNER/NAME/ubuntu`,
`suite` `noble`, `components` `["main"]`. `key_file` is the repository's
signing key saved on this host; for a PPA, fetch it from
keyserver.ubuntu.com by the fingerprint its Launchpad page shows.
- For a `.deb`, ask the requester for its URL and SHA-256; do not fetch a
vendor's download page yourself. List its `Depends` as `dependencies`:
it installs with the network off.
- Flatpak, AppImage and snaps are not supported yet: say so and stop. An
archive package that only installs a snap, such as noble's `firefox`,
counts as a snap. A package with no build for this host's architecture
(some PPAs are amd64 only) cannot be installed either.
- `desktop_entry` is the package's `.desktop` file name under
`/usr/share/applications` without `.desktop`, such as
`org.inkscape.Inkscape`. Add `window_class` when you know it; Inkscape's
is `Inkscape`. AbiWord's entry is `abiword` and its class `Abiword`.
## Drive the app
- Pass `computer_id` and the action's fields at the top level: click
`{x, y, count}`, scroll `{x, y, direction, amount}`, a screenshot region
`[x0, y0, x1, y1]`. The rest are in
[the build-computer guide](https://github.com/morluto/rea/blob/main/docs/desktop-build-computer.md).
- Take a `screenshot` before pointing: points are pixels of the latest
frame. If a response is too large, ask for a `region`, or `jpeg` with a
lower `quality`. A region crops the latest frame and becomes it: take a
full screenshot before pointing again.
- A drawn caret does not prove keyboard focus. After using a toolbar
control, click into the document, then type a few characters and look
before a long text.
- Confirm a dialog with `key` Return, not a trailing `\n` in `type`.
- An action's own screenshot is taken at once. After opening a menu, a
dialog or a window, look with
`{"action": "wait", "ms": 500, "screenshot": true}`.
- On a computer started from a request the app is not open at first, and
`start_build_capture` opens it: never open it yourself before that. Do not
close it while capturing; the capture ends when the app exits. When the
app is closed at any other time, open it from Applications → Other → the
environment's name.
- Prefer shortcuts and typing to long pointer paths: `key` takes `keys`, an
array holding one chord's keys, such as
`{"action": "key", "keys": ["ctrl", "s"]}`, and `type` turns `\n` into
Enter.
- Before `type`, check in a screenshot that a text cursor or a focused
field is there. In apps with single-key shortcuts, such as Inkscape, text
typed without one runs as commands.
- Save As opens in the home: click Documents in its sidebar and type only
the file name. Answer the app's save questions, such as keeping the
format, then check the saved path in the title or status bar, or the
dialog's folder when the app shows only the name, and that it shows no
unsaved mark, before you mark a checkpoint or check.
- What the app saved under the home before `seed`, such as a document in
`~/Documents` or its settings, is part of the seed. A file you move to the
Trash is left out, and the export lists it in `limitations`. Trash a stray
file rather than starting over.
- Dismiss first-run dialogs, such as a welcome screen, before `seed`. A
choice the app saves only later, such as Inkscape's "show this every
time", may not reach the seed, so expect the dialog in the witness too.
- Give what the task changes a stable name where the app has one, such as an
id in Inkscape's Object Properties, so a check can select it.
- Expect apps to split text into runs: Writer's revision ids split an
edited paragraph into spans and may give it an automatic style such as
`P1`, and AbiWord wraps each insertion in `<c>`. Check such text whole
with `text_equals` (see Write the task), and find the paragraph by
something the edit keeps, such as AbiWord's `xid`.
## Build the seed and the edit
1. `start_build_computer` with
`{"source": {"kind": "request", "desktop_entry": ..., "install": ...}}`.
The first start of an app builds its image and can take minutes. A
failed start returns the build's error: fix the request, or stop when the
install cannot work, and close any `computer_id` the error names.
2. `start_build_capture`. It returns once the app's window is open. A
`package_lists_error` may stop the capture finding the package's
sources; the export says when that matters.
3. Make the seed through the app and save it from the app under
`~/Documents`: build the document in the app, or write its source where
the app edits its format as text, then save it again from the app. Make
it look real but synthetic: the thing the task changes, plus a few things
the change must leave alone. For a starting file of the requester's,
read it here and rebuild it in the app with synthetic data in place of
personal data; REA cannot copy a file into the computer.
4. Only once the seed is saved, `mark_build_checkpoint` with name `seed`.
5. Make the change the task asks for, as a user would, and save it.
6. Only once the change is saved, `mark_build_checkpoint` with name `end`.
7. `stop_build_capture`. Read `draft.files` (each file that changed, with
its net change), `draft.task.checks` (suggested checks) and
`limitations`. When `draft` is null, read `draft_refusal` first: a
missing `seed` or `end` checkpoint means capturing again on a new build
computer, while a failed draft command names its own cause to fix.
## Write the task
Write `{"name", "prompt", "checks"}` from the draft and what you did.
- `name`: lowercase letters, digits and hyphens, not `smoke`.
- `prompt`: what the requester wants, in their words and the app's terms,
naming the document as a user would and ending with saving it: "Change the
poster's headline in Documents/poster.svg to Summer Bake Sale and save
it." Never say how the file stores it, and never give the checks.
- Checks are file-based: content checks that prove the edit, never only that
a file exists or changed. Start from the suggestions; keep those that say
what the user did and drop what follows from how the app saves.
- Compare exact values, so a typo or a wrong number fails.
- Select elements by what they hold, never by position: SVG text by id,
`/root/children/[name=g][@inkscape:label=Layer 1]/children/[name=text][@id=headline]/children/[name=tspan]/children/0`,
or an ODF paragraph by style,
`/entries/[name=content.xml]/view/root/children/[name=office:body]/children/[name=office:text]/children/[name=text:p][@text:style-name=Title]/children/0`.
A selector must match exactly one element, so give the target a unique id
or style in the seed. The draft may suggest positional pointers; rewrite
them. Only an element's text is read by position, as `children/0`.
- When an app may split an element's text into runs, check it whole:
`text_equals` (or `text_contains` for a value inside a sentence) on the
element compares all its text, however it is split. Add
`normalize_whitespace: true` when the app may reflow spaces. Example, an
AbiWord paragraph by its stable id:
`{"kind": "text_contains", "file": "Documents/memo.abw", "pointer": "/root/children/[name=section]/children/[name=p][@xid=6]", "value": "at 3:30 PM"}`.
Point a text check at the paragraph or another element the edit keeps,
never at a run such as AbiWord's `[name=c]`: a reopened document splits
the text into several runs. The draft lists only what changed; to name an
unchanged element, such as another paragraph's `xid`, use the app's usual
numbering and let the export confirm it, or read it in the exported
bundle's `envs/<env>/seed/`.
- Where easy, add one check that the rest is untouched, such as another
text's value the edit must leave alone. It is the one unchanged value
worth checking; it passes on the seed too, which is fine, since the export
needs only one check to fail there.
- Give `value_equals` a `tolerance` for a number the app writes as text.
- When the draft shows an XML document's changes as `lines`, REA read it
as text, for example because its DOCTYPE declares entities. Selectors are
impossible there, and `line_count` with `contains` only approximates a
value: `3:30` also matches `13:30`. Bound it with neighbouring text and
name the check as approximate in the report's limitations.
- Some apps save a document reloaded from disk differently from one typed
in the same session: AbiWord wraps each new insertion in its own markup.
Your build's end state hides this, which is why whole-text checks matter;
expect the witness to show the real format.
The kinds and pointer rules are in
[the desktop tasks section](environments.md#pick-the-checks).
## Export
`export_build_environment` with `task` and `directory`, the absolute path of
a new or empty folder here, such as `<home>/rea-builds/poster/bundle`. The
export seeds what was saved at `seed`, replaces the computer's host name,
`user@host` and home path (a bare user name, such as AbiWord's author
`user`, stays), and checks the task against `seed` and `end`. It refuses a task
unless at least one check fails on the seed and every check passes at the
end, and says why, such as a pointer that names nothing at the end. A
check that the rest is untouched passes on the seed too, which is fine. On
a refusal, fix the task and export again, into another folder if that one
is no longer empty. Keep
`seed_files`, `scrubbed_files`, `unscrubbed_files` and `limitations` for the
report.
Keep the build computer open until the witness holds: a task fix exports
again from it.
## Witness
Witness in a fresh computer of the bundle, from the prompt, as a solving
agent would. Do not replay the build's actions or coordinates, and do not
check between stages to steer the edit: a solving agent never sees the
checks. Give every `check_build_task` the task exactly as exported.
1. `start_build_computer` with
`{"source": {"kind": "bundle", "path": "<bundle>"}}`. The app starts
with the seed's files in place but need not open the document: open it
from the prompt's path, as a solving agent would. Take a `wait`
screenshot first, since the desktop may not have drawn yet.
2. `check_build_task` with `stage: "seed"` and `directory`, the absolute
path of a new or empty folder for the record. A check must fail.
Recording starts. Later stages take no `directory`.
3. Do the task from the prompt with `act_on_build_computer` and save.
`check_build_task` with `stage: "after_edit"`: every check must pass.
4. Make a near miss on top of it: a plausible wrong edit, such as a typo or
a wrong number, and save. `check_build_task` with `stage: "near_miss"`:
a check must fail.
5. `act_on_build_computer` with `action: "reset"`, then `check_build_task`
with `stage: "after_reset"`: a check must fail again.
6. The last stage ends the witness: `witness.record` has the verdict, the
path of `witness.json` and the recording's segments in `directory`.
`close_build_computer` on the witness computer.
A stage that does not hold ends the witness as `failed`. Read each check's
result and decide:
- `after_edit` failed though the saved file is right: the check is brittle.
Fix it, export again and witness in a new computer.
- `after_edit` failed because your edit was wrong: witness again in a new
computer; a computer is witnessed once.
- `near_miss` passed: the checks are too loose. Tighten them, export again
and witness again.
- `after_reset` passed: the reset did not restore the seed. Report it as a
limitation.
Stop after three witnesses and report what still fails.
## Solver runs
Only if the requester asked for them. If they wanted to review the task
first, show them its prompt and checks and wait for their approval. Then run
the bundle within the budget, one run at a time, with the runner
`REA_AGENT_ENV_COMMAND` names:
`agent-env run <bundle> --task <name> --agent claude-code --model <model>`.
Count runs reported `passed`. A run `scored below 1` is a miss; one reported
`failed` did not finish, so run it again if the budget allows instead of
counting it. Never run past the budget.
## Close and report
`close_build_computer` on every computer still open, also after a failure.
If a close fails, call it again; if it still fails, tell the requester what
is left.
Report:
- the bundle path and the environment name;
- the task's name and prompt;
- each check, and why it proves the edit and fails the near miss;
- each witness stage with its result, the verdict, and the paths of
`witness.json` and the recording;
- the seed's contents: `seed_files` and what each holds;
- `scrubbed_files` and `unscrubbed_files`; an unscrubbed file still names
the host or user, so it needs review before sharing;
- limitations: the capture's, the export's and anything you could not do;
- solver runs, if any: the model, the runs and the passes;
- the build time and the questions you asked.
Never publish or share the bundle yourself.
@@ -294,7 +294,9 @@ Use this when the user has a folder from `rea capture-desktop-application` and
wants a task for the environment `rea export-desktop-application` makes from
it: a prompt for a computer-use agent and checks that grade what the agent
left in the app's files. You write the prompt and the checks; REA validates
the task against the capture and exports it. These commands are CLI only.
the task against the capture and exports it. These commands are CLI only. To
build the environment and its task from a request instead, follow
[desktop builds](desktop-build.md).
### Describe the change
+111 -27
View File
@@ -4,6 +4,117 @@
Security fixes are provided for the latest published version of REA. Upgrade to the latest release before reporting a problem that may already have been resolved.
## Security boundary
REA is a local reverse-engineering and automation tool. CLI and MCP use the
same application workflows and run with the host process's permissions.
REA is not a general-purpose sandbox or a multi-tenant authorization service.
### Threat model
- **Trusted authority:** the operating-system account running REA, the caller
or agent host that selects operations, and configured analysis providers,
their executables and extensions, and service endpoints. An MCP client can
invoke the operations exposed to it; its host must enforce the user's tool
permissions and approvals.
- **Untrusted data:** target binaries, archives, source files, project contents,
captures, web pages and returned target content can be malicious. Selecting
an input for static inspection does not authorize commands embedded in that
input. Agents must treat target text and Evidence as data rather
than instructions granting additional authority.
- **Operation-specific effects:** static inspection parses target data and may
launch an analysis engine. Runtime, debugger, instrumentation, browser,
desktop and environment workflows can deliberately execute code, attach to
processes, make network requests, write files or interact with applications
and devices. Review the selected operation's effects and limitations; static
inspection does not authorize launching or interacting with the target
application. See
[runtime and network responsibilities](DISCLAIMER.md#runtime-network-and-device-operations).
Standard client registrations use a dedicated stdio process. Opt-in
[HTTP MCP](docs/reference/mcp-contracts.md#transports) uses plain HTTP without
TLS or client authentication and shares provider/active-target state across
protocol sessions. Its session ID is not a user-authentication or isolation
boundary. Keep this endpoint within a trusted local or isolated environment.
### Intended security properties
Static JavaScript and .NET inspection do not run the target application.
Unexpected execution of input code through a data-only analysis path is a
security concern. Analysis engines themselves are executable software trusted
with the host account's permissions; parsing an input in an external engine
does not isolate that engine from the host.
REA authenticates its managed Hopper and Ghidra bridges with per-session random
capability tokens transferred through private session files, rather than
process arguments or environment variables. POSIX uses current-user Unix
sockets. Windows Ghidra uses authenticated loopback TCP and a private NTFS
runtime whose DACL admits only the current user and SYSTEM. These controls
protect the managed session boundary, not every external provider or debugger
endpoint. See [Windows Ghidra transport and lifecycle](docs/providers/windows-ghidra-p0.md#private-runtime-transport-and-lifecycle).
Provider ownership and mutation rules remain specific to each workflow:
- Ghidra's working projects are temporary and owned by REA. Opt-in
[checkpoints](docs/getting-started/installation.md#automatically-checkpoint-an-owned-ghidra-program)
retain REA-owned Program state. A
[caller-selected existing project](docs/getting-started/installation.md#reuse-an-existing-ghidra-project)
is fingerprinted and copied into an owned runtime for read-only processing;
Ghidra does not open or save the original database through that workflow.
- [IDA analysis](docs/providers/ida-provider.md) is read-only. An attached GUI
database is never saved or closed by REA; owned headless sessions have a
separate lifecycle.
- Cleanup must stay within resources REA owns. Failed or unverified cleanup
can retain a workspace or session for retry; closing a session
does not imply that every investigation artifact has been erased.
`rea setup` shows planned configuration and installation changes and requires
approval before applying them. Ghidra, Java and IDA are user-managed. Approved
Linux Hopper installation authenticates the package's detached PGP signature
against the pinned publisher identity and checks the signed launcher against
the selected release's digest. The release feed's display version is separate
from that authenticated identity. See [installation and publisher verification](docs/getting-started/installation.md#hopper).
### Limits and caller responsibilities
- **Host isolation:** private runtimes and capability tokens do not protect
against malicious software already running as the same operating-system
user, or a compromised trusted client or provider. Use an appropriately
isolated account, VM or restricted environment when handling hostile targets.
- **Resource bounds:** timeouts, cancellation, streaming and size limits are
operation-specific. They are not a universal CPU, memory, disk or wall-time
limit on every target and third-party tool. Enforce hard host resource limits
externally when needed. Failures of a documented boundary or cancellation
control still warrant investigation.
- **Data and network exposure:** Evidence, caches, checkpoints, exports and
captures can retain private target data, paths, URLs and memory contents.
Local execution does not make these outputs safe to publish. Requested
network operations, agent hosts and provider features such as
[IDA Free's cloud decompiler](docs/providers/ida-provider.md) can communicate
outside the host. Review their data handling and secure any exposed endpoint.
- **Interpretation:** analysis, reconstruction and generated environments can
be incomplete or incorrect. Identity checks, signatures and successful
analysis do not establish that a target, provider or generated program is
safe to execute. Review the Evidence and proposed actions before relying on
them.
### Vulnerability scope
Please report suspected violations of these boundaries privately. Examples
include unintended code execution during data-only inspection, escaping a
documented extraction/output boundary, bypassing bridge authentication or
target/session identity checks, unauthorized effects on an unrelated resource,
and disclosure of transport credentials or explicitly marked sensitive values.
An attacker-triggered bypass of a documented resource or cancellation control
can also be security-relevant without code execution.
Incorrect analysis, unsupported formats, crashes, hangs and high resource use
without a security-boundary impact are generally ordinary bug reports. Effects
explicitly requested through an execution or interaction workflow are not by
themselves a vulnerability. A dependency advisory needs its actual REA exposure
assessed; a complete exploit or diagnosis is not required to report a concern.
If you are unsure whether a boundary is affected, use the private channel below.
## Reporting a vulnerability
Do not disclose vulnerabilities, proof-of-concept exploits, credentials,
@@ -21,30 +132,3 @@ unrelated local paths from logs or examples.
The maintainer will acknowledge the report, assess its scope, and coordinate
remediation and disclosure timing with the reporter. Please allow time for
provider-dependent behavior to be reproduced safely.
## Security boundary
REA authenticates its Hopper and Ghidra bridges with per-session random
capability tokens. POSIX uses current-user Unix sockets; Windows Ghidra uses
authenticated loopback TCP with a private NTFS runtime whose DACL admits only
the current user and SYSTEM. See [Windows Ghidra P0](docs/providers/windows-ghidra-p0.md#private-runtime-transport-and-lifecycle).
Tokens are transferred through private session descriptors rather than process
arguments or environment variables.
This is not a sandbox and does not protect against malicious processes already
running as the same operating-system user. Opening an untrusted binary
delegates parsing and analysis to the selected local provider with that user's
permissions.
Ghidra sessions use a packaged Java `HeadlessScript`, an isolated temporary
project, and private home, cache, and runtime directories. REA imports only the
requested target, bounds startup and protocol messages, requests bounded CPU
and heap settings, and deletes the temporary project when the session closes.
These controls limit accidental persistence and resource use; they do not make
Ghidra a sandbox. REA does not open or modify user-owned Ghidra projects.
`GHIDRA_INSTALL_DIR` and optional `JAVA_HOME` identify user-managed
installations. Setup can add those values to detected client configuration only
after showing its plan and receiving approval. REA does not download, install,
upgrade, or modify Ghidra or Java.
On Linux, REA accepts release metadata only from Hopper's HTTPS endpoint, restricts package URLs to Hopper's public download origin, bounds the package size, and compares the downloaded bytes with Hopper's published checksum before requesting installation. The published SHA-1 value is a corruption check, not a modern package signature; HTTPS origin validation remains part of the trust boundary. Dependency installation is delegated without shell evaluation to `apt-get`, `dnf`, or `pacman`, directly as root or through `pkexec`. REA never invokes `sudo`.
+3
View File
@@ -1961,6 +1961,9 @@ public final class ReaGhidraBridge extends HeadlessScript {
limitations.add(
"Def-use links do not cross function boundaries and may omit memory aliasing, call side effects, or unresolved indirect flow."
);
limitations.add(
"Memory read/write effects cover high-p-code LOAD and STORE operations only; direct memory address varnodes in other operations are not included. An empty effect list does not establish that no memory is accessed. Recorded instruction references may provide complementary evidence."
);
limitations.add(
"Memory read/write effects include stack and temporary memory operations; they do not identify persistent state or business meaning."
);
+4 -1
View File
@@ -141,7 +141,10 @@ The rules both evaluators follow:
- A check decided by what a view leaves out (`lines_absent`, `value_absent`,
`row_absent`, the counts, `value_equals` of a whole object or array, and
the text checks of an element) fails when that view is truncated; a check
satisfied by what the view holds is decided on it.
satisfied by what the view holds is decided on it. An element's text is not:
the reader may have dropped text from between the runs it kept, so
`text_contains` fails on a truncated view even where the kept runs hold its
value. A text node or attribute value is whole, and decided.
The export refuses, naming the check, a file outside the owned paths, a file
spelled with a leading slash, `.` or `..`, a pointer into a file that is text
+3 -1
View File
@@ -14,7 +14,9 @@ agent's computer-use actions to it through three MCP tools:
The tools are MCP-only, like the debugger sessions: the computer lives as long
as the REA MCP server that started it, or until it is closed. Capturing the
app, exporting its bundle and witnessing the task on such a computer are in
[Building and witnessing an environment](desktop-build-witness.md).
[Building and witnessing an environment](desktop-build-witness.md), and REA's
skill for doing all of it from a request is
[desktop builds](https://github.com/morluto/rea/blob/main/.agents/skills/reverse-engineer-anything/references/desktop-build.md).
## Requirements
+17 -8
View File
@@ -18,6 +18,12 @@ grades the witness with the same checks the exported verifier runs.
Like the computer tools, these are MCP-only and act on a `computer_id` from
`start_build_computer`.
REA's skill walks an agent from a request such as "build me an Inkscape
environment where the agent changes a poster's headline" to a witnessed
bundle with these tools: the questions it asks first, when it stops for the
person, the install, the seed, the task, the witness and its final report.
See [desktop builds](https://github.com/morluto/rea/blob/main/.agents/skills/reverse-engineer-anything/references/desktop-build.md).
## Build
1. `start_build_computer` from a request. REA is installed in the computer.
@@ -137,14 +143,17 @@ SQLite file locked past the reader's wait, or because what it looks for may
lie in what its view cut, is `undecided` in its result: it shows nothing
about the task. That covers a line `lines_present` misses in a text view cut
at 5,000 lines, a row `row_present` misses in a table whose view keeps only
its first rows, a `value_equals` pointer that names nothing in a truncated
view or past a cut zip listing, and the absence checks and counts on a cut
view. A check that passes on what the view kept stays decided, and so does a
value found there that differs from the one expected. The result's `passed`
and description are the exported verifier's, which has no undecided results.
A stage that only undecided checks would settle, such as a near miss whose
one failing check could not read its file, files nothing and is refused;
check it again once the files read whole.
its first rows, a `value_equals` or text check pointer that names nothing
in a truncated view or past a cut zip listing, the absence checks and counts
on a cut view, and `text_equals` or `text_contains` of an element on one,
even where the element's kept text holds the value, since the cut may have
dropped text from between its runs. Any other check that passes on what the
view kept stays decided, and so does a value found there that differs from
the one expected.
The result's `passed` and description are the exported verifier's, which has
no undecided results. A stage that only undecided checks would settle, such
as a near miss whose one failing check could not read its file, files nothing
and is refused; check it again once the files read whole.
A stage whose checks do not show what it must ends the witness, and so does
`after_reset`. REA then ends the recording, fetches its segments through
+11 -2
View File
@@ -574,8 +574,17 @@ The raw Java `is_dead` flag can remain set after Ghidra decodes a live block;
`block_membership` reports actual syntax-tree membership separately.
The provider dossier itself retains up to 3,000 p-code operations, 64 inputs per
operation and 12,000 def-use edges, with explicit omitted counts. A `STORE`
may describe stack memory and does not itself prove persistent state.
operation and 12,000 def-use edges, with explicit omitted counts. Memory effects
cover high-p-code `LOAD` and `STORE` operations; direct memory address varnodes
in other operations are excluded, so an empty effect list does not establish
that the function accesses no memory. `procedure_references` can supply
complementary recorded instruction references, with its own coverage limits. A
`STORE` may describe stack memory and does not itself prove persistent state.
The Ghidra analysis profile commits to this effect scope. Snapshots from before
that commitment are rejected; analyze without the snapshot and save a fresh one.
To keep historical Evidence, copy the old snapshot's `evidence_bundle` object to
a separate JSON file and import that bundle. Import validates the Evidence; it
does not replay the old provider analysis.
Jump-table evidence keeps numeric `mappings`, explicit `default_targets`, and
backing `data_sources` separate. A null case value denotes an unresolved
@@ -94,11 +94,12 @@ and the recording and writes the record as Evidence.
want of a readable or whole view is `undecided` and proves nothing; a
stage only such checks would settle files nothing and can be checked
again. Undecided includes a failure to find a line, row or value that may
lie in what a cut view left out; a check that passes on what the view kept
stays decided. The export likewise keeps a task only when a check fails on
what the seed's view shows. The controller writes a folder's file list to a
file that REA reads through `data/get`, so a large bundle's list is not cut
at the 1 MiB of a command's output.
lie in what a cut view left out, and any text check of an element in a cut
view, which may have lost text from between the element's runs; any other
check that passes on what the view kept stays decided. The export likewise keeps a task only when a check
fails on what the seed's view shows. The controller writes a folder's file
list to a file that REA reads through `data/get`, so a large bundle's list
is not cut at the 1 MiB of a command's output.
- The witness reads the build computer's bounded action log: its stage rules
use the log's count and the last applied action of each kind, and the
record holds the entries the log keeps, `actions_dropped`, and a
@@ -55,9 +55,11 @@ verifier's, agree.
entry of another format; a value that is neither an element, a text node
(a string among an element's `children`) nor an attribute's value (one among
its `attributes`), so an element's `name` and the `doctype`'s fields fail;
and, as undecided, an element in a view that leaves something out, or a
selector searching an array such a view may cut. A text node is whole, so
it is decided on a truncated view.
and, as undecided, in a view that leaves something out, either check of an
element, even one whose kept text holds the value, since the cut may have
dropped text from between the runs it kept; a pointer naming nothing; or a
selector searching an array such a view may cut. A text node or an
attribute's value is whole, so it is decided on a truncated view.
- Refusals: the task parser refuses the empty pointer, a pointer not starting
with `/`, an empty `text_contains` value or one that is only whitespace
with `normalize_whitespace`, and a value that looks like a date and time,
+30 -20
View File
@@ -2,7 +2,7 @@ REA npm dependency inventory
Prepared from the root package-lock.json; refresh this inventory when locked dependencies change.
License identifiers are upstream lockfile declarations, not a legal assessment.
Runtime includes transitive and optional platform packages; development includes build, test and website tooling.
Locked package entries: 964; runtime: 181.
Locked package entries: 966; runtime: 175.
Full runtime copyright/license/NOTICE texts: npm-runtime-notices.txt.
@algolia/[email protected] | development | MIT
@@ -395,12 +395,12 @@ [email protected] | development | MIT
Package: https://www.npmjs.com/package/@docsearch/react/v/3.8.2
Archive: https://registry.npmjs.org/@docsearch/react/-/react-3.8.2.tgz
Integrity: sha512-xCRrJQlTt8N9GU0DG4ptwHRkfnSnD/YpdeaXe02iKfqs97TkZJv60yE+1eq/tjPcVnTW8dP5qLP7itifFVV5eg==
@electron/[email protected] | runtime | MIT
@electron/[email protected] | development | MIT
Lockfile path: node_modules/@electron/asar
Package: https://www.npmjs.com/package/@electron/asar/v/4.2.0
Archive: https://registry.npmjs.org/@electron/asar/-/asar-4.2.0.tgz
Integrity: sha512-npW1NW5yy8EB9XY/vEw9sUdgmq0sJEhmSBb6bqyFOAw1CSkrhvAvO6QWlW8CdIMo8VN1lkdF345l/MeW0LrY0Q==
[email protected] | runtime | MIT
[email protected] | development | MIT
Lockfile path: node_modules/@electron/asar/node_modules/commander
Package: https://www.npmjs.com/package/commander/v/13.1.0
Archive: https://registry.npmjs.org/commander/-/commander-13.1.0.tgz
@@ -655,6 +655,11 @@ [email protected] | runtime | MIT
Package: https://www.npmjs.com/package/@inquirer/type/v/4.2.0
Archive: https://registry.npmjs.org/@inquirer/type/-/type-4.2.0.tgz
Integrity: sha512-2rnHX8RPo4glJYqnFc/v3nQeIhDcjyRRyaT7MGcfL/8xv/8K03SXYoA2tX06WVSKywWOE/ncbG3dtuzLjR5TCQ==
@isaacs/[email protected] | development | BlueOak-1.0.0
Lockfile path: node_modules/@isaacs/nonrecursive-glob-match
Package: https://www.npmjs.com/package/@isaacs/nonrecursive-glob-match/v/1.1.0
Archive: https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz
Integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==
@jridgewell/[email protected] | development | MIT
Lockfile path: node_modules/@jridgewell/gen-mapping
Package: https://www.npmjs.com/package/@jridgewell/gen-mapping/v/0.4.0-beta.0
@@ -2815,11 +2820,16 @@ [email protected] | runtime, optional | MIT
Package: https://www.npmjs.com/package/github-from-package/v/0.0.0
Archive: https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz
Integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==
glob@13.0.6 | runtime | BlueOak-1.0.0
glob@14.0.4 | development | BlueOak-1.0.0
Lockfile path: node_modules/glob
Package: https://www.npmjs.com/package/glob/v/13.0.6
Archive: https://registry.npmjs.org/glob/-/glob-13.0.6.tgz
Integrity: sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==
Package: https://www.npmjs.com/package/glob/v/14.0.4
Archive: https://registry.npmjs.org/glob/-/glob-14.0.4.tgz
Integrity: sha512-mMiwNKoJZ4HAIRVJxotO6LsNRReA30gQwP9E2/p94tfLv+jygCNpKDjhhSL6OLY6LE371EZm5EAf7RpYuUqlsw==
[email protected] | development | BlueOak-1.0.0
Lockfile path: node_modules/glob/node_modules/minimatch
Package: https://www.npmjs.com/package/minimatch/v/11.0.5
Archive: https://registry.npmjs.org/minimatch/-/minimatch-11.0.5.tgz
Integrity: sha512-snPlVppFcYWfLLFQGhDxUyBcHNtMlWmn3jtj7pEaO+DP8pqL0IvAzXhMYmn1z9ASNtgmwLBdFxSf4tMUB0OTKA==
[email protected] | runtime | MIT
Lockfile path: node_modules/gopd
Package: https://www.npmjs.com/package/gopd/v/1.2.0
@@ -3275,11 +3285,11 @@ [email protected] | runtime | MIT
Package: https://www.npmjs.com/package/lossless-json/v/4.3.1
Archive: https://registry.npmjs.org/lossless-json/-/lossless-json-4.3.1.tgz
Integrity: sha512-SqD/Bg3ZfltBJ2Z14hJ/BihnvtV553WO4g9/ePtlp4lrnl9jF3AdIJt53A/Wkg/0Li+LMfxaBqgx1MiFZdQlpQ==
[email protected].2 | runtime | BlueOak-1.0.0
[email protected].3 | development | BlueOak-1.0.0
Lockfile path: node_modules/lru-cache
Package: https://www.npmjs.com/package/lru-cache/v/11.5.2
Archive: https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz
Integrity: sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==
Package: https://www.npmjs.com/package/lru-cache/v/11.5.3
Archive: https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz
Integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==
[email protected] | development | MIT
Lockfile path: node_modules/magic-string
Package: https://www.npmjs.com/package/magic-string/v/1.4.3
@@ -3410,7 +3420,7 @@ [email protected] | runtime | MIT
Package: https://www.npmjs.com/package/minimisted/v/2.0.1
Archive: https://registry.npmjs.org/minimisted/-/minimisted-2.0.1.tgz
Integrity: sha512-1oPjfuLQa2caorJUM8HV8lGgWCc0qqAO1MNv/k05G4qslmsndV/5WdNZrqCiyqiz3wohia2Ij2B7w2Dr7/IyrA==
[email protected] | runtime | BlueOak-1.0.0
[email protected] | development | BlueOak-1.0.0
Lockfile path: node_modules/minipass
Package: https://www.npmjs.com/package/minipass/v/7.1.3
Archive: https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz
@@ -3670,11 +3680,11 @@ [email protected] | development | MIT
Package: https://www.npmjs.com/package/path-parse/v/1.0.7
Archive: https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz
Integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
path-scurry@2.0.2 | runtime | BlueOak-1.0.0
path-scurry@3.0.0 | development | BlueOak-1.0.0
Lockfile path: node_modules/path-scurry
Package: https://www.npmjs.com/package/path-scurry/v/2.0.2
Archive: https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz
Integrity: sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==
Package: https://www.npmjs.com/package/path-scurry/v/3.0.0
Archive: https://registry.npmjs.org/path-scurry/-/path-scurry-3.0.0.tgz
Integrity: sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==
[email protected] | development | MIT
Lockfile path: node_modules/perfect-debounce
Package: https://www.npmjs.com/package/perfect-debounce/v/1.0.0
@@ -4670,11 +4680,11 @@ [email protected] | development | MIT
Package: https://www.npmjs.com/package/esbuild/v/0.25.12
Archive: https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz
Integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==
[email protected].4 | development | MIT
[email protected].5 | development | MIT
Lockfile path: node_modules/vitepress/node_modules/vite
Package: https://www.npmjs.com/package/vite/v/6.4.4
Archive: https://registry.npmjs.org/vite/-/vite-6.4.4.tgz
Integrity: sha512-xGjU/SyjeNyb0E4KxXBvYz/1C+3JXuujvf2hXNOtnlcE+58o5ajd9N2/n2VhkiJvpCP2qQasnUpx5PXNeI+p1Q==
Package: https://www.npmjs.com/package/vite/v/6.4.5
Archive: https://registry.npmjs.org/vite/-/vite-6.4.5.tgz
Integrity: sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==
[email protected] | development | MIT
Lockfile path: node_modules/vitest
Package: https://www.npmjs.com/package/vitest/v/5.0.3
+1 -331
View File
@@ -1,7 +1,7 @@
REA third-party npm runtime copyright, license and NOTICE texts
Collected from integrity-verified locked npm archives. Release-specific supplements and upstream notice gaps are identified in their entries.
External engines are separately obtained; see THIRD_PARTY_NOTICES.md.
Runtime dependency fingerprint (SHA-256): 13e2e43ee348b0cc210699dff53278d47e9e94c65934796c82eabc912f7c3938
Runtime dependency fingerprint (SHA-256): 0119b7e66d63524f25c35f294b3264a901b764282b7d3bd1d0b493a9143498d0
===== @babel/[email protected] =====
Declared license: MIT
@@ -443,68 +443,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @electron/[email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/@electron/asar/-/asar-4.2.0.tgz
Integrity: sha512-npW1NW5yy8EB9XY/vEw9sUdgmq0sJEhmSBb6bqyFOAw1CSkrhvAvO6QWlW8CdIMo8VN1lkdF345l/MeW0LrY0Q==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE.md ---
Copyright (c) 2014 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===== [email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/commander/-/commander-13.1.0.tgz
Integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE ---
(The MIT License)
Copyright (c) 2011 TJ Holowaychuk <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===== @jridgewell/[email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz
@@ -4122,79 +4060,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===== [email protected] =====
Declared license: BlueOak-1.0.0
Archive: https://registry.npmjs.org/glob/-/glob-13.0.6.tgz
Integrity: sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE.md ---
All packages under `src/` are licensed according to the terms in
their respective `LICENSE` or `LICENSE.md` files.
The remainder of this project is licensed under the Blue Oak
Model License, as follows:
-----
# Blue Oak Model License
Version 1.0.0
## Purpose
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
===== [email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz
@@ -5100,71 +4965,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===== [email protected] =====
Declared license: BlueOak-1.0.0
Archive: https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz
Integrity: sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE.md ---
# Blue Oak Model License
Version 1.0.0
## Purpose
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
===== [email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz
@@ -5342,71 +5142,6 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTI
USE OR OTHER DEALINGS IN THE SOFTWARE.
===== [email protected] =====
Declared license: BlueOak-1.0.0
Archive: https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz
Integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE.md ---
# Blue Oak Model License
Version 1.0.0
## Purpose
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
===== [email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz
@@ -5737,71 +5472,6 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
===== [email protected] =====
Declared license: BlueOak-1.0.0
Archive: https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz
Integrity: sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==
Scope: npm runtime dependency, including optional platform packages.
--- package/LICENSE.md ---
# Blue Oak Model License
Version 1.0.0
## Purpose
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
===== [email protected] =====
Declared license: MIT
Archive: https://registry.npmjs.org/pify/-/pify-4.0.1.tgz
+48 -15
View File
@@ -13,7 +13,6 @@
"@babel/types": "8.0.4",
"@bufbuild/protobuf": "2.16.0",
"@clack/prompts": "1.7.0",
"@electron/asar": "4.2.0",
"@jridgewell/trace-mapping": "0.3.31",
"@lydell/node-pty": "1.1.0",
"@modelcontextprotocol/client": "2.3.1",
@@ -58,6 +57,7 @@
"rea-agents": "scripts/rea.mjs"
},
"devDependencies": {
"@electron/asar": "4.2.0",
"@fast-check/vitest": "0.5.0",
"@stryker-mutator/core": "10.0.0",
"@stryker-mutator/typescript-checker": "10.0.0",
@@ -1252,6 +1252,7 @@
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@electron/asar/-/asar-4.2.0.tgz",
"integrity": "sha512-npW1NW5yy8EB9XY/vEw9sUdgmq0sJEhmSBb6bqyFOAw1CSkrhvAvO6QWlW8CdIMo8VN1lkdF345l/MeW0LrY0Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"commander": "^13.1.0",
@@ -1269,6 +1270,7 @@
"version": "13.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz",
"integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
@@ -2155,6 +2157,13 @@
}
}
},
"node_modules/@isaacs/nonrecursive-glob-match": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.4.0-beta.0",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.4.0-beta.0.tgz",
@@ -6215,6 +6224,7 @@
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
"integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
"devOptional": true,
"license": "MIT",
"engines": {
"node": "18 || 20 || >=22"
@@ -6343,6 +6353,7 @@
"version": "5.0.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
"integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
"devOptional": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^4.0.2"
@@ -8081,14 +8092,15 @@
"optional": true
},
"node_modules/glob": {
"version": "13.0.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz",
"integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==",
"version": "14.0.4",
"resolved": "https://registry.npmjs.org/glob/-/glob-14.0.4.tgz",
"integrity": "sha512-mMiwNKoJZ4HAIRVJxotO6LsNRReA30gQwP9E2/p94tfLv+jygCNpKDjhhSL6OLY6LE371EZm5EAf7RpYuUqlsw==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"minimatch": "^10.2.2",
"minimatch": "^11.0.5",
"minipass": "^7.1.3",
"path-scurry": "^2.0.2"
"path-scurry": "^3.0.0"
},
"engines": {
"node": "18 || 20 || >=22"
@@ -8097,6 +8109,23 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob/node_modules/minimatch": {
"version": "11.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.5.tgz",
"integrity": "sha512-snPlVppFcYWfLLFQGhDxUyBcHNtMlWmn3jtj7pEaO+DP8pqL0IvAzXhMYmn1z9ASNtgmwLBdFxSf4tMUB0OTKA==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"@isaacs/nonrecursive-glob-match": "^1.1.0",
"brace-expansion": "^5.0.12"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
@@ -9379,9 +9408,10 @@
"license": "MIT"
},
"node_modules/lru-cache": {
"version": "11.5.2",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz",
"integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==",
"version": "11.5.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz",
"integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==",
"dev": true,
"license": "BlueOak-1.0.0",
"engines": {
"node": "20 || >=22"
@@ -9689,6 +9719,7 @@
"version": "10.2.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
"integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
"devOptional": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.5"
@@ -9747,6 +9778,7 @@
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
"integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
"dev": true,
"license": "BlueOak-1.0.0",
"engines": {
"node": ">=16 || 14 >=14.17"
@@ -10442,9 +10474,10 @@
"license": "MIT"
},
"node_modules/path-scurry": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
"integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-3.0.0.tgz",
"integrity": "sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"lru-cache": "^11.0.0",
@@ -13434,9 +13467,9 @@
}
},
"node_modules/vitepress/node_modules/vite": {
"version": "6.4.4",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.4.tgz",
"integrity": "sha512-xGjU/SyjeNyb0E4KxXBvYz/1C+3JXuujvf2hXNOtnlcE+58o5ajd9N2/n2VhkiJvpCP2qQasnUpx5PXNeI+p1Q==",
"version": "6.4.5",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz",
"integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==",
"dev": true,
"license": "MIT",
"dependencies": {
+5 -2
View File
@@ -361,7 +361,6 @@
"@babel/types": "8.0.4",
"@bufbuild/protobuf": "2.16.0",
"@clack/prompts": "1.7.0",
"@electron/asar": "4.2.0",
"@jridgewell/trace-mapping": "0.3.31",
"@lydell/node-pty": "1.1.0",
"@modelcontextprotocol/client": "2.3.1",
@@ -402,14 +401,18 @@
"zod": "4.6.6"
},
"overrides": {
"@electron/asar": {
"glob": "14.0.4"
},
"typed-rest-client": {
"qs": "6.16.1"
},
"vitepress": {
"vite": "6.4.4"
"vite": "6.4.5"
}
},
"devDependencies": {
"@electron/asar": "4.2.0",
"@fast-check/vitest": "0.5.0",
"@stryker-mutator/core": "10.0.0",
"@stryker-mutator/typescript-checker": "10.0.0",
-2
View File
@@ -98,8 +98,6 @@ const PATH_SCOPES = {
"tests/boundary/providers/GdbCommandQueue.test.ts",
"tests/boundary/providers/gdbTestHelpers.ts",
"tests/boundary/providers/RizinDebugSessionCoverage.part*.test.ts",
"tests/boundary/providers/RizinCommandTimeout.test.ts",
"tests/boundary/providers/RizinTimeoutEvidence.test.ts",
"tests/boundary/providers/RizinDebugSession*.test.ts",
"tests/boundary/providers/RizinInferiorTty.test.ts",
"tests/boundary/providers/RizinDecoderInputs.test.ts",
@@ -0,0 +1,123 @@
import assert from "node:assert/strict";
import { randomUUID } from "node:crypto";
import { readFile, rm, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { parseBinaryTarget } from "../../dist/application/BinaryTargetResolver.js";
import { createAnalysisProfile } from "../../dist/domain/analysisProfile.js";
import {
createAnalysisSnapshotEntry,
parseAnalysisSnapshot,
serializeAnalysisSnapshot,
snapshotBinding,
snapshotTarget,
} from "../../dist/domain/analysisSnapshot.js";
import { createEvidence } from "../../dist/domain/evidence.js";
import { createEvidenceBundle } from "../../dist/domain/evidenceBundle.js";
import {
requireMcpLifecycleResult,
requireMcpOutput,
requireMcpToolError,
} from "./mcp-verifier-results.mjs";
/** A pre-scope dossier must not be replayed into a newly qualified trace. */
export async function verifyLegacyValueScopeSnapshot(
client,
{ target, procedure, observed, env },
) {
const { value_flow_effect_scope: scope, ...legacyParameters } =
observed.analysis_profile.parameters;
const legacyProfile = createAnalysisProfile(
observed.provider,
legacyParameters,
);
const parsed = await parseBinaryTarget(target.path, {
cwd: process.cwd(),
hostArchitecture: process.arch,
});
if (!parsed.ok) throw parsed.error;
const nativeTarget = parsed.value;
const result = structuredClone(observed.normalized_result);
const flow = result.native_value_flow;
assert.equal(flow.available, true);
const describesScope = (value) =>
value.includes("LOAD and STORE") && value.includes("address varnodes");
assert.ok(flow.limitations.some(describesScope));
flow.limitations = flow.limitations.filter((value) => !describesScope(value));
const evidence = createEvidence(nativeTarget, observed.provider, {
operation: observed.operation,
parameters: observed.parameters,
result,
rawResult: result,
analysisProfile: legacyProfile,
limitations: observed.limitations,
locations: observed.locations,
});
const binding = snapshotBinding(legacyProfile);
const identity = snapshotTarget(nativeTarget);
const snapshot = parseAnalysisSnapshot({
target: identity,
binding,
entries: [
createAnalysisSnapshotEntry({
target: identity,
binding,
operation: observed.operation,
parameters: observed.parameters,
execution: {
result,
rawResult: result,
provider: observed.provider,
analysisProfile: legacyProfile,
limitations: observed.limitations,
locations: observed.locations,
subject: nativeTarget,
},
}),
],
workflow_entries: [],
evidence_bundle: createEvidenceBundle([evidence]),
});
const path = join(env.TMPDIR, `legacy-value-scope-${randomUUID()}.json`);
await writeFile(path, serializeAnalysisSnapshot(snapshot), { flag: "wx" });
try {
const bytes = await readFile(path);
const session = requireMcpLifecycleResult(
await client.callTool({ name: "binary_session", arguments: {} }),
"binary_session",
);
const reply = await client.callTool({
name: "open_binary",
arguments: {
path: target.path,
provider_id: "ghidra",
snapshot_path: path,
},
});
assert.equal(reply.isError, true);
assert.equal(scope, "pcode-load-store-explicit-v1");
const error = requireMcpToolError(reply);
assert.equal(error.code, "evidence_integrity_mismatch");
assert.deepEqual(error.details.binding_mismatch.profile_digest, {
snapshot: legacyProfile.digest,
selected: observed.analysis_profile.digest,
});
assert.deepEqual(
requireMcpLifecycleResult(
await client.callTool({ name: "binary_session", arguments: {} }),
"binary_session",
),
session,
);
const fresh = await client.callTool(
{ name: "trace_native_values", arguments: { procedure, max_depth: 0 } },
{ timeout: 180000 },
);
assert.notEqual(fresh.isError, true, JSON.stringify(fresh));
const trace = requireMcpOutput(fresh, "trace_native_values");
assert.ok(trace.normalized_result.limitations.some(describesScope));
assert.deepEqual(await readFile(path), bytes);
} finally {
await rm(path);
}
}
+35
View File
@@ -17,6 +17,7 @@ import {
requireMcpOutput,
} from "./mcp-verifier-results.mjs";
import { verifyGhidraBoundaries } from "./real-ghidra-boundaries.mjs";
import { verifyLegacyValueScopeSnapshot } from "./ghidra-value-scope-snapshot-e2e.mjs";
import { verifyGhidraProjectIdentity } from "./real-ghidra-project-identity.mjs";
import { verifyGhidraSocketBoundary } from "./real-ghidra-socket-boundary.mjs";
@@ -214,6 +215,14 @@ async function verifyNativeValueAdapters(
procedure,
globalAddress,
);
assert.ok(
mcpGraph.limitations.some(
(value) =>
value.includes("analyze_function") &&
value.includes("LOAD and STORE") &&
value.includes("address varnodes"),
),
);
assert.deepEqual(mcpEvidence.normalized_result, mcpGraph);
assert.deepEqual(mcpGraph, cliGraph);
const warmReply = await client.callTool(
@@ -243,6 +252,26 @@ async function verifyNativeValueAdapters(
);
assert.equal(functionEvidence.operation, "analyze_function");
assert.equal(functionEvidence.provider.id, "ghidra");
const flow = functionEvidence.normalized_result.native_value_flow;
assert.equal(flow.available, true);
const identifiesEffectScope = (value) =>
value.includes("LOAD and STORE") && value.includes("address varnodes");
assert.ok(flow.limitations.some(identifiesEffectScope));
const effectsView = await client.callTool({
name: "inspect_analysis_view",
arguments: {
source: {
kind: "retained-evidence",
evidence_id: functionEvidence.evidence_id,
},
view: { kind: "native", facet: "value_flow_effects" },
},
});
assert.notEqual(effectsView.isError, true, JSON.stringify(effectsView));
const effectsPage = requireMcpOutput(effectsView, "inspect_analysis_view");
assert.ok(
effectsPage.normalized_result.limitations.some(identifiesEffectScope),
);
assert.deepEqual(
functionEvidence.normalized_result.facet_availability,
Object.fromEntries(
@@ -268,6 +297,12 @@ async function verifyNativeValueAdapters(
functionEvidence.analysis_profile,
);
assert.deepEqual(functionProfile, upstreamProfile);
await verifyLegacyValueScopeSnapshot(client, {
target,
procedure,
observed: functionEvidence,
env,
});
const comparisonEvidence = await compareRetainedFunctionEvidence(
client,
functionEvidence,
+2 -2
View File
@@ -32,9 +32,9 @@ const VERSION_TIMEOUT_MS = 10_000;
const ADB_VERSION_REMEDIATION = `Set ${ADB_BINARY_ENV} to an Android SDK Platform-Tools adb binary whose \`adb version\` reports its version, or put one on PATH.`;
/** Repair when the selected adb binary does not exist. */
export const ADB_MISSING_REMEDIATION = `Set ${ADB_BINARY_ENV} to an absolute path to an existing adb binary.`;
const ADB_MISSING_REMEDIATION = `Set ${ADB_BINARY_ENV} to an absolute path to an existing adb binary.`;
/** Repair when execution of the adb binary selected by the environment is denied. */
export const ADB_NOT_EXECUTABLE_REMEDIATION = `Set ${ADB_BINARY_ENV} to an absolute path to the adb executable file, not a directory, and check execute permission on it and search permission on its parent directories.`;
const ADB_NOT_EXECUTABLE_REMEDIATION = `Set ${ADB_BINARY_ENV} to an absolute path to the adb executable file, not a directory, and check execute permission on it and search permission on its parent directories.`;
const VERSION_MAX_OUTPUT_BYTES = 64 * 1024;
/** How the adb binary was selected for this provider instance. */
+7 -5
View File
@@ -31,9 +31,11 @@ const provider = () =>
environment: { REA_APKTOOL_COMMAND: "/authored/apktool" },
});
const version = {
stdout: { text: "2.9.3\n" },
stderr: { text: "" },
} as Awaited<ReturnType<typeof runOwnedCommand>>;
stdout: { text: "2.9.3\n", bytes: 6, observedBytes: 6 },
stderr: { text: "", bytes: 0, observedBytes: 0 },
exitCode: 0,
signal: null,
};
const inspect = (client: ApktoolProvider, signal?: AbortSignal) =>
client.execute(
{ operation: "inspect_apktool_client", input: {} },
@@ -255,8 +257,8 @@ it("attributes prerequisite cleanup to decode and preserves its live recovery",
try {
const result = await client.execute({
operation: "decode_android_resources",
input: {},
} as never);
input: { path: "/fixture/input.apk", include_strings: false },
});
if (result.ok) throw new Error("Expected prerequisite failure");
expect(result.error).toMatchObject({
operation: "decode_android_resources",
+2 -2
View File
@@ -48,9 +48,9 @@ const apktoolVersionProbeTimeoutGuidance = (): {
const APKTOOL_VERSION_REMEDIATION = `Set ${APKTOOL_COMMAND_ENV} to an Apktool 2.7.0 or newer launcher whose --version prints its version, or put one on PATH.`;
/** Repair when the selected apktool launcher does not exist. */
export const APKTOOL_MISSING_REMEDIATION = `Set ${APKTOOL_COMMAND_ENV} to an absolute apktool launcher (the upstream wrapper or a java -jar script).`;
const APKTOOL_MISSING_REMEDIATION = `Set ${APKTOOL_COMMAND_ENV} to an absolute apktool launcher (the upstream wrapper or a java -jar script).`;
/** Repair when execution of the selected apktool launcher is denied. */
export const APKTOOL_NOT_EXECUTABLE_REMEDIATION = `Check file type and execute permission for ${APKTOOL_COMMAND_ENV} or select an executable apktool launcher.`;
const APKTOOL_NOT_EXECUTABLE_REMEDIATION = `Check file type and execute permission for ${APKTOOL_COMMAND_ENV} or select an executable apktool launcher.`;
/** How the apktool launcher was selected for this provider instance. */
export interface ApktoolCommandSelection {
+9 -5
View File
@@ -49,11 +49,15 @@ afterEach(() => {
vi.mocked(runOwnedCommand).mockReset();
});
const completed = (text: string): ProviderProcessSnapshot =>
({
stdout: { text },
stderr: { text: "" },
}) as ProviderProcessSnapshot;
const completed = (text: string): ProviderProcessSnapshot => {
const bytes = Buffer.byteLength(text);
return {
stdout: { text, bytes, observedBytes: bytes },
stderr: { text: "", bytes: 0, observedBytes: 0 },
exitCode: 0,
signal: null,
};
};
const installLauncher = (): void => {
vi.mocked(runOwnedCommand).mockImplementation(async (spawn, limits) => {
+10 -9
View File
@@ -1555,12 +1555,12 @@ it("discloses qualified and unfamiliar strings tables while preserving exact loc
locale: locale ?? null,
coverage: "complete",
});
expect(result.value.limitations).toContain(
`Other strings tables are not selected by locale; their resource configuration suffixes are preserved without inferring Android runtime matching: ${tables
.map((suffix) => JSON.stringify(`values-${suffix}`))
.sort()
.join(", ")}`,
const otherTables = result.value.limitations.find((line) =>
line.includes("values-unknown_CONFIGURATION"),
);
expect(otherTables).toMatch(/without inferring.*runtime matching/iu);
for (const suffix of tables)
expect(otherTables).toContain(JSON.stringify(`values-${suffix}`));
if (locale === undefined)
expect(result.value.result).toMatchObject({
strings: [
@@ -1570,8 +1570,8 @@ it("discloses qualified and unfamiliar strings tables while preserving exact loc
});
else if (locale === "en-rUS") {
expect(result.value.result).toMatchObject({ strings: [] });
expect(result.value.limitations).toContain(
"No strings.xml was found for locale en-rUS",
expect(result.value.limitations).toContainEqual(
expect.stringMatching(/strings\.xml.*locale en-rUS/iu),
);
} else
expect(result.value.result).toMatchObject({
@@ -1691,8 +1691,9 @@ it.each([
});
const limitations = result.value.limitations.join("\n");
if (kind === "unsupported") {
expect(limitations).toContain(
"String entries omitted due to unsupported markup or missing names: 2",
expect(limitations).toMatch(/omitted[^\n]*2/iu);
expect(limitations).toMatch(
/omitted.*unsupported markup.*missing names/iu,
);
expect(limitations).not.toContain("entry counts are unknown");
} else {
+12 -8
View File
@@ -36,9 +36,11 @@ const owner = {
it("runs the version probe as an owned interpreter-script process group", async () => {
vi.mocked(runOwnedCommand).mockImplementationOnce(async (_spawn, limits) => {
const output = {
stdout: { text: "2.9.3\n" },
stderr: { text: "" },
} as Awaited<ReturnType<typeof runOwnedCommand>>;
stdout: { text: "2.9.3\n", bytes: 6, observedBytes: 6 },
stderr: { text: "", bytes: 0, observedBytes: 0 },
exitCode: 0,
signal: null,
};
limits.observeCompleted?.(output);
return output;
});
@@ -152,8 +154,8 @@ it("keeps unresolved probe cleanup typed when the launcher overflows its output"
vi.mocked(runOwnedCommand).mockRejectedValueOnce(overflow());
const result = await provider.execute({
operation: "decode_android_resources",
input: {},
} as never);
input: { path: "/fixture/input.apk", include_strings: false },
});
expect(result.ok ? null : result.error.cleanupIncomplete).toBe(true);
expect(result.ok ? null : projectAnalysisError(result.error)).toMatchObject({
code: "cleanup_incomplete",
@@ -169,9 +171,11 @@ it.each(["linux", "win32"] as const)(
vi.mocked(runOwnedCommand).mockImplementationOnce(
async (_spawn, limits) => {
const output = {
stdout: { text: "2.9.2\n" },
stderr: { text: "" },
} as Awaited<ReturnType<typeof runOwnedCommand>>;
stdout: { text: "2.9.2\n", bytes: 6, observedBytes: 6 },
stderr: { text: "", bytes: 0, observedBytes: 0 },
exitCode: 0,
signal: null,
};
limits.observeCompleted?.(output);
return output;
},
@@ -3,7 +3,6 @@ import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { plistNestingLimitMessage } from "../domain/apple/plistValue.js";
import { resolveAppBundleExecutable } from "./AppBundleExecutable.js";
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
@@ -34,7 +33,7 @@ describe("OpenStep Info.plist nesting during app target resolution", () => {
error: {
path: join(app, "Contents", "Info.plist"),
cause: expect.objectContaining({
message: plistNestingLimitMessage(),
message: expect.stringMatching(/128 nesting levels/iu),
}),
},
});
@@ -18,7 +18,7 @@ import {
expectKeptPartial,
expectOutputError,
expectOwnerError,
} from "./ownerObservationExpectation.fixture.js";
} from "../../tests/fixtures/ownerObservationExpectation.js";
import { BrowserObservationError } from "../domain/browserObservationError.js";
import { err, ok } from "../domain/result.js";
import { passiveNetworkCapture } from "../../tests/fixtures/passiveNetworkCapture.js";
@@ -20,7 +20,7 @@ import {
expectDroppedPartial,
expectKeptPartial,
expectOwnerError,
} from "./ownerObservationExpectation.fixture.js";
} from "../../tests/fixtures/ownerObservationExpectation.js";
const scenario = browserScenarioInputSchema.parse({
browser: { mode: "launch", executable_path: "/fixture/chrome" },
+11 -4
View File
@@ -698,8 +698,7 @@ describe("partial navigation availability", () => {
expect(availability).toMatchObject({
reason: "provider_missing",
remediation:
"Configure a provider for one of: current_document, current_address, resolve_containing_procedure.",
remediation: expect.stringMatching(/configure.*provider/i),
modes: [
{
name: "current_selection",
@@ -718,6 +717,13 @@ describe("partial navigation availability", () => {
},
],
});
for (const operation of [
"current_document",
"current_address",
"resolve_containing_procedure",
]) {
expect(availability.remediation?.split(operation)).toHaveLength(2);
}
});
});
@@ -820,8 +826,9 @@ describe("binary_overview capability requirements", () => {
).toMatchObject({
available: false,
reason: "provider_missing",
remediation:
"Configure a provider for one of: current_document, list_documents.",
remediation: expect.stringMatching(
/configure.*provider.*current_document.*list_documents/i,
),
});
});
@@ -1,34 +1,32 @@
import { describe, expect, it } from "vitest";
import {
ClientConfigurationShapeError,
parseClientConfiguration,
shadowedClientServers,
} from "./ClientConfigurationDocument.js";
describe("parseClientConfiguration shape diagnostics", () => {
it.each([
["null", "null"],
["array", "[]"],
["string", '"x"'],
] as const)("names a non-object JSON root (%s)", (_label, text) => {
expect(() => parseClientConfiguration(text, "json")).toThrow(
new TypeError("The configuration root must be an object"),
);
["null root", "null", "root"],
["array root", "[]", "root"],
["string root", '"x"', "root"],
["null server table", '{"mcpServers":null,"keep":1}', "mcpServers"],
["array server table", '{"mcpServers":[],"keep":1}', "mcpServers"],
["string server table", '{"mcpServers":"x","keep":1}', "mcpServers"],
])("reports a non-object %s", (_label, text, location) => {
let error: unknown;
try {
parseClientConfiguration(text, "json");
} catch (cause: unknown) {
error = cause;
}
expect(error).toBeInstanceOf(ClientConfigurationShapeError);
if (!(error instanceof Error)) throw new Error("Expected shape error");
expect(error.message).toContain(location);
expect(error.message).toContain("object");
});
it.each([
["null", "null"],
["array", "[]"],
["string", '"x"'],
] as const)(
'names a non-object "mcpServers" value (%s)',
(_label, servers) => {
expect(() =>
parseClientConfiguration(`{"mcpServers":${servers},"keep":1}`, "json"),
).toThrow(new TypeError('"mcpServers" must be an object'));
},
);
it("still rejects unparsable JSON with SyntaxError", () => {
expect(() => parseClientConfiguration("not-json", "json")).toThrow(
SyntaxError,
+13 -10
View File
@@ -255,8 +255,9 @@ describe("doctor native analysis configuration", () => {
expect.objectContaining({
name: "hopper-startup-timeout",
ok: false,
detail:
"REA_HOPPER_STARTUP_TIMEOUT_MS: must be a positive decimal integer",
detail: expect.stringMatching(
/REA_HOPPER_STARTUP_TIMEOUT_MS.*positive decimal integer/i,
),
}),
);
expect(result.scope_checks).toContainEqual(
@@ -650,8 +651,9 @@ describe("doctor", () => {
ok: false,
classification: "config_drift",
detail: "/missing/ilspycmd",
remediation:
"Unset REA_ILSPY_CMD_PATH or point it at a runnable ilspycmd executable.",
remediation: expect.stringMatching(
/REA_ILSPY_CMD_PATH.*runnable ilspycmd/i,
),
});
});
@@ -669,8 +671,9 @@ describe("doctor", () => {
ok: false,
classification: "config_drift",
detail: configuredPath,
remediation:
"Unset or update HOPPER_LAUNCHER_PATH to an executable Hopper launcher.",
remediation: expect.stringMatching(
/HOPPER_LAUNCHER_PATH.*executable Hopper launcher/i,
),
});
});
});
@@ -738,7 +741,7 @@ describe("doctor installation identity", () => {
skill: {
installed_version: "10",
state: "stale",
remediation: "Run rea setup to update the installed REA skill.",
remediation: expect.stringMatching(/rea setup.*update.*skill/i),
},
});
});
@@ -751,14 +754,14 @@ describe("doctor installation identity", () => {
expect(result.healthy).toBe(false);
expect(result.identity?.skill).toMatchObject({
state: "missing",
remediation: "Run rea setup to update the installed REA skill.",
remediation: expect.stringMatching(/rea setup.*update.*skill/i),
});
expect(result.checks).toContainEqual({
name: "skill:identity",
ok: false,
classification: "config_drift",
detail: "Installed REA skill identity is missing.",
remediation: "Run rea setup to update the installed REA skill.",
detail: expect.stringMatching(/skill identity.*missing/i),
remediation: result.identity?.skill.remediation,
});
});
it("classifies an unreadable installed skill as unknown, not drift", async () => {
+21 -22
View File
@@ -10,8 +10,6 @@ import {
} from "./HopperDownload.js";
import {
installMacHopper,
macHopperHostVersionDetail,
macHopperIncomparableMinimumDetail,
type MacHopperBundleVerification,
type MacHopperBundleInstallResult,
type MacHopperInstallHost,
@@ -309,17 +307,19 @@ describe("macOS Hopper release host requirements", () => {
host.feedBytes = macFeed(host, { deployment_target: "12.4" });
const result = await installMacHopper({}, host);
expect(result).toEqual({
expect(result).toMatchObject({
status: "failed",
reason: "incompatible_host_version",
diagnostic: macHopperHostVersionDetail({
source: "release_feed",
packageUrl: PACKAGE_URL,
minimumVersion: "12.4",
hostVersion,
}),
});
expectNamed(result, [PACKAGE_URL, "12.4", hostVersion]);
expectNamed(result, [
PACKAGE_URL,
"12.4",
hostVersion,
"deployment_target",
]);
if (result.status !== "failed")
throw new Error("Expected version refusal");
expect(result.diagnostic).toMatch(/not downloaded/i);
expect(host.packageDownloads).toBe(0);
expect(host.mounts).toBe(0);
expect(host.installs).toBe(0);
@@ -353,16 +353,14 @@ describe("macOS Hopper release host requirements", () => {
host.feedBytes = macFeed(host, fields);
const result = await installMacHopper({}, host);
expect(result).toEqual({
expect(result).toMatchObject({
status: "failed",
reason: "incompatible_host_version",
diagnostic: macHopperHostVersionDetail({
source: "signed_app",
minimumVersion: "12.4",
hostVersion: "12.0",
}),
});
expectNamed(result, ["LSMinimumSystemVersion", "12.4", "12.0"]);
if (result.status !== "failed")
throw new Error("Expected version refusal");
expect(result.diagnostic).toMatch(/nothing was copied/i);
expect(host.packageDownloads).toBe(1);
expect(host.installs).toBe(0);
expect(host.opens).toBe(0);
@@ -400,12 +398,13 @@ describe("macOS Hopper release host requirements", () => {
host.appMinimum = "12.x";
const result = await installMacHopper({}, host);
expect(result).toEqual({
status: "failed",
reason: "bundle",
diagnostic: macHopperIncomparableMinimumDetail("12.x", "14.5"),
});
expectNamed(result, ['"12.x"', "14.5"]);
expect(result).toMatchObject({ status: "failed", reason: "bundle" });
if (result.status !== "failed") throw new Error("Expected bundle failure");
expect(result.diagnostic).toContain("LSMinimumSystemVersion");
expect(result.diagnostic).toContain("12.x");
expect(result.diagnostic).toContain("14.5");
expect(result.diagnostic).toMatch(/cannot compare/i);
expect(result.diagnostic).toMatch(/nothing was copied/i);
expect(host.installs).toBe(0);
expect(host.unmounts).toBe(1);
expect(host.cleanups).toBe(1);
+2 -2
View File
@@ -576,7 +576,7 @@ export const systemMacHopperInstallHost = (
};
/** Installer detail naming the declared minimum this Mac's version does not meet. */
export const macHopperHostVersionDetail = (
const macHopperHostVersionDetail = (
refusal: (
| { readonly source: "release_feed"; readonly packageUrl: string }
| { readonly source: "signed_app" }
@@ -587,7 +587,7 @@ export const macHopperHostVersionDetail = (
: `The signed Hopper application declares LSMinimumSystemVersion ${refusal.minimumVersion}; this Mac runs macOS ${refusal.hostVersion}. Nothing was copied.`;
/** Installer detail for a signed-app minimum REA cannot compare with this Mac's version. */
export const macHopperIncomparableMinimumDetail = (
const macHopperIncomparableMinimumDetail = (
declared: string,
hostVersion: string,
): string =>
@@ -185,10 +185,20 @@ describe("semantic uncertainty at the obligation candidate boundary", () => {
expect(ledger.obligations).toHaveLength(1);
expect(ledger.reports.residual_unknown_ids).toEqual([]);
expect(ledger.coverage.status).toBe("partial");
expect(ledger.limitations).toEqual([
`Semantic graph ${source.graph.graph_id} coverage is unknown; omitted candidates remain unknown.`,
`Semantic graph ${source.graph.graph_id}: Event source was not fully examined.`,
]);
expect(ledger.limitations).toHaveLength(2);
expect(ledger.limitations).toContainEqual(
expect.stringMatching(
/coverage is unknown.*omitted candidates remain unknown/iu,
),
);
expect(
ledger.limitations.every((limitation) =>
limitation.includes(source.graph.graph_id),
),
).toBe(true);
expect(ledger.limitations).toContainEqual(
expect.stringContaining("Event source was not fully examined."),
);
});
it("keeps a complete semantic source complete without fabricating uncertainty", () => {
@@ -198,8 +198,11 @@ describe("reconstruction obligation candidates", () => {
const generated = deriveCandidates(createEvidenceBundle([evidence]), []);
expect(generated.candidates).toEqual([]);
expect(generated.limitations).toContain(
`Process capture ${evidence.evidence_id} has no validated executable artifact identity; packaged-process lifecycle obligation was not bound to an artifact.`,
const warning = generated.limitations.find((value) =>
value.includes(evidence.evidence_id),
);
expect(warning).toMatch(
/process capture.*no validated executable artifact identity.*lifecycle obligation.*not bound to an artifact/iu,
);
});
@@ -229,9 +232,11 @@ describe("reconstruction obligation candidates", () => {
});
const generated = deriveCandidates(createEvidenceBundle([evidence]), []);
expect(generated.limitations).toEqual([
`Process Evidence ${evidence.evidence_id} could not generate candidates: at manifest.completed_at: Invalid input: expected string, received undefined (1 more issues)`,
]);
expect(generated.limitations).toHaveLength(1);
expect(generated.limitations[0]).toContain(evidence.evidence_id);
expect(generated.limitations[0]).toMatch(
/Process Evidence.*could not generate candidates.*manifest\.completed_at/iu,
);
});
});
@@ -319,10 +324,22 @@ it("keeps each semantic candidate bound to its own file and authority context",
createEvidenceBundle([...sourceRecords, application]),
[],
);
expect(generated.limitations).toEqual([
`Semantic graph ${semanticGraph.graph_id} coverage is unknown; omitted candidates remain unknown.`,
`Semantic graph ${semanticGraph.graph_id}: Semantic relations are unavailable in this minimal example.`,
]);
expect(generated.limitations).toHaveLength(2);
expect(generated.limitations).toContainEqual(
expect.stringMatching(
/coverage is unknown.*omitted candidates remain unknown/iu,
),
);
expect(
generated.limitations.every((limitation) =>
limitation.includes(semanticGraph.graph_id),
),
).toBe(true);
expect(generated.limitations).toContainEqual(
expect.stringContaining(
"Semantic relations are unavailable in this minimal example.",
),
);
expect(generated.candidates).toHaveLength(requests.length);
for (const [index, node] of requests.entries()) {
const source = sourceRecords[Math.floor(index / 2)];
@@ -304,8 +304,10 @@ describe("reconstruction obligation manifest references", () => {
expect(result.status).toBe("unknown");
expect(result.coverage.status).toBe("partial");
expect(result.evidence_links).toContain(absent);
expect(result.limitations).toContain(
"The ledger retains 1 Evidence reference(s) absent from the input bundle; closure cannot be claimed.",
expect(result.limitations).toContainEqual(
expect.stringMatching(
/1 Evidence reference.*absent from the input bundle.*closure cannot be claimed/iu,
),
);
}
const contradiction = build({
@@ -92,9 +92,10 @@ it("keeps source entries when a module has an empty specifier", () => {
"other.txt",
]);
expect(parsed.relationships).toEqual([]);
expect(parsed.limitations).toEqual([
"Empty module specifier in main.mjs was not recorded as a relationship.",
]);
expect(parsed.limitations).toHaveLength(1);
expect(parsed.limitations[0]).toContain("main.mjs");
expect(parsed.limitations[0]).toMatch(/empty.*specifier/iu);
expect(parsed.limitations[0]).toMatch(/not recorded.*relationship/iu);
});
it("retains Kotlin source identity and language across the inventory projection", () => {
+20 -11
View File
@@ -5,20 +5,27 @@ import { setupInstallFailure } from "./SetupInstallFailure.js";
describe("macOS Hopper setup failure projection", () => {
it("projects a publisher mismatch onto its own code and recovery", () => {
expect(setupInstallFailure("publisher_verification_failed")).toEqual({
const result = setupInstallFailure("publisher_verification_failed");
expect(result).toMatchObject({
status: "failed",
code: "publisher_verification_failed",
remediation: `The mounted Hopper application is not signed by the publisher REA pins (${HOPPER_PUBLISHER.bundleIdentifier}, Apple team ${HOPPER_PUBLISHER.teamIdentifier}); nothing was copied or launched. Install Hopper yourself and set HOPPER_LAUNCHER_PATH to its launcher, then rerun rea setup.`,
});
for (const fact of [
HOPPER_PUBLISHER.bundleIdentifier,
HOPPER_PUBLISHER.teamIdentifier,
"HOPPER_LAUNCHER_PATH",
"rea setup",
])
expect(result.remediation).toContain(fact);
expect(result.remediation).toMatch(/nothing was copied or launched/i);
});
it("keeps a broken bundle distinct from a publisher mismatch", () => {
expect(setupInstallFailure("bundle")).toEqual({
status: "failed",
code: "bundle_invalid",
remediation:
"The mounted package did not contain the expected Hopper application bundle. Retry setup; if it repeats, update REA before installing.",
});
const result = setupInstallFailure("bundle");
expect(result).toMatchObject({ status: "failed", code: "bundle_invalid" });
expect(result.remediation).toMatch(/bundle/i);
expect(result.remediation).toMatch(/retry setup/i);
expect(result.remediation).toMatch(/update REA/i);
});
it("keeps a host below the release minimum distinct from an unsupported host", () => {
@@ -59,12 +66,14 @@ describe("Linux package-manager setup failure projection", () => {
});
it("preserves the established remediation if no package output exists", () => {
expect(setupInstallFailure("authorization_or_package_manager")).toEqual({
const result = setupInstallFailure("authorization_or_package_manager");
expect(result).toMatchObject({
status: "failed",
code: "authorization_or_package_manager_failed",
remediation:
"Allow the system package-manager operation or install the planned Hopper package and Linux runtime dependencies, then rerun rea setup.",
});
expect(result.remediation).toMatch(/package.manager/i);
expect(result.remediation).toMatch(/Linux runtime dependencies/i);
expect(result.remediation).toContain("rea setup");
});
it("keeps truncated package output within its excerpt budget", () => {
+1
View File
@@ -34,6 +34,7 @@ export const MANAGED_SKILL_FILES = [
"references/runtime-observation.md",
"references/evidence-workflows.md",
"references/environments.md",
"references/desktop-build.md",
] as const;
export const isManagedSkillManifest = (content: string): boolean =>
+63 -33
View File
@@ -1,13 +1,13 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";
import { err, ok } from "../domain/result.js";
import { err, ok, type Result } from "../domain/result.js";
import { safeParseJson } from "../domain/safeJson.js";
import { PRODUCT_IDENTITY } from "../identity.js";
import {
npmLatestVersionCommand,
npmReleaseLookup,
parseNpmLatestVersion,
} from "./UpdateRuntime.js";
UpdateCommandRunner,
type UpdateCommandFailure,
} from "./UpdateCommandRunner.js";
import { systemUpdateHost } from "./UpdateRuntime.js";
const installation = {
manager: "npm",
@@ -15,14 +15,30 @@ const installation = {
packageRoot: "/opt/rea/lib/node_modules/rea-agents",
} as const;
describe("npm latest release metadata", () => {
it("accepts npm 11's scalar JSON response", () => {
expect(parseNpmLatestVersion('"6.0.0"')).toEqual(ok("6.0.0"));
});
const lookup = async (
response: Result<string, UpdateCommandFailure>,
selected: typeof installation | null = installation,
) => {
const probe = vi
.spyOn(UpdateCommandRunner.prototype, "runProbe")
.mockResolvedValue(response);
const host = systemUpdateHost();
try {
const result = await host.latestVersion(selected ?? undefined);
return { result, command: probe.mock.calls[0]?.[0] };
} finally {
await host.close?.();
probe.mockRestore();
}
};
it("accepts npm 12's singleton-array JSON response", () => {
expect(parseNpmLatestVersion('[\n "6.0.0"\n]\n')).toEqual(ok("6.0.0"));
});
describe("npm latest release metadata", () => {
it.each(['"6.0.0"', '[\n "6.0.0"\n]\n'])(
"accepts a scalar or singleton-array response: %j",
async (metadata) => {
expect((await lookup(ok(metadata))).result).toEqual(ok("6.0.0"));
},
);
it.each([
["empty array", "[]"],
@@ -31,39 +47,52 @@ describe("npm latest release metadata", () => {
["number", "6"],
["object", '{"version":"6.0.0"}'],
["null", "null"],
])("rejects %s response data", (_description, metadata) => {
expect(parseNpmLatestVersion(metadata)).toEqual(
err(
"Invalid npm release metadata: expected a version string or a single-element version array.",
),
])("rejects %s response data", async (_description, metadata) => {
const { result } = await lookup(ok(metadata));
expect(result).toMatchObject({
ok: false,
error: { kind: "invalid-metadata" },
});
if (result.ok || result.error.kind !== "invalid-metadata")
throw new Error("Expected invalid metadata");
expect(result.error.detail).toMatch(
/version string.*single-element version array/i,
);
});
it("preserves malformed JSON separately from a wrong metadata shape", () => {
it("preserves malformed JSON separately from a wrong metadata shape", async () => {
const metadata = '"6.0.0';
const decoded = safeParseJson(metadata);
expect(decoded.ok).toBe(false);
if (decoded.ok) return;
expect(parseNpmLatestVersion(metadata)).toEqual(err(decoded.error));
expect(decoded.error).not.toContain("single-element version array");
if (decoded.ok) throw new Error("Expected malformed JSON");
expect((await lookup(ok(metadata))).result).toEqual(
err({ kind: "invalid-metadata", detail: decoded.error }),
);
});
it("keeps command failures distinct from rejected metadata", () => {
expect(npmReleaseLookup(err("npm registry returned HTTP 503"))).toEqual(
it("keeps command failures distinct from rejected metadata", async () => {
expect(
(
await lookup(
err({ kind: "execution", detail: "npm registry returned HTTP 503" }),
)
).result,
).toEqual(
err({ kind: "unavailable", detail: "npm registry returned HTTP 503" }),
);
expect(npmReleaseLookup(ok("[]"))).toEqual(
expect(
(await lookup(err({ kind: "launch", detail: "npm missing" }))).result,
).toEqual(
err({
kind: "invalid-metadata",
detail:
"Invalid npm release metadata: expected a version string or a single-element version array.",
kind: "package-manager-unavailable",
manager: "npm",
detail: "npm missing",
}),
);
expect(npmReleaseLookup(ok('["6.0.0"]'))).toEqual(ok("6.0.0"));
});
it("keeps the global registry query and adds the owning prefix", () => {
expect(npmLatestVersionCommand(installation)).toEqual([
it("keeps the global registry query and adds the owning prefix", async () => {
const selected = await lookup(ok('"6.0.0"'));
expect(selected.command).toEqual([
"npm",
"view",
"--global",
@@ -75,7 +104,8 @@ describe("npm latest release metadata", () => {
"--fetch-retries=0",
"--fetch-timeout=10000",
]);
expect(npmLatestVersionCommand(undefined)).toEqual([
const unspecified = await lookup(ok('"6.0.0"'), null);
expect(unspecified.command).toEqual([
"npm",
"view",
"--global",
+3 -5
View File
@@ -153,7 +153,7 @@ export const BUN_LATEST_VERSION_COMMAND: readonly string[] = [
];
/** npm view arguments for dist-tags.latest, scoped to the owning prefix when known. */
export const npmLatestVersionCommand = (
const npmLatestVersionCommand = (
installation: NpmInstallation | undefined,
): readonly string[] => [
"npm",
@@ -171,9 +171,7 @@ export const npmLatestVersionCommand = (
* Read one latest version from `npm view --json`.
* npm 11 emits a JSON string. npm 12 emits that string as a one-element array.
*/
export const parseNpmLatestVersion = (
metadata: string,
): Result<string, string> => {
const parseNpmLatestVersion = (metadata: string): Result<string, string> => {
const decoded = safeParseJson(metadata);
if (!decoded.ok) return err(decoded.error);
const version = readNpmLatestVersion(decoded.value);
@@ -193,7 +191,7 @@ const nonemptyVersion = (value: string): string | undefined =>
value.length === 0 ? undefined : value;
/** Classify `npm view` or `bun info` output as a version or a lookup failure. */
export const npmReleaseLookup = (
const npmReleaseLookup = (
response: Result<string, string>,
): Result<string, ReleaseLookupFailure> => {
if (!response.ok) return err({ kind: "unavailable", detail: response.error });
@@ -142,6 +142,9 @@ it("projects the unknown-subject explanation before generating its Evidence ID",
});
if (!result.ok) throw result.error;
expect(result.value.subject).toBeNull();
expect(result.value.limitations).toContainEqual(
expect.stringMatching(/digest.*unknown.*Evidence/u),
);
expect(result.value.limitations.every((text) => !text.includes("a"))).toBe(
true,
);
+1 -1
View File
@@ -17,7 +17,7 @@ import {
expectDroppedPartial,
expectKeptPartial,
expectOwnerError,
} from "./ownerObservationExpectation.fixture.js";
} from "../../tests/fixtures/ownerObservationExpectation.js";
import type { AnalysisError } from "../domain/analysisErrorBase.js";
import { parseEvidence } from "../domain/evidence.js";
@@ -106,8 +106,7 @@ it.each([
path: ["generated_position", "line"],
minimum: 1,
maximum: 2,
message:
"No line 3; the retained script ends at line 2 (one-based lines).",
message: expect.stringMatching(/line 3.*line 2.*one-based/i),
},
},
{
@@ -116,8 +115,9 @@ it.each([
path: ["generated_position", "column"],
minimum: 0,
maximum: 3,
message:
"No column 4 on line 1; it ends at column 3 (zero-based UTF-16 columns).",
message: expect.stringMatching(
/column 4.*line 1.*column 3.*zero-based UTF-16/i,
),
},
},
{
+4 -1
View File
@@ -14,7 +14,10 @@ export const workflowAnalysisProfile = (
upstream_analysis_profile: upstream,
source_limitations: "provider-operation-caveats-v1",
...(operation === "trace_native_values"
? { value_flow_absence: "recorded-versus-unavailable-v1" }
? {
value_flow_limitations: "provider-attributed-v1",
value_flow_absence: "recorded-versus-unavailable-v1",
}
: {}),
...(operation === "binary_overview"
? { workflow_revision: 5 }
@@ -262,8 +262,10 @@ describe("browser scenario analysis view pages", () => {
},
};
const summary = await view(dropped, { kind: "summary" });
expect(summary.unknowns).toContain(
"3 events were dropped by capture budgets; counts and pages cover retained events only.",
expect(summary.unknowns).toContainEqual(
expect.stringMatching(
/3 events.*dropped.*counts and pages.*retained events only/iu,
),
);
expect(summary).toMatchObject({
summary: {
@@ -1197,60 +1197,87 @@ describe("relationship coverage snapshot replay", () => {
});
});
it("does not replay pre-envelope call graphs under the revised workflow profile", () => {
const cache = new AnalysisSnapshotCache();
const target = ANALYSIS_SNAPSHOT_TARGET;
const profile = ANALYSIS_SNAPSHOT_PROFILE;
const operation = "get_call_graph" as const;
const parameters = { address: "0x1000", direction: "forward" };
const oldProfile = workflowAnalysisProfile(profile);
const revisedProfile = workflowAnalysisProfile(profile, operation);
const oldResult = { "0": [] };
cache.recordWorkflow({
target,
profile,
operation,
parameters,
execution: {
...createAnalysisExecution(oldResult, REA_WORKFLOW_PROVIDER, {
subject: target,
rawResult: oldResult,
}),
analysisProfile: oldProfile,
it.each([
{
operation: "get_call_graph",
parameters: { address: "0x1000", direction: "forward" },
result: { "0": [] },
},
{
operation: "trace_native_values",
parameters: { procedure: "0x1000" },
result: {
seed: "0x1000",
target_sha256: ANALYSIS_SNAPSHOT_TARGET.sha256,
nodes: [],
edges: [],
procedures: [],
unknowns: [],
total_nodes: 0,
total_edges: 0,
decompilations: 1,
next_offset: null,
page_truncated: false,
traversal: { status: "complete" },
truncated: false,
limitations: [],
},
});
const evidence = createEvidence(target, REA_WORKFLOW_PROVIDER, {
operation,
confidence: "derived",
parameters,
result: oldResult,
rawResult: oldResult,
analysisProfile: oldProfile,
});
const exported = cache.export(
target,
profile,
createEvidenceBundle([evidence]),
);
if (!exported.ok) throw exported.error;
const snapshot = parseAnalysisSnapshot(exported.value);
expect(
snapshotEvidenceForQuery(snapshot, {
},
] as const)(
"does not replay old $operation results under the revised workflow profile",
({ operation, parameters, result: oldResult }) => {
const cache = new AnalysisSnapshotCache();
const target = ANALYSIS_SNAPSHOT_TARGET;
const profile = ANALYSIS_SNAPSHOT_PROFILE;
const oldProfile = workflowAnalysisProfile(profile);
const revisedProfile = workflowAnalysisProfile(profile, operation);
cache.recordWorkflow({
target,
bindingProfile: profile,
profile,
operation,
parameters,
provider: REA_WORKFLOW_PROVIDER,
evidenceProfile: revisedProfile,
}),
).toBeUndefined();
expect(
enhancedOutputSchemas.get_call_graph.safeParse({
normalized_result: oldResult,
}).success,
).toBe(false);
});
execution: {
...createAnalysisExecution(oldResult, REA_WORKFLOW_PROVIDER, {
subject: target,
rawResult: oldResult,
}),
analysisProfile: oldProfile,
},
});
const evidence = createEvidence(target, REA_WORKFLOW_PROVIDER, {
operation,
confidence: "derived",
parameters,
result: oldResult,
rawResult: oldResult,
analysisProfile: oldProfile,
});
const exported = cache.export(
target,
profile,
createEvidenceBundle([evidence]),
);
if (!exported.ok) throw exported.error;
const snapshot = parseAnalysisSnapshot(exported.value);
expect(
snapshotEvidenceForQuery(snapshot, {
target,
bindingProfile: profile,
operation,
parameters,
provider: REA_WORKFLOW_PROVIDER,
evidenceProfile: revisedProfile,
}),
).toBeUndefined();
if (operation === "get_call_graph")
expect(
enhancedOutputSchemas.get_call_graph.safeParse({
normalized_result: oldResult,
}).success,
).toBe(false);
},
);
it("keeps older value-trace Evidence as history without replaying its source IDs", () => {
const cache = new AnalysisSnapshotCache();
@@ -1374,6 +1401,41 @@ it("declines source-bearing snapshot entries while replaying omitted and empty s
expect(cache.entries()).toHaveLength(2);
});
it("distinguishes value-flow caveat propagation from source-ownership revisions", () => {
const upstream = ANALYSIS_SNAPSHOT_PROFILE;
const prior = {
...workflowAnalysisProfile(upstream).parameters,
value_flow_absence: "recorded-versus-unavailable-v1",
workflow_revision: 1,
};
const baseline = createAnalysisProfile(REA_WORKFLOW_PROVIDER, prior);
const ownership = createAnalysisProfile(REA_WORKFLOW_PROVIDER, {
...prior,
workflow_revision: 2,
});
const limitations = createAnalysisProfile(REA_WORKFLOW_PROVIDER, {
...prior,
value_flow_limitations: "provider-attributed-v1",
});
const combined = createAnalysisProfile(REA_WORKFLOW_PROVIDER, {
...limitations.parameters,
workflow_revision: 2,
});
const scoped = workflowAnalysisProfile(upstream, "trace_native_values");
expect(scoped.digest).toBe(combined.digest);
expect(scoped.parameters.value_flow_limitations).toBe(
"provider-attributed-v1",
);
expect(
new Set([
baseline.digest,
ownership.digest,
limitations.digest,
combined.digest,
]).size,
).toBe(4);
});
it("replays source-bearing entries only when their complete retained closure exists", () => {
const target = ANALYSIS_SNAPSHOT_TARGET;
const profile = ANALYSIS_SNAPSHOT_PROFILE;
@@ -32,7 +32,6 @@ import { NATIVE_MACOS_PROVIDER_IDENTITY } from "../../native/NativeMacosProvider
import {
buildCapabilityInventory,
compactToolAvailability,
MULTI_MODE_REMEDIATION,
} from "../CapabilityInventory.js";
const projectedStatusSchema = z.object({
@@ -583,7 +582,9 @@ it.each([
: ["inspect_native_dispatch_metadata", "list_names"],
});
if (!route) {
expect(trace?.remediation).toBe(MULTI_MODE_REMEDIATION);
expect(trace?.remediation).toMatch(
/no mode.*inspect each mode.*missing operations and remediation/iu,
);
const authored = trace?.modes?.find(
(mode) => mode.name === "authored_ui_dispatch",
);
@@ -638,7 +639,9 @@ it("keeps distinct recovery for an unbound non-bundle session", async () => {
expect(trace).toMatchObject({
available: false,
reason: "provider_unavailable",
remediation: MULTI_MODE_REMEDIATION,
remediation: expect.stringMatching(
/no mode.*inspect each mode.*missing operations and remediation/iu,
),
});
const authored = trace?.modes?.find(
(mode) => mode.name === "authored_ui_dispatch",
@@ -296,9 +296,12 @@ describe("exportDesktopApplication and the desktop Trash", () => {
"Documents/today.txt",
],
});
expect(result.limitations).toContain(
"The desktop Trash held 2 file(s) at the seed checkpoint, which are not seeded: ~/.local/share/Trash/files/today.txt, ~/.local/share/Trash/info/today.txt.trashinfo. Restore one the task needs and capture again.",
const warning = result.limitations.find((line) =>
line.includes("Trash/files/today.txt"),
);
expect(warning).toContain("~/.local/share/Trash/info/today.txt.trashinfo");
expect(warning).toMatch(/Trash.*2 file.*not seeded/iu);
expect(warning).toMatch(/restore.*capture again/iu);
});
});
@@ -44,8 +44,10 @@ describe("environment manifests from capture_browser_scenario parents", () => {
expect(
manifest.tools.some((entry) => entry.name.includes("redacted")),
).toBe(false);
expect(manifest.limitations).toContain(
"Scenario records are the capture's network transactions in request order; each record ordinal is the transaction's zero-based position.",
expect(manifest.limitations).toContainEqual(
expect.stringMatching(
/network transactions in request order.*ordinal.*zero-based position/iu,
),
);
});
@@ -23,7 +23,7 @@ import {
expectDroppedPartial,
expectKeptPartial,
expectOwnerError,
} from "../ownerObservationExpectation.fixture.js";
} from "../../../tests/fixtures/ownerObservationExpectation.js";
const identity = { id: "electron-fixture", name: "Fixture", version: "1" };
const pageProvider = (failure: AnalysisError): ElectronObservationPort => ({
@@ -236,6 +236,7 @@ it.each(["list", "inspect"] as const)(
it("keeps cancellation when the retained Electron inspection is incomplete", async () => {
const reason = { requested: "stop before page inspection completed" };
// A JSON-safe but incomplete inspection cannot be converted into Evidence.
const partial = {
kind: "electron-page-observation",
inspection: { target_id: "electron-page" },
@@ -131,8 +131,10 @@ describe("Electron semantic coverage", () => {
`const { ipcMain } = require("electron");\nipcMain.handle("ping", () => 1);\n`,
);
expect(limitations).not.toContain(EMPTY_COVERAGE);
expect(limitations).toContain(
"Electron relationships are derived from inert syntax; runtime registration, reachability, defaults, and enforcement remain unproven.",
expect(limitations).toContainEqual(
expect.stringMatching(
/inert syntax.*runtime registration.*reachability.*defaults.*enforcement.*unproven/iu,
),
);
expect(electronSemantics).toBe("recovered");
});
@@ -20,7 +20,7 @@ import {
expectOutputError,
expectOwnerError,
expectPreemptedCancellation,
} from "../ownerObservationExpectation.fixture.js";
} from "../../../tests/fixtures/ownerObservationExpectation.js";
const observeCancelled = async (partial: unknown) => {
const reason = { requested: "stop before runtime observation completed" };
@@ -215,8 +215,8 @@ it("projects closure and direct interprocedural flow without execution", () => {
"returns-to-call",
] as const)
expect(relations.has(expected)).toBe(true);
expect(graph.limitations).toContain(
"The semantic graph contains static syntax observations and conservative relationship candidates; it does not claim runtime execution.",
expect(graph.limitations).toContainEqual(
expect.stringMatching(/static.*syntax.*does not claim runtime execution/iu),
);
const parameter = graph.nodes.find(
({ kind, label }) => kind === "parameter" && label === "value",
@@ -114,8 +114,10 @@ it("keeps symbol origin unknown when supplied metadata describes a different sam
const member = report.matches
.flatMap((match) => match.left)
.find((value) => value.address === "0x10");
expect(member?.limitations).toContain(
"Symbol origin unavailable; exact-name matching is unavailable. Independent complete body bytes remain eligible.",
expect(member?.limitations).toContainEqual(
expect.stringMatching(
/symbol origin unavailable.*exact-name matching is unavailable.*complete body bytes remain eligible/iu,
),
);
expect(member?.evidence_links).toContain(alias.evidence_id);
});
@@ -171,8 +173,10 @@ it("preserves contradictory symbol origins from inventory/name facts or multiple
withBytes ? "identical-bytes" : null,
);
const member = report.matches[0]!.left[0]!;
expect(member.limitations).toContain(
"Conflicting generated and named symbol-origin observations; exact-name matching is unavailable. Independent complete body bytes remain eligible.",
expect(member.limitations).toContainEqual(
expect.stringMatching(
/conflicting generated and named symbol-origin.*exact-name matching is unavailable.*complete body bytes remain eligible/iu,
),
);
expect(member.limitations.join(" ")).not.toContain(
"Symbol origin unavailable",
@@ -564,6 +564,53 @@ describe("native value failed-callee traversal", () => {
});
});
it("preserves and deduplicates source value-flow limitations across analyzed functions", async () => {
const base = functionDossierSchema.parse(ghidraFunctionDossier());
const caller = functionDossierSchema.parse(
nativeFlowDossier(base, {
address: "0x1000",
name: "caller",
operations: [node("call", "0x1000", "CALL")],
parameters: [],
}),
);
const callee = functionDossierSchema.parse(
nativeFlowDossier(base, {
address: "0x2000",
name: "callee",
operations: [],
parameters: [],
}),
);
if (
!caller.native_value_flow?.available ||
!callee.native_value_flow?.available
)
throw new Error("Expected available fixture value flow");
caller.native_value_flow.limitations = ["Shared provider caveat."];
callee.native_value_flow.limitations = [
"Shared provider caveat.",
"Callee-specific caveat.",
];
const result = await traceNativeValues(
callBindingAnalysis({
callerAddress: "0x1000",
calleeAddress: "0x2000",
caller,
callee,
}),
{ procedure: "0x1000", max_functions: 2 },
);
if (!result.ok) throw result.error;
const limitations = nativeValueTraceSchema.parse(result.value).limitations;
expect(limitations).toContain(
"Fixture (fixture 1) analyze_function: Callee-specific caveat.",
);
expect(
limitations.filter((item) => item.includes("Shared provider caveat.")),
).toEqual(["Fixture (fixture 1) analyze_function: Shared provider caveat."]);
});
describe("native value call-binding fan-out", () => {
it("retains limitations embedded in resolved call-target results", async () => {
const callerAddress = "0x1000";
@@ -181,6 +181,14 @@ export const traceNativeValues = async (
analysis_profile_digest: execution.value.analysisProfile?.digest ?? null,
});
const flow = dossier.native_value_flow;
if (flow !== null)
sourceLimitations.push(
...flow.limitations.map((limitation) => ({
provider: execution.value.provider,
operation: "analyze_function" as const,
limitation,
})),
);
if (flow === null || !flow.available) {
unknowns.push({
procedure: address,
+1 -1
View File
@@ -265,7 +265,7 @@ const cliAnalysisError = (error: AnalysisError): ProcessCliErrorOutput => ({
* This catch includes target execution, and the projection stays non-retryable.
* Tell the user what happened; do not ask them to run the command again.
*/
export const PROCESS_UNEXPECTED_FAILURE_REMEDIATION =
const PROCESS_UNEXPECTED_FAILURE_REMEDIATION =
"Do not repeat this command. Tell the user the process command could not complete and ask them to check the input files, then run `rea doctor`.";
/** Preserve typed failures and local diagnostics at the process CLI boundary. */
@@ -43,5 +43,9 @@ it("keeps producer-owned recovery through cleanup wrapping and public projection
expect(projected.message).toBe(userMessage);
expect(projected.remediation.action).toBe(userMessage);
expect(projected.details?.detail).toBe("Exact command diagnostic");
expect(projected.details?.cleanup).toBeDefined();
expect(projected.details).toMatchObject({
cleanup: "incomplete",
cleanup_reason: "Owned staging cleanup needs retry",
resources: ["owned staging"],
});
});
+28 -21
View File
@@ -9,9 +9,6 @@ import {
normalizeArtifactPath,
} from "./ArtifactPaths.js";
const NOTE =
"a case-insensitive destination cannot store both. This comparison is not a filesystem observation.";
it.each(["drive", "escaped", "normalization", "prefix", "collision"])(
"bounds path failure diagnostics at the owning boundary: %s",
(kind) => {
@@ -66,6 +63,18 @@ const annotate = (paths: readonly string[]) => {
};
};
const expectCollision = (
limitations: string[] | undefined,
...facts: string[]
) => {
expect(limitations).toHaveLength(1);
const warning = limitations?.[0] ?? "";
for (const fact of facts) expect(warning).toContain(fact);
expect(warning).toMatch(/collid.*English.*case folding/iu);
expect(warning).toMatch(/case.insensitive destination.*cannot store both/iu);
expect(warning).toMatch(/not a filesystem observation/iu);
};
describe("English Unicode case collisions", () => {
it("retains repeated same-kind entries while rejecting file-directory aliasing", () => {
const registry = new ArtifactPathRegistry();
@@ -79,12 +88,8 @@ describe("English Unicode case collisions", () => {
it("names the other spelling of a colliding file", () => {
const { limitation, byPath } = annotate([".", "Main.js", "main.js", "x"]);
expect(limitation).toBe(ENGLISH_UNICODE_CASE_INVENTORY_LIMITATION);
expect(byPath.get("Main.js")).toEqual([
`Logical path Main.js collides under English (en-US) Unicode case folding with main.js; ${NOTE}`,
]);
expect(byPath.get("main.js")).toEqual([
`Logical path main.js collides under English (en-US) Unicode case folding with Main.js; ${NOTE}`,
]);
expectCollision(byPath.get("Main.js"), "Main.js", "main.js");
expectCollision(byPath.get("main.js"), "main.js", "Main.js");
expect(byPath.get("x")).toEqual([]);
});
@@ -95,19 +100,18 @@ describe("English Unicode case collisions", () => {
"res/foo",
"res/foo/b.txt",
]);
expect(byPath.get("res/Foo")).toEqual([
`Logical path res/Foo collides under English (en-US) Unicode case folding with res/foo; ${NOTE}`,
]);
expect(byPath.get("res/foo/b.txt")).toEqual([
`Logical path res/foo/b.txt is under res/foo, which collides under English (en-US) Unicode case folding with res/Foo; ${NOTE}`,
]);
expectCollision(byPath.get("res/Foo"), "res/Foo", "res/foo");
expectCollision(
byPath.get("res/foo/b.txt"),
"res/foo/b.txt",
"under res/foo",
"res/Foo",
);
});
it("counts further spellings, each of which is its own occurrence", () => {
const { byPath } = annotate(["A.txt", "a.txt", "a.TXT"]);
expect(byPath.get("a.txt")).toEqual([
`Logical path a.txt collides under English (en-US) Unicode case folding with A.txt and 1 other spelling; ${NOTE}`,
]);
expectCollision(byPath.get("a.txt"), "a.txt", "A.txt", "1 other spelling");
});
it("retains every spelling in a high-cardinality folded sibling group", () => {
@@ -123,9 +127,12 @@ describe("English Unicode case collisions", () => {
}
expect(limitation).toBe(ENGLISH_UNICODE_CASE_INVENTORY_LIMITATION);
expect(byPath.size).toBe(count);
expect(byPath.get(first)).toEqual([
`Logical path ${first} collides under English (en-US) Unicode case folding with ${second} and ${String(count - 2)} other spellings; ${NOTE}`,
]);
expectCollision(
byPath.get(first),
first,
second,
`${String(count - 2)} other spellings`,
);
expect(byPath.get(original)?.[0]).toContain(
`with ${first} and ${String(count - 2)} other spellings;`,
);
+1 -1
View File
@@ -42,7 +42,7 @@ it("waits for admitted operations and shares concurrent close", async () => {
expect(scope.close()).toBe(close);
await expect(scope.run(async () => undefined)).rejects.toMatchObject({
reason: "unavailable",
message: "Artifact resource scope is closed",
message: expect.stringContaining("closed"),
});
let closed = false;
void close.then(() => {
+11 -8
View File
@@ -168,8 +168,11 @@ it.skipIf(process.platform === "win32")(
code: "EACCES",
});
await expect(
readStableArtifact(selected, 1024, undefined, {
const rejected: unknown = await readStableArtifact(
selected,
1024,
undefined,
{
lstat: async (path) => {
if (path === selected) return selectedStats;
throw failure;
@@ -178,11 +181,11 @@ it.skipIf(process.platform === "win32")(
open: async () => {
throw new Error("A rejected symlink must not be opened");
},
}),
).rejects.toMatchObject({
reason: "path",
resolvedPath: undefined,
message: `Expected a regular file without a symlink: ${selected}`,
});
},
).catch((cause: unknown) => cause);
expect(rejected).toMatchObject({ reason: "path", resolvedPath: undefined });
if (!(rejected instanceof Error)) throw new Error("Expected path failure");
expect(rejected.message).toContain(selected);
expect(rejected.message).toContain("symlink");
},
);
+1 -1
View File
@@ -114,6 +114,6 @@ it("decodes admitted JSON across short reads without consuming padding", async (
),
).rejects.toMatchObject({
reason: "format",
message: "Truncated ASAR JSON header",
message: expect.stringMatching(/truncated.*header/iu),
});
});
+15 -11
View File
@@ -2,10 +2,7 @@ import type { Stats } from "node:fs";
import { expect, it } from "vitest";
import {
changeTimeMayStillDrift,
settleChangeTimeBaseline,
} from "../filesystem/ChangeTimeBaseline.js";
import { settleChangeTimeBaseline } from "../filesystem/ChangeTimeBaseline.js";
const DRIFT_MS = 2_000;
@@ -85,13 +82,20 @@ it("exits on the window closing rather than on a repeated value", async () => {
expect(seams.sleeps.length).toBe(2);
});
it("settles an unreadable ChangeTime rather than trusting it", () => {
expect(
changeTimeMayStillDrift(statsAt(Number.NaN), { platform: "win32" }),
).toBe(true);
expect(
changeTimeMayStillDrift(statsAt(Number.NaN), { platform: "linux" }),
).toBe(false);
it("re-observes an unreadable Windows ChangeTime but does not wait on other hosts", async () => {
const windows = scriptedRead([Number.NaN, 1_000]);
const seams = advancingSeams(5_000, 100);
const settled = await settleChangeTimeBaseline(windows.read, seams);
expect(settled.ctimeMs).toBe(1_000);
expect(windows.reads()).toBe(2);
expect(seams.sleeps).toHaveLength(1);
const linux = scriptedRead([Number.NaN, 1_000]);
const unreadable = await settleChangeTimeBaseline(linux.read, {
platform: "linux",
});
expect(unreadable.ctimeMs).toBeNaN();
expect(linux.reads()).toBe(1);
});
it("gives up settling instead of stalling admission forever", async () => {
+4 -4
View File
@@ -152,8 +152,8 @@ it("refuses a suffix CRC mismatch under the default integrity policy", async ()
trust: "observed-untrusted",
}),
]);
expect(recorded.limitations).toContain(
"1 integrity contradiction(s) were recorded; mismatched content is observed-untrusted.",
expect(recorded.limitations).toContainEqual(
expect.stringMatching(/1.*integrity.*observed-untrusted/iu),
);
expect(recorded.occurrences).toHaveLength(4);
});
@@ -184,8 +184,8 @@ it("extracts elements and carries a root contradiction into the extraction", asy
expect(extracted.integrity_contradictions).toEqual([
expect.objectContaining({ logical_path: ".", algorithm: "dfu-crc32" }),
]);
expect(extracted.limitations).toContain(
"The container contradicts its declared integrity metadata; every extracted file is observed-untrusted.",
expect(extracted.limitations).toContainEqual(
expect.stringMatching(/container.*integrity.*observed-untrusted/iu),
);
expect(extracted.limitations.join("\n")).not.toContain(
"extracted file(s) contradict",
@@ -169,8 +169,8 @@ describe("ESP flash layout inventory", () => {
expect(root(snapshot)).toMatchObject({
partition_table: { flash_address: 0xa000, method: "scan" },
});
expect(snapshot.limitations).toContain(
"The partition table at 0xa000 was found by scanning 0x1000-aligned flash sectors for a table whose MD5 verifies; the dump does not record the bootloader's configured table offset.",
expect(snapshot.limitations).toContainEqual(
expect.stringMatching(/0xa000.*0x1000.*MD5.*does not record/iu),
);
});
});
@@ -254,11 +254,18 @@ describe("ESP flash layout coverage and selection", () => {
facts: { status: "erased" },
});
// Only the erased app slot holds bytes the bootloader does not read.
expect(
snapshot.limitations.filter((text) => text.includes("finds no app")),
).toEqual([
`partitions/ota_1.bin begins with erased flash, so ESP-IDF's bootloader finds no app in it, but ${String(indices.length)} of its bytes from offset 0x${start.toString(16)} to 0x${end.toString(16)} are not erased flash; they are not read as an image.`,
]);
const erasedSlotWarnings = snapshot.limitations.filter((text) =>
/bootloader.*no app/iu.test(text),
);
expect(erasedSlotWarnings).toHaveLength(1);
const warning = erasedSlotWarnings[0] ?? "";
expect(warning).toContain("partitions/ota_1.bin");
expect(warning).toContain(String(indices.length));
expect(warning).toContain(`0x${start.toString(16)}`);
expect(warning).toContain(`0x${end.toString(16)}`);
expect(warning).toMatch(
/erased flash.*bootloader.*no app.*not erased.*not read as an image/iu,
);
// A partition erased throughout has no written bytes.
expect(row("partitions/nvs.bin")).toMatchObject({
written_offset: null,
@@ -324,8 +324,9 @@ describe("MachOSliceArtifactReader", () => {
reader.entries()[Symbol.asyncIterator]().next(),
).rejects.toMatchObject({
reason: "format",
message:
"lipo did not produce readable architecture records: lipo output contained no architectures",
message: expect.stringMatching(
/lipo.*readable architecture records.*no architectures/i,
),
cause: new TypeError("lipo output contained no architectures"),
});
});
+1 -1
View File
@@ -32,7 +32,7 @@ import {
} from "./NativeDmgOwnership.js";
const HDIUTIL_COMMAND_TIMEOUT_MS = 120_000;
/** Conditional recovery guidance; a path match never grants attachment ownership. */
export const DMG_EXISTING_ATTACHMENT_RECOVERY =
const DMG_EXISTING_ATTACHMENT_RECOVERY =
"hdiutil refused a private read-only DMG attachment after listing an existing attachment of this image path. If it is still attached, ask its owner to release it when safe, then retry. REA does not borrow or detach existing attachments.";
const DMG_CHECKSUM_ABSENT_LIMITATION =
"hdiutil verify found no stored checksum in this disk image, so its integrity was not verified; the root SHA-256 identifies the inventoried bytes.";
+4 -5
View File
@@ -116,16 +116,15 @@ it("retains malformed successful hdiutil inventory output as a typed producer pa
expect(calls).toEqual(["verify", "info"]);
expect(failure).toMatchObject({
reason: "format",
message: "hdiutil info -plist returned malformed image inventory",
message: expect.stringMatching(/hdiutil.*info.*inventory/iu),
cause: { name: "ZodError" },
});
if (!(failure instanceof Error))
throw new Error("Expected inventory failure");
expect(
projectAnalysisError(translateArtifactFailure("inspect_artifact", failure)),
).toMatchObject({
details: {
reason: "format",
detail: "hdiutil info -plist returned malformed image inventory",
},
details: { reason: "format", detail: failure.message },
});
});
+6 -11
View File
@@ -7,13 +7,10 @@ import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory
import { scanCanonicalArtifactInventory } from "../../tests/fixtures/artifactInventory.js";
import {
NativeDmgArtifactReader,
DMG_EXISTING_ATTACHMENT_RECOVERY,
type NativeDmgHost,
} from "./NativeDmgArtifactReader.js";
import { translateArtifactFailure } from "./ArtifactOperationFailure.js";
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
import { analysisErrorUserMessage } from "../domain/analysisErrorPresentation.js";
import { ArtifactOperationError } from "../domain/artifactOperationError.js";
it.each(["same", "other", "missing-path", "no-path", "empty-group"] as const)(
"retains DMG root facts and limits existing-attachment guidance to a resolved image path: %s",
@@ -78,7 +75,6 @@ it.each(["same", "other", "missing-path", "no-path", "empty-group"] as const)(
} catch (cause: unknown) {
failure = cause;
}
expect(failure).toBeDefined();
const projected = projectAnalysisError(
translateArtifactFailure("inspect_artifact", failure),
);
@@ -109,16 +105,15 @@ it.each(["same", "other", "missing-path", "no-path", "empty-group"] as const)(
expect.objectContaining({ kind: "artifact-inventory" }),
);
if (listed === "same") {
expect(projected.message).toBe(DMG_EXISTING_ATTACHMENT_RECOVERY);
expect(projected.remediation.action).toBe(
DMG_EXISTING_ATTACHMENT_RECOVERY,
expect(projected.message).toMatch(
/hdiutil.*existing attachment.*owner.*release.*retry.*does not borrow or detach/iu,
);
expect(projected.remediation.action).toBe(projected.message);
} else {
expect(projected.message).toBe(
analysisErrorUserMessage(
new ArtifactOperationError("inspect_artifact", "unavailable"),
),
expect(projected.message).toMatch(
/unavailable.*availability reason.*before retrying/iu,
);
expect(projected.message).not.toMatch(/existing attachment|detach/iu);
}
expect(calls).not.toContain("detach");
},
+45 -33
View File
@@ -12,19 +12,10 @@ import { expect, it, vi } from "vitest";
import * as artifactPaths from "./ArtifactPaths.js";
import { NodeSeaArtifactReader } from "./NodeSeaArtifactReader.js";
import { artifactFormatDescriptor } from "./artifactFormats.js";
import { ArtifactResourceScope } from "./ArtifactResourceScope.js";
import { extractArtifact } from "./extraction/ArtifactExtraction.js";
import {
NODE_SEA_BAD_MAGIC,
NODE_SEA_DUPLICATE_BLOB,
NODE_SEA_ELF_NOTES_REPEATED,
NODE_SEA_FUSE_CONFLICT,
NODE_SEA_FUSE_ABSENT,
NODE_SEA_FUSE_UNSET,
NODE_SEA_MAGIC,
NODE_SEA_TRUNCATED,
NODE_SEA_UNKNOWN_FLAGS,
} from "./nodeSea/NodeSeaBlob.js";
import { NODE_SEA_MAGIC } from "./nodeSea/NodeSeaBlob.js";
import {
NODE_SEA_FUSE_HASH,
buildNodeSeaBlob,
@@ -68,10 +59,14 @@ it.each([
const snapshot = await scanCanonicalArtifactInventory(path);
expect(snapshot.manifest.root_format).toBe("node-sea");
expect(snapshot.coverage.status).toBe("complete");
expect(snapshot.limitations).toContain(
"Node SEA inventory establishes the injected blob, flags, fuse sentinel, main script, optional code cache, snapshot, and assets. V8 snapshots and code cache are not deserialized, and the application is not executed.",
const limitation = artifactFormatDescriptor("node-sea")?.readerLimitation;
if (limitation === undefined) throw new Error("Missing Node SEA limitation");
expect(snapshot.limitations).toContain(limitation);
expect(limitation).toMatch(/snapshots.*code cache.*not deserialized/iu);
expect(limitation).toMatch(/application.*not executed/iu);
expect(snapshot.limitations).not.toContainEqual(
expect.stringMatching(/NODE_SEA_FUSE sentinel.*unset/iu),
);
expect(snapshot.limitations).not.toContain(NODE_SEA_FUSE_UNSET);
const root = snapshot.occurrences.find((row) => row.logical_path === ".");
expect(root).toMatchObject({ artifact_kind: "container" });
expect(root?.format_metadata).toMatchObject({
@@ -221,22 +216,26 @@ it.each([
"reports a %s fuse as a contradiction",
async (_label, fuse, state, sentinel) => {
const reason =
state === "absent" ? NODE_SEA_FUSE_ABSENT : NODE_SEA_FUSE_UNSET;
state === "absent"
? /no NODE_SEA_FUSE sentinel.*observed/iu
: /NODE_SEA_FUSE sentinel.*unset/iu;
const snapshot = await scanCanonicalArtifactInventory(
await writeCarrier(
"fuse",
nodeSeaElf({ ...(fuse === undefined ? {} : { fuse }), main: script }),
),
);
expect(
snapshot.occurrences.find((row) => row.logical_path === ".")
?.format_metadata,
).toMatchObject({
const metadata = snapshot.occurrences.find(
(row) => row.logical_path === ".",
)?.format_metadata;
expect(metadata).toMatchObject({
fuse_state: state,
fuse_sentinel: sentinel,
fuse_contradiction: reason,
fuse_contradiction: expect.stringMatching(reason),
});
expect(snapshot.limitations).toContain(reason);
const contradiction = (metadata as { fuse_contradiction: string })
.fuse_contradiction;
expect(snapshot.limitations).toContain(contradiction);
expect(snapshot.coverage.status).toBe("complete");
},
);
@@ -245,15 +244,17 @@ it("reports disagreeing fuse sentinels", async () => {
const snapshot = await scanCanonicalArtifactInventory(
await writeCarrier("conflict", nodeSeaPe({ fuse: "conflicting" })),
);
expect(
snapshot.occurrences.find((row) => row.logical_path === ".")
?.format_metadata,
).toMatchObject({
const metadata = snapshot.occurrences.find(
(row) => row.logical_path === ".",
)?.format_metadata;
expect(metadata).toMatchObject({
fuse_state: "conflicting",
fuse_sentinel: null,
fuse_contradiction: NODE_SEA_FUSE_CONFLICT,
fuse_contradiction: expect.stringMatching(/fuse sentinels disagree/iu),
});
expect(snapshot.limitations).toContain(NODE_SEA_FUSE_CONFLICT);
const contradiction = (metadata as { fuse_contradiction: string })
.fuse_contradiction;
expect(snapshot.limitations).toContain(contradiction);
});
it("leaves a Mach-O, ELF, or PE without a SEA slot in its native format", async () => {
@@ -354,12 +355,18 @@ it("fails closed when the located blob is truncated, has a bad magic, or unknown
nodeSeaElf({ blob: Buffer.from([0x20, 0xda, 0x43]) }),
),
),
).rejects.toMatchObject({ reason: "format", message: NODE_SEA_TRUNCATED });
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/Node SEA.*truncated/iu),
});
await expect(
scanCanonicalArtifactInventory(
await writeCarrier("bad-magic", nodeSeaMachO({ blob: Buffer.alloc(16) })),
),
).rejects.toMatchObject({ reason: "format", message: NODE_SEA_BAD_MAGIC });
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/magic.*not.*0x143da20/iu),
});
const unknown = Buffer.alloc(9);
unknown.writeUInt32LE(NODE_SEA_MAGIC, 0);
unknown.writeUInt32LE(1 << 5, 4);
@@ -370,7 +377,7 @@ it("fails closed when the located blob is truncated, has a bad magic, or unknown
),
).rejects.toMatchObject({
reason: "format",
message: NODE_SEA_UNKNOWN_FLAGS,
message: expect.stringMatching(/flags.*unknown bits/iu),
});
});
@@ -386,7 +393,7 @@ it("fails closed when two different blobs are declared", async () => {
),
).rejects.toMatchObject({
reason: "format",
message: NODE_SEA_DUPLICATE_BLOB,
message: expect.stringMatching(/Node SEA blob.*declared more than once/iu),
});
await expect(
scanCanonicalArtifactInventory(
@@ -397,7 +404,10 @@ it("fails closed when two different blobs are declared", async () => {
}),
),
),
).rejects.toMatchObject({ message: NODE_SEA_DUPLICATE_BLOB });
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/Node SEA blob.*declared more than once/iu),
});
});
it("keeps one blob when the same bytes are declared twice", async () => {
@@ -473,7 +483,9 @@ it("reads repeated PT_NOTE declarations at most once per note the file holds", a
),
).rejects.toMatchObject({
reason: "format",
message: NODE_SEA_ELF_NOTES_REPEATED,
message: expect.stringMatching(
/ELF note tables.*more notes than the file holds/iu,
),
});
});
+2 -2
View File
@@ -579,7 +579,7 @@ it("refuses to open ZIP symlink entries even when unixMode is absent", async ()
throw new Error(`Missing ZIP symlink ${logicalPath}`);
await expect(reader.open(entry)).rejects.toMatchObject({
reason: "format",
message: "ZIP entry is not a regular file",
message: expect.stringContaining("regular file"),
});
}
} finally {
@@ -839,7 +839,7 @@ it("joins an admitted ZIP enumeration before reader close completes", async () =
release.resolve();
await expect(next).rejects.toMatchObject({
reason: "unavailable",
message: "ZIP reader is closed",
message: expect.stringContaining("closed"),
});
await closing;
const completedReads = reads.mock.calls.length;
@@ -146,8 +146,10 @@ describe("Apple asset catalog application workflow", () => {
next_offset: null,
truncated: false,
});
expect(result.limitations).toContain(
"No compiled Assets.car catalog was found among the app bundle's regular files (symlinks are not followed); any resource keys are reported as unmatched.",
expect(result.limitations).toContainEqual(
expect.stringMatching(
/Assets\.car.*symlinks.*not followed.*unmatched/iu,
),
);
},
);
@@ -224,8 +226,10 @@ it.skipIf(process.platform === "win32")(
throw new Error("No catalog is present");
},
});
expect(result.limitations).toContain(
"Interface Builder resource-key joins may be incomplete because the decoded object inventory is incomplete.",
expect(result.limitations).toContainEqual(
expect.stringMatching(
/resource-key joins.*incomplete.*object inventory.*incomplete/iu,
),
);
},
);
@@ -48,20 +48,24 @@ for (const symlinks of [0, 1, 65])
examined: 2,
omitted: 1 + symlinks,
});
expect(report.limitations).toContain(
"1 Interface Builder archive(s) omitted because unsupported uid exact range.",
expect(report.limitations).toContainEqual(
expect.stringMatching(/1.*omitted.*unsupported uid exact range/iu),
);
if (symlinks > 0)
expect(report.limitations).toContain(
`${symlinks} Interface Builder archive(s) omitted because symlink not followed.`,
expect(report.limitations).toContainEqual(
expect.stringMatching(
new RegExp(`${symlinks}.*omitted.*symlink not followed`, "iu"),
),
);
if (symlinks < 64)
expect(report.limitations).toContain(
"Unsupported.nib: omitted because unsupported uid exact range.",
expect(report.limitations).toContainEqual(
expect.stringMatching(
/Unsupported\.nib.*omitted.*unsupported uid exact range/iu,
),
);
else
expect(report.limitations).toContain(
"2 additional omitted archive path(s) and their reasons were not retained; reporting is bounded to 64 paths.",
expect(report.limitations).toContainEqual(
expect.stringMatching(/2.*omitted.*not retained.*64 paths/iu),
);
const result = await analyzeAppleAssetCatalogs({
bundlePath: bundle,
+22 -16
View File
@@ -154,11 +154,7 @@ describe("keyed archive scalar projection", () => {
offset: 0,
limit: 2,
}),
).toThrow(
expect.objectContaining({
message: "binary plist date object is truncated",
}),
);
).toThrow(/date.*truncated/iu);
});
it("keeps overlapping date precision unknown without changing its sibling object", () => {
@@ -628,6 +624,10 @@ describe("binary keyed archive dates", () => {
Buffer.compare(await readFile(join(root, "archive.plist")), bytes),
).toBe(0);
});
});
describe("binary keyed archive invalid dates", () => {
const selection = { offset: 0, limit: 10 };
it.each(
[0x30, 0x31, 0x32, 0x34].map(
@@ -640,11 +640,17 @@ describe("binary keyed archive dates", () => {
copy[offset] = marker;
});
const original = Buffer.from(bytes);
expect(() => decodeKeyedArchiveBytes(bytes, selection)).toThrow(
new TypeError(
`binary plist date marker 0x${marker.toString(16)} is invalid`,
),
);
let decodeFailure: unknown;
try {
decodeKeyedArchiveBytes(bytes, selection);
} catch (cause: unknown) {
decodeFailure = cause;
}
expect(decodeFailure).toBeInstanceOf(TypeError);
if (!(decodeFailure instanceof Error))
throw new Error("Expected invalid date marker to fail");
expect(decodeFailure.message).toContain(`0x${marker.toString(16)}`);
expect(decodeFailure.message).toMatch(/date marker.*invalid/iu);
expect(Buffer.compare(bytes, original)).toBe(0);
if (marker === 0x30)
expect(createHash("sha256").update(bytes).digest("hex")).toBe(
@@ -662,7 +668,7 @@ describe("binary keyed archive dates", () => {
).rejects.toMatchObject({
name: "ArtifactReaderFailure",
reason: "format",
message: `Cannot decode selected Foundation keyed archive: binary plist date marker 0x${marker.toString(16)} is invalid`,
message: expect.stringContaining(decodeFailure.message),
});
expect(Buffer.compare(await readFile(path), bytes)).toBe(0);
},
@@ -817,16 +823,16 @@ describe("binary plist date object region", () => {
bytes.writeBigUInt64BE(BigInt(offsetTable), trailer + 24);
expect(() =>
estimateBinaryPlistExpansion(bytes, 1024 * 1024, { bounds: "strict" }),
).toThrow(new TypeError("binary plist date object is truncated"));
).toThrow(/date.*truncated/iu);
// Decoder bounds extend other objects to the end of the file. The date
// payload still has to end at the offset table. The keyed-archive reader
// uses those bounds and must refuse the same payload.
expect(() =>
estimateBinaryPlistExpansion(bytes, 1024 * 1024, { bounds: "decoder" }),
).toThrow(new TypeError("binary plist date object is truncated"));
).toThrow(/date.*truncated/iu);
expect(() =>
decodeKeyedArchiveBytes(bytes, { offset: 0, limit: 1 }),
).toThrow(new TypeError("binary plist date object is truncated"));
).toThrow(/date.*truncated/iu);
});
it("refuses a decoder-bounds date whose marker sits past the offset table", () => {
@@ -845,10 +851,10 @@ describe("binary plist date object region", () => {
bytes.writeBigUInt64BE(8n, trailer + 24);
expect(() =>
estimateBinaryPlistExpansion(bytes, 1024 * 1024, { bounds: "decoder" }),
).toThrow(new TypeError("binary plist date object is truncated"));
).toThrow(/date.*truncated/iu);
expect(() =>
decodeKeyedArchiveBytes(bytes, { offset: 0, limit: 1 }),
).toThrow(new TypeError("binary plist date object is truncated"));
).toThrow(/date.*truncated/iu);
});
});
+18 -12
View File
@@ -176,10 +176,13 @@ describe("FIT image facts", () => {
}),
).images;
expect(image?.metadata).toMatchObject({ load: null, arch: null });
expect(image?.limitations).toEqual([
"/images/kernel: arch is not a NUL-terminated UTF-8 string",
"/images/kernel: load is not a 1- or 2-cell address",
]);
expect(image?.limitations).toHaveLength(2);
expect(image?.limitations).toEqual(
expect.arrayContaining([
expect.stringMatching(/\/images\/kernel.*arch.*NUL.*UTF-8/iu),
expect.stringMatching(/\/images\/kernel.*load.*1- or 2-cell/iu),
]),
);
});
});
@@ -275,8 +278,9 @@ describe("FIT image data ranges", () => {
),
).toMatchObject({
reason: "format",
message:
"FIT is malformed: /images/chained: image-data target /images/shared has its own image-data",
message: expect.stringMatching(
/\/images\/chained.*image-data.*\/images\/shared/iu,
),
});
});
@@ -293,8 +297,9 @@ describe("FIT image data ranges", () => {
),
).toMatchObject({
reason: "format",
message:
"FIT is malformed: image data overlaps: /images/shared and the FIT devicetree",
message: expect.stringMatching(
/overlaps.*\/images\/shared.*devicetree/iu,
),
});
});
@@ -325,7 +330,7 @@ describe("FIT image data ranges", () => {
])("fails %s", (_name, file, message) => {
expect(failureOf(file)).toMatchObject({
reason: "format",
message: `FIT is malformed: ${message}`,
message: expect.stringContaining(message),
});
});
});
@@ -395,8 +400,9 @@ describe("FIT hashes", () => {
),
).toMatchObject({
reason: "integrity",
message:
"FIT image kernel hash-1 sha256 value is 31 bytes; sha256 values are 32 bytes",
message: expect.stringMatching(
/kernel.*hash-1.*sha256.*31 bytes.*32 bytes/iu,
),
});
});
});
@@ -567,7 +573,7 @@ describe("FIT fixed limits", () => {
it("fails a structure without /images", () => {
expect(failureOf(devicetreeFixture())).toMatchObject({
reason: "format",
message: "FIT is malformed: /images node is missing",
message: expect.stringMatching(/\/images.*missing/iu),
});
});
});
+120 -38
View File
@@ -4,20 +4,8 @@ import { expect, it } from "vitest";
import { ArtifactReaderFailure } from "../ArtifactReader.js";
import {
NODE_SEA_ASSET_COUNT,
NODE_SEA_ASSET_NAME_BYTES,
NODE_SEA_BAD_MAGIC,
NODE_SEA_EMPTY_CODE_PATH,
NODE_SEA_FUSE_CONFLICT,
NODE_SEA_FUSE_ABSENT,
NODE_SEA_FUSE_UNSET,
NODE_SEA_MAGIC,
NODE_SEA_TRAILING_BYTES,
NODE_SEA_TRUNCATED,
NODE_SEA_UNKNOWN_EXTENSION,
NODE_SEA_UNKNOWN_FLAGS,
decodeNodeSeaBlob,
nodeSeaAssetCollision,
observeNodeSeaFuseMatches,
} from "./NodeSeaBlob.js";
import { buildNodeSeaBlob } from "./NodeSea.fixture.js";
@@ -31,44 +19,59 @@ const header = (flags: number, extension = 1): Buffer => {
};
it("rejects a blob that ends before the magic", async () => {
await expect(decodeNodeSeaBlob(Buffer.from([0x20, 0xda]))).rejects.toThrow(
NODE_SEA_TRUNCATED,
);
await expect(
decodeNodeSeaBlob(Buffer.from([0x20, 0xda])),
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/Node SEA.*truncated/iu),
});
});
it("rejects a blob whose magic is not 0x143da20", async () => {
await expect(decodeNodeSeaBlob(Buffer.alloc(9))).rejects.toThrow(
NODE_SEA_BAD_MAGIC,
);
await expect(decodeNodeSeaBlob(Buffer.alloc(9))).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/magic.*not.*0x143da20/iu),
});
});
it("rejects a header that ends before the extension byte", async () => {
await expect(decodeNodeSeaBlob(header(0).subarray(0, 8))).rejects.toThrow(
NODE_SEA_TRUNCATED,
);
await expect(
decodeNodeSeaBlob(header(0).subarray(0, 8)),
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/Node SEA.*truncated/iu),
});
});
it("rejects unknown flag bits", async () => {
await expect(decodeNodeSeaBlob(header(1 << 5))).rejects.toThrow(
NODE_SEA_UNKNOWN_FLAGS,
);
await expect(decodeNodeSeaBlob(header(1 << 5))).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/flags.*unknown bits/iu),
});
});
it("rejects an unknown exec argv extension", async () => {
await expect(decodeNodeSeaBlob(header(0, 9))).rejects.toThrow(
NODE_SEA_UNKNOWN_EXTENSION,
);
await expect(decodeNodeSeaBlob(header(0, 9))).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/exec argv extension.*unknown/iu),
});
});
it("rejects an empty code path", async () => {
await expect(
decodeNodeSeaBlob(buildNodeSeaBlob({ codePath: "" })),
).rejects.toThrow(NODE_SEA_EMPTY_CODE_PATH);
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/code path.*empty/iu),
});
});
it("rejects a truncated length-prefixed field", async () => {
const bytes = Buffer.concat([header(0), Buffer.alloc(4)]);
await expect(decodeNodeSeaBlob(bytes)).rejects.toThrow(NODE_SEA_TRUNCATED);
await expect(decodeNodeSeaBlob(bytes)).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/Node SEA.*truncated/iu),
});
});
it("rejects colliding asset names", async () => {
@@ -81,7 +84,10 @@ it("rejects colliding asset names", async () => {
],
}),
),
).rejects.toThrow(nodeSeaAssetCollision("shared"));
).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/Node SEA asset name collides.*shared/iu),
});
});
it("retains an empty asset key as a raw Node SEA key", async () => {
@@ -91,6 +97,43 @@ it("retains an empty asset key as a raw Node SEA key", async () => {
expect(decoded.assets).toMatchObject([{ name: "", range: { length: 5 } }]);
});
it.each([
{
field: "code path",
build: (value: string) => buildNodeSeaBlob({ codePath: value }),
read: (blob: Awaited<ReturnType<typeof decodeNodeSeaBlob>>) =>
blob.codePath,
},
{
field: "asset name",
build: (value: string) =>
buildNodeSeaBlob({ assets: [{ name: value, body: "" }] }),
read: (blob: Awaited<ReturnType<typeof decodeNodeSeaBlob>>) =>
blob.assets[0]?.name,
},
{
field: "exec argument",
build: (value: string) => buildNodeSeaBlob({ execArgv: [value] }),
read: (blob: Awaited<ReturnType<typeof decodeNodeSeaBlob>>) =>
blob.execArgv[0],
},
])(
"rejects invalid UTF-8 in $field while preserving a literal replacement character",
async ({ build, read }) => {
const valid = await decodeNodeSeaBlob(build("\ufffd"));
expect(read(valid)).toBe("\ufffd");
const malformed = build("fixture-marker");
const offset = malformed.indexOf("fixture-marker");
expect(offset).toBeGreaterThanOrEqual(0);
malformed[offset] = 0xff;
await expect(decodeNodeSeaBlob(malformed)).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/not valid UTF-8/iu),
});
},
);
const limitOf = async (bytes: Buffer): Promise<ArtifactReaderFailure> => {
try {
await decodeNodeSeaBlob(bytes);
@@ -110,7 +153,9 @@ it("refuses an asset table over its count bound before creating records", async
const failure = await limitOf(bytes);
expect(failure).toMatchObject({
reason: "limit",
message: NODE_SEA_ASSET_COUNT,
message: expect.stringMatching(
/asset count.*100000.*no runtime override/iu,
),
});
});
@@ -126,17 +171,52 @@ it("refuses asset names over the decoded name budget", async () => {
);
expect(failure).toMatchObject({
reason: "limit",
message: NODE_SEA_ASSET_NAME_BYTES,
message: expect.stringMatching(
/asset names.*8388608.*no runtime override/iu,
),
});
});
it.each([
{
label: "count",
accepted: () => Array.from({ length: 4096 }, () => "x"),
args: () => Array.from({ length: 4097 }, () => "x"),
boundary: "capacity",
warning: /exec argv count.*4096.*no runtime override/iu,
},
{
label: "text",
accepted: () => ["x".repeat(1024 * 1024)],
args: () => ["x".repeat(1024 * 1024 + 1)],
boundary: "memory",
warning: /exec argv text.*1048576.*no runtime override/iu,
},
])(
"admits exec argument $label at its bound and refuses more",
async ({ accepted, args, boundary, warning }) => {
const atLimit = accepted();
expect(
(await decodeNodeSeaBlob(buildNodeSeaBlob({ execArgv: atLimit })))
.execArgv,
).toEqual(atLimit);
const failure = await limitOf(buildNodeSeaBlob({ execArgv: args() }));
expect(failure).toMatchObject({
reason: "limit",
boundary,
message: expect.stringMatching(warning),
});
},
);
it("rejects non-zero trailing bytes and keeps zero padding", async () => {
const padded = buildNodeSeaBlob({ trailing: Buffer.alloc(8) });
expect((await decodeNodeSeaBlob(padded)).codePath).toBe("sea.js");
const dirty = Buffer.concat([padded, Buffer.from([1])]);
await expect(decodeNodeSeaBlob(dirty)).rejects.toThrow(
NODE_SEA_TRAILING_BYTES,
);
await expect(decodeNodeSeaBlob(dirty)).rejects.toMatchObject({
reason: "format",
message: expect.stringMatching(/trailing bytes/iu),
});
});
it("decodes flags, the main script, code cache, assets, and exec argv", async () => {
@@ -186,13 +266,15 @@ it("reports an absent, unset, set, or conflicting fuse sentinel", () => {
expect(observeNodeSeaFuseMatches([])).toMatchObject({
fuseState: "absent",
fuseSentinel: null,
fuseContradiction: NODE_SEA_FUSE_ABSENT,
fuseContradiction: expect.stringMatching(
/no NODE_SEA_FUSE sentinel.*observed/iu,
),
});
const unset = `NODE_SEA_FUSE_${"a".repeat(32)}:0`;
expect(observeNodeSeaFuseMatches([unset, unset])).toMatchObject({
fuseState: "unset",
fuseSentinel: unset,
fuseContradiction: NODE_SEA_FUSE_UNSET,
fuseContradiction: expect.stringMatching(/NODE_SEA_FUSE sentinel.*unset/iu),
});
const set = `NODE_SEA_FUSE_${"b".repeat(32)}:1`;
expect(observeNodeSeaFuseMatches([set])).toMatchObject({
@@ -203,7 +285,7 @@ it("reports an absent, unset, set, or conflicting fuse sentinel", () => {
expect(observeNodeSeaFuseMatches([unset, set])).toMatchObject({
fuseState: "conflicting",
fuseSentinel: null,
fuseContradiction: NODE_SEA_FUSE_CONFLICT,
fuseContradiction: expect.stringMatching(/fuse sentinels disagree/iu),
});
});
+15 -19
View File
@@ -30,13 +30,11 @@ const MAX_EXEC_ARGV = 4096;
const MAX_EXEC_ARGV_TEXT_BYTES = 1024 * 1024;
const NO_OVERRIDE = "This release has no runtime override.";
export const NODE_SEA_BAD_MAGIC = "Node SEA blob magic is not 0x143da20";
const NODE_SEA_BAD_MAGIC = "Node SEA blob magic is not 0x143da20";
export const NODE_SEA_TRUNCATED = "Node SEA blob is truncated";
export const NODE_SEA_UNKNOWN_FLAGS =
"Node SEA blob flags contain unknown bits";
export const NODE_SEA_UNKNOWN_EXTENSION =
"Node SEA exec argv extension is unknown";
export const NODE_SEA_TRAILING_BYTES = "Node SEA blob has trailing bytes";
const NODE_SEA_UNKNOWN_FLAGS = "Node SEA blob flags contain unknown bits";
const NODE_SEA_UNKNOWN_EXTENSION = "Node SEA exec argv extension is unknown";
const NODE_SEA_TRAILING_BYTES = "Node SEA blob has trailing bytes";
export const NODE_SEA_DUPLICATE_BLOB =
"Node SEA blob is declared more than once";
export const NODE_SEA_ELF_DESCRIPTOR_TRUNCATED =
@@ -49,22 +47,19 @@ export const NODE_SEA_MACHO_COMMANDS_TRUNCATED =
"Node SEA Mach-O load commands are truncated";
export const NODE_SEA_MACHO_SEGMENT_TRUNCATED =
"Node SEA Mach-O segment table is truncated";
export const NODE_SEA_FUSE_ABSENT =
const NODE_SEA_FUSE_ABSENT =
"Node SEA blob is present but no NODE_SEA_FUSE sentinel was observed";
export const NODE_SEA_FUSE_UNSET =
const NODE_SEA_FUSE_UNSET =
"Node SEA blob is present but the NODE_SEA_FUSE sentinel is unset";
export const NODE_SEA_FUSE_CONFLICT = "Node SEA fuse sentinels disagree";
export const NODE_SEA_EMPTY_CODE_PATH = "Node SEA code path is empty";
export const NODE_SEA_INVALID_UTF8 = "Node SEA string is not valid UTF-8";
export const NODE_SEA_ASSET_COUNT = `Node SEA asset count exceeds the ${String(MAX_ASSET_COUNT)}-asset bound. ${NO_OVERRIDE}`;
export const NODE_SEA_ASSET_NAME_BYTES = `Node SEA asset names exceed the ${String(MAX_ASSET_NAME_BYTES)}-byte name budget. ${NO_OVERRIDE}`;
export const NODE_SEA_EXEC_ARGV_COUNT = `Node SEA exec argv count exceeds the ${String(MAX_EXEC_ARGV)}-argument bound. ${NO_OVERRIDE}`;
export const NODE_SEA_EXEC_ARGV_TEXT = `Node SEA exec argv text exceeds the ${String(MAX_EXEC_ARGV_TEXT_BYTES)}-byte bound. ${NO_OVERRIDE}`;
const NODE_SEA_FUSE_CONFLICT = "Node SEA fuse sentinels disagree";
const NODE_SEA_EMPTY_CODE_PATH = "Node SEA code path is empty";
const NODE_SEA_INVALID_UTF8 = "Node SEA string is not valid UTF-8";
const NODE_SEA_ASSET_COUNT = `Node SEA asset count exceeds the ${String(MAX_ASSET_COUNT)}-asset bound. ${NO_OVERRIDE}`;
const NODE_SEA_ASSET_NAME_BYTES = `Node SEA asset names exceed the ${String(MAX_ASSET_NAME_BYTES)}-byte name budget. ${NO_OVERRIDE}`;
const NODE_SEA_EXEC_ARGV_COUNT = `Node SEA exec argv count exceeds the ${String(MAX_EXEC_ARGV)}-argument bound. ${NO_OVERRIDE}`;
const NODE_SEA_EXEC_ARGV_TEXT = `Node SEA exec argv text exceeds the ${String(MAX_EXEC_ARGV_TEXT_BYTES)}-byte bound. ${NO_OVERRIDE}`;
export const NODE_SEA_BLOB_TOO_LARGE = `Node SEA blob exceeds the ${String(NODE_SEA_MAX_BLOB_BYTES)}-byte in-memory bound`;
export const nodeSeaAssetCollision = (name: string): string =>
`Node SEA asset name collides: ${name}`;
const FUSE_PREFIX = "NODE_SEA_FUSE_";
export interface NodeSeaByteRange {
@@ -276,7 +271,8 @@ class BlobCursor {
assertArtifactReadActive(signal);
}
const name = this.text(true, NODE_SEA_INVALID_UTF8, charge);
if (seen.has(name)) throw formatFailure(nodeSeaAssetCollision(name));
if (seen.has(name))
throw formatFailure(`Node SEA asset name collides: ${name}`);
seen.add(name);
assets.push({ name, range: this.byteRange() });
}
@@ -3,6 +3,7 @@ import { join } from "node:path";
import { expect, it, vi } from "vitest";
import { createTestTempDirectory } from "../../../tests/fixtures/temporaryDirectory.js";
import { withOwnedRegularFile } from "../../filesystem/OwnedRegularFile.js";
import type { OwnedFileHandle } from "../../filesystem/OwnedFileHandle.js";
import { ArtifactEmbeddedFormatProbes } from "../ArtifactEmbeddedFormatProbes.js";
import { ArtifactResourceScope } from "../ArtifactResourceScope.js";
import { inventoryArtifact } from "../inventory/ArtifactInventory.js";
@@ -61,6 +62,7 @@ it.each([
}),
);
const resourceScope = new ArtifactResourceScope();
let rootOwner: OwnedFileHandle | undefined;
try {
const classified = await classifyAndHashRootForInventory(
path,
@@ -68,6 +70,7 @@ it.each([
await lstat(path),
{ resourceScope },
);
rootOwner = classified.rootSource?.owner;
const admission = classified.readerAdmission;
if (
admission === undefined ||
@@ -95,8 +98,23 @@ it.each([
await reader.close();
}
} finally {
await resourceScope.close();
try {
if (rootOwner !== undefined) {
const cleanup = await resourceScope.release({
kind: "file-handle",
resource: `root artifact descriptor for ${path}`,
handle: rootOwner,
});
if (cleanup.kind === "failed")
throw resourceScope.cleanupFailure({ kind: "completed" }, [
cleanup,
]);
}
} finally {
await resourceScope.close();
}
}
expect(rootOwner?.handle.fd).toBe(-1);
},
);
@@ -314,7 +332,7 @@ it("does not cache an incomplete tail read as an absent cookie and can retry", a
try {
await expect(probes.pyInstaller()).rejects.toMatchObject({
reason: "format",
message: "CArchive tail is truncated",
message: expect.stringMatching(/tail.*truncated/iu),
});
expect(calls).toBe(2);
expect(Object.hasOwn(probes.completedFacts(), "pyInstaller")).toBe(false);
@@ -463,7 +463,6 @@ it.each(["empty", "span"])(
: parsed.value.kind === "opaque"
? parsed.value.limitation
: undefined;
expect(message).toBeDefined();
expect(message?.length).toBeLessThan(256);
expect(message).toContain("table index 0");
});
+4 -2
View File
@@ -140,8 +140,10 @@ describe("PNG visual diff", () => {
}),
);
expect(result).toMatchObject({ status: "identical", changed_pixels: 0 });
expect(result.limitations).toContain(
"PNG tRNS transparency is accepted only as a six-byte RGB color key; tRNS on RGBA or with another length is rejected.",
expect(result.limitations).toContainEqual(
expect.stringMatching(
/tRNS.*only.*six-byte RGB.*RGBA.*another length.*rejected/iu,
),
);
});
+14 -4
View File
@@ -794,9 +794,13 @@ it.each(["[2001:db8::1]", "[::1]", "[::ffff:192.0.2.1]"])(
_extension: { serverIPAddress: address },
},
});
expect(decoded.records[0]?.limitations).toContain(
"This capture declares Playwright 1.58.2 and reports bracketed IPv6 serverIPAddress. Original spellings are retained; brackets were removed only from valid IPv6 values in the validation copy. Producer declarations are not authenticated.",
const limitation = decoded.records[0]?.limitations.find((line) =>
line.includes("Playwright 1.58.2"),
);
expect(limitation).toMatch(/bracketed IPv6.*serverIPAddress/iu);
expect(limitation).toMatch(/original spellings.*retained/iu);
expect(limitation).toMatch(/brackets.*only.*valid IPv6.*validation copy/iu);
expect(limitation).toMatch(/producer declarations.*not authenticated/iu);
expect(
decoded.records[1]?.limitations.some((limitation) =>
limitation.includes("bracketed IPv6 serverIPAddress"),
@@ -825,9 +829,15 @@ it.each(["[2620:0:860:ed1a::1]", "[::1]"])(
expect(decoded.records[0]).toMatchObject({
reported: { serverIPAddress: address },
});
expect(decoded.records[0]?.limitations).toContain(
"This capture declares Chromium DevTools (WebInspector 537.36) and reports bracketed IPv6 serverIPAddress. Original spellings are retained; brackets were removed only from valid IPv6 values in the validation copy. Producer declarations are not authenticated.",
const limitation = decoded.records[0]?.limitations.find((line) =>
line.includes("WebInspector 537.36"),
);
expect(limitation).toMatch(
/Chromium DevTools.*bracketed IPv6.*serverIPAddress/iu,
);
expect(limitation).toMatch(/original spellings.*retained/iu);
expect(limitation).toMatch(/brackets.*only.*valid IPv6.*validation copy/iu);
expect(limitation).toMatch(/producer declarations.*not authenticated/iu);
expect(
decoded.records[1]?.limitations.some((limitation) =>
limitation.includes("bracketed IPv6 serverIPAddress"),
@@ -51,11 +51,11 @@ it("imports real v10 recorder text with per-stream identity and resource presenc
expect(
report.events.find((row) => row.method === "click")?.selector,
).toContain("Load value");
expect(
report.events
.flatMap((row) => row.resource_references)
.every((row) => row.state === "present-unread"),
).toBe(true);
const references = report.events.flatMap((row) => row.resource_references);
expect(references).toHaveLength(8);
expect(references.every((row) => row.state === "present-unread")).toBe(
true,
);
expect((await readFile(fixture.path)).equals(bytes)).toBe(true);
} finally {
await resources.close();
@@ -128,10 +128,14 @@ it("keeps missing resource references explicit without turning page exhaustion i
if (!result.ok) throw result.error;
expect(result.value.summary.unavailable_references).toBe(8);
expect(result.value.source_coverage.interpretation).toBe("partial");
const references = result.value.events.flatMap(
(row) => row.resource_references,
);
expect(references).toHaveLength(8);
expect(
result.value.events
.flatMap((row) => row.resource_references)
.every((row) => row.state === "missing" && row.matching_members === 0),
references.every(
(row) => row.state === "missing" && row.matching_members === 0,
),
).toBe(true);
} finally {
await resources.close();
@@ -197,6 +201,7 @@ it.each([
if (!result.ok) throw result.error;
expect(result.value.events).toHaveLength(events);
expect(result.value.source_coverage.interpretation).toBe("partial");
expect(result.value.streams.length).toBeGreaterThan(0);
expect(
result.value.streams.every((stream) => stream.state === "unknown"),
).toBe(true);
@@ -128,8 +128,9 @@ it.each(["grpc-web", "grpc-web-text"] as const)(
status: "partial",
examined_bytes: trailer.length,
error: {
reason:
"gRPC-web trailer field contains opaque non-UTF-8 bytes; that field was omitted",
reason: expect.stringMatching(
/gRPC-web trailer.*non-UTF-8 bytes.*field was omitted/i,
),
},
trailers: [
{ name: "grpc-status", value: "0" },
+1 -1
View File
@@ -41,7 +41,7 @@ const RECORD_BOUNDARY_PATHS = [
] as const;
/** Recovery for every JSON Lines selection refusal; the analysis result itself is valid. */
export const JSON_LINES_SELECTION_REMEDIATION =
const JSON_LINES_SELECTION_REMEDIATION =
"Use --format json for the complete document, or select one record collection with --filter-output.";
interface Collection {
+1 -1
View File
@@ -179,7 +179,7 @@ export const snapshotSelectionOption = z
* Explicit interpretation for headerless native executable formats. Flash
* dumps take their offsets on the artifact commands instead.
*/
export const formatSelectionOption = executableFormatHintSchema
const formatSelectionOption = executableFormatHintSchema
.exclude(["esp-flash-image"])
.optional()
.describe(
+12 -8
View File
@@ -440,18 +440,22 @@ describe("configuration failure diagnostics", () => {
const result = parseConfig({ [setting]: value });
expect(result.ok).toBe(false);
if (result.ok) return;
const constraint = `${setting} must be absolute`;
expect(projectAnalysisError(result.error)).toMatchObject({
const projected = projectAnalysisError(result.error);
expect(projected).toMatchObject({
code: "configuration_invalid",
category: "invalid_input",
message: `REA configuration is invalid: ${constraint}.`,
remediation: { action: expect.stringContaining(`Correct ${setting} `) },
details: { settings: [{ setting, constraint }] },
message: expect.stringContaining(setting),
remediation: { action: expect.stringContaining(setting) },
details: {
settings: [
{ setting, constraint: expect.stringMatching(/absolute/iu) },
],
},
});
expect(projected.message).toMatch(/absolute/iu);
expect(projected.remediation.action).toMatch(/correct/iu);
// The rejected value itself is not echoed.
expect(JSON.stringify(projectAnalysisError(result.error))).not.toContain(
value,
);
expect(JSON.stringify(projected)).not.toContain(value);
},
);
+1 -1
View File
@@ -20,7 +20,7 @@ export const DEFAULT_ASAR_HEADER_ADMISSION: AsarHeaderAdmission = {
source: "default",
};
export const asarMaxHeaderBytesConstraint = `${ASAR_HEADER_ADMISSION_SETTING} must be a positive decimal integer of at most ${String(MAXIMUM_ASAR_MAX_HEADER_BYTES)} bytes (256 MiB); the default is ${String(DEFAULT_ASAR_MAX_HEADER_BYTES)} bytes (16 MiB).`;
const asarMaxHeaderBytesConstraint = `${ASAR_HEADER_ADMISSION_SETTING} must be a positive decimal integer of at most ${String(MAXIMUM_ASAR_MAX_HEADER_BYTES)} bytes (256 MiB); the default is ${String(DEFAULT_ASAR_MAX_HEADER_BYTES)} bytes (16 MiB).`;
/** Optional decimal byte count for the ASAR header/index admission. */
export const asarMaxHeaderBytesSchema = z
+9 -4
View File
@@ -5,7 +5,6 @@ import { parseEnvironment } from "./environment.js";
import { parseConfig } from "./parseConfig.js";
import {
BRIDGE_MAX_REQUEST_BYTES_SETTING,
bridgeMaxRequestBytesConstraint,
DEFAULT_BRIDGE_MAX_REQUEST,
DEFAULT_BRIDGE_MAX_REQUEST_BYTES,
MAXIMUM_BRIDGE_MAX_REQUEST_BYTES,
@@ -119,10 +118,16 @@ it.each([
const parsed = parseBridgeMaxRequestBytes(value);
expect(parsed.ok).toBe(false);
if (parsed.ok) return;
expect(parsed.error.message).toContain(BRIDGE_MAX_REQUEST_BYTES_SETTING);
expect(parsed.error.message).toMatch(/positive decimal integer/i);
expect(parsed.error.message).toMatch(/7464 to 536870887 bytes/i);
expect(parsed.error.message).toMatch(/default.*16777216 bytes/i);
expect(parsed.error.message).toMatch(/symbol.name/i);
expect(parsed.error.message).toMatch(/framing/i);
expect(parsed.error.settings).toEqual([
{
setting: BRIDGE_MAX_REQUEST_BYTES_SETTING,
constraint: bridgeMaxRequestBytesConstraint,
constraint: parsed.error.message,
},
]);
expect(projectAnalysisError(parsed.error).code).toBe("configuration_invalid");
@@ -134,12 +139,12 @@ it.each([
expect(startup.error._tag).toBe("ConfigurationError");
expect(startup.error.settings).toContainEqual({
setting: BRIDGE_MAX_REQUEST_BYTES_SETTING,
constraint: bridgeMaxRequestBytesConstraint,
constraint: parsed.error.message,
});
if (doctor.ok) throw new Error(`Doctor accepted ${JSON.stringify(value)}`);
expect(doctor.error._tag).toBe("ConfigurationError");
expect(doctor.error.settings).toContainEqual({
setting: BRIDGE_MAX_REQUEST_BYTES_SETTING,
constraint: bridgeMaxRequestBytesConstraint,
constraint: parsed.error.message,
});
});
+1 -1
View File
@@ -62,7 +62,7 @@ export const DEFAULT_BRIDGE_MAX_REQUEST: BridgeMaxRequestBytes = {
*/
export type BridgePeer = "Hopper" | "Cutter" | "Ghidra";
export const bridgeMaxRequestBytesConstraint = `${BRIDGE_MAX_REQUEST_BYTES_SETTING} must be a positive decimal integer from ${String(MINIMUM_BRIDGE_MAX_REQUEST_BYTES)} to ${String(MAXIMUM_BRIDGE_MAX_REQUEST_BYTES)} bytes; the default is ${String(DEFAULT_BRIDGE_MAX_REQUEST_BYTES)} bytes (16 MiB). A value below ${String(MINIMUM_BRIDGE_MAX_REQUEST_BYTES)} bytes cannot carry the largest admitted symbol-name command, and a larger value is refused so the encoded payload plus its framing LF stays one string under Node's single-string ceiling.`;
const bridgeMaxRequestBytesConstraint = `${BRIDGE_MAX_REQUEST_BYTES_SETTING} must be a positive decimal integer from ${String(MINIMUM_BRIDGE_MAX_REQUEST_BYTES)} to ${String(MAXIMUM_BRIDGE_MAX_REQUEST_BYTES)} bytes; the default is ${String(DEFAULT_BRIDGE_MAX_REQUEST_BYTES)} bytes (16 MiB). A value below ${String(MINIMUM_BRIDGE_MAX_REQUEST_BYTES)} bytes cannot carry the largest admitted symbol-name command, and a larger value is refused so the encoded payload plus its framing LF stays one string under Node's single-string ceiling.`;
/** Optional decimal byte count for the Hopper and Cutter request payload ceiling. */
export const bridgeMaxRequestBytesSchema = positiveDecimalIntegerSchema(
+21 -4
View File
@@ -19,7 +19,6 @@ import { parseEnvironment } from "./environment.js";
import { parseConfig } from "./parseConfig.js";
import {
CAPTURE_DECODER_OLD_GENERATION_SETTING,
captureDecoderHeapConstraint,
DEFAULT_CAPTURE_DECODER_HEAP,
parseCaptureDecoderHeap,
} from "./captureDecoderHeap.js";
@@ -105,6 +104,18 @@ it("uses a valid REA_CAPTURE_DECODER_OLD_GENERATION_MIB override", async () => {
);
expect(projected.remediation.action).toContain("update_analysis_settings");
expect(projected.remediation.action).toMatch(/restart REA/iu);
expect(projected.remediation.action).toContain(
"capture.decoder_old_generation_mib",
);
expect(projected.remediation.action).toMatch(/without a REA restart/iu);
expect(projected.remediation.action).toMatch(
/removes inherited NODE_OPTIONS/iu,
);
expect(projected.remediation.action).toMatch(/Bun.*V8 flags are ignored/iu);
expect(projected.remediation.action).toMatch(/Windows.*512 MiB reserve/iu);
expect(projected.remediation.action).toMatch(
/Other Bun hosts enforce no decoder heap limit/iu,
);
if (process.versions.bun === undefined)
expect(projected.details).toMatchObject({
limit: {
@@ -231,20 +242,26 @@ it.each([
const parsed = parseCaptureDecoderHeap(value);
if (parsed.ok) throw new Error(`Accepted ${JSON.stringify(value)}`);
expect(parsed.error).toBeInstanceOf(ConfigurationError);
expect(parsed.error.message).toContain(
CAPTURE_DECODER_OLD_GENERATION_SETTING,
);
expect(parsed.error.message).toMatch(/decimal integer/i);
expect(parsed.error.message).toMatch(/8 to 16384 MiB/i);
expect(parsed.error.message).toMatch(/default.*192 MiB/i);
expect(parsed.error.message).toMatch(/semi-space.*abort.*Node.*startup/i);
expect(parsed.error.settings).toEqual([
{
setting: CAPTURE_DECODER_OLD_GENERATION_SETTING,
constraint: captureDecoderHeapConstraint,
constraint: parsed.error.message,
},
]);
expect(parsed.error.message).toBe(captureDecoderHeapConstraint);
const startup = parseEnvironment({
REA_CAPTURE_DECODER_OLD_GENERATION_MIB: value,
});
if (startup.ok) throw new Error(`Startup accepted ${JSON.stringify(value)}`);
expect(startup.error.settings).toContainEqual({
setting: CAPTURE_DECODER_OLD_GENERATION_SETTING,
constraint: captureDecoderHeapConstraint,
constraint: parsed.error.message,
});
const config = parseConfig({
REA_CAPTURE_DECODER_OLD_GENERATION_MIB: value,
+1 -1
View File
@@ -22,7 +22,7 @@ export const DEFAULT_CAPTURE_DECODER_HEAP: CaptureDecoderHeap = {
source: "default",
};
export const captureDecoderHeapConstraint = `${CAPTURE_DECODER_OLD_GENERATION_SETTING} must be a decimal integer from ${String(CAPTURE_DECODER_SEMI_SPACE_MIB)} to ${String(MAXIMUM_CAPTURE_DECODER_OLD_GENERATION_MIB)} MiB; the default is ${String(DEFAULT_CAPTURE_DECODER_OLD_GENERATION_MIB)} MiB. An old generation below the decoder's ${String(CAPTURE_DECODER_SEMI_SPACE_MIB)} MiB semi-space aborts Node during startup instead of enforcing a limit, and a larger value is refused.`;
const captureDecoderHeapConstraint = `${CAPTURE_DECODER_OLD_GENERATION_SETTING} must be a decimal integer from ${String(CAPTURE_DECODER_SEMI_SPACE_MIB)} to ${String(MAXIMUM_CAPTURE_DECODER_OLD_GENERATION_MIB)} MiB; the default is ${String(DEFAULT_CAPTURE_DECODER_OLD_GENERATION_MIB)} MiB. An old generation below the decoder's ${String(CAPTURE_DECODER_SEMI_SPACE_MIB)} MiB semi-space aborts Node during startup instead of enforcing a limit, and a larger value is refused.`;
/** Optional decimal mebibyte count for the HAR/SAZ/qlog old-generation heap. */
export const captureDecoderOldGenerationMiBSchema =
+41 -17
View File
@@ -21,10 +21,6 @@ import {
DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_SETTING,
DEBUGGER_MAX_PENDING_COMMANDS_SETTING,
DEBUGGER_MAX_SESSIONS_SETTING,
debuggerCommandDeadlineConstraint,
debuggerMaxCommandOutputBytesConstraint,
debuggerMaxPendingCommandsConstraint,
debuggerMaxSessionsConstraint,
parseDebuggerSessionLimits,
resolveDebuggerSessionLimits,
} from "./debuggerSessionLimits.js";
@@ -93,30 +89,59 @@ it("accepts one in-range override for each shared debugger cap", () => {
});
it.each([
[DEBUGGER_COMMAND_DEADLINE_SETTING, "0", debuggerCommandDeadlineConstraint],
[DEBUGGER_MAX_SESSIONS_SETTING, "65", debuggerMaxSessionsConstraint],
[
DEBUGGER_COMMAND_DEADLINE_SETTING,
"0",
MINIMUM_DEBUGGER_COMMAND_DEADLINE_MS,
MAXIMUM_DEBUGGER_COMMAND_DEADLINE_MS,
120_000,
"ms",
],
[
DEBUGGER_MAX_SESSIONS_SETTING,
"65",
MINIMUM_DEBUGGER_MAX_SESSIONS,
MAXIMUM_DEBUGGER_MAX_SESSIONS,
8,
"sessions",
],
[
DEBUGGER_MAX_PENDING_COMMANDS_SETTING,
"00",
debuggerMaxPendingCommandsConstraint,
MINIMUM_DEBUGGER_MAX_PENDING_COMMANDS,
MAXIMUM_DEBUGGER_MAX_PENDING_COMMANDS,
16,
"commands",
],
[
DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_SETTING,
String(MAXIMUM_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES + 1),
debuggerMaxCommandOutputBytesConstraint,
MINIMUM_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES,
MAXIMUM_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES,
16 * 1024 * 1024,
"bytes",
],
])(
"rejects invalid %s at the setting boundary",
(setting, value, constraint) => {
(setting, value, minimum, maximum, defaultValue, unit) => {
const parsed = parseDebuggerSessionLimits({ [setting]: value });
if (parsed.ok) throw new Error(`${setting} was accepted`);
expect(parsed.error).toBeInstanceOf(ConfigurationError);
expect(parsed.error.settings).toEqual([{ setting, constraint }]);
expect(parsed.error.settings).toHaveLength(1);
const detail = parsed.error.settings[0];
if (!detail) throw new Error("missing setting guidance");
expect(detail.setting).toBe(setting);
expect(detail.constraint).toContain(setting);
expect(detail.constraint).toMatch(/positive decimal integer/i);
expect(detail.constraint).toContain(
`from ${minimum} to ${maximum} ${unit}`,
);
expect(detail.constraint).toContain(`default is ${defaultValue} ${unit}`);
const startup = parseEnvironment({ [setting]: value });
if (startup.ok) throw new Error(`${setting} was accepted at startup`);
expect(projectAnalysisError(startup.error)).toMatchObject({
code: "configuration_invalid",
details: { settings: [{ setting, constraint }] },
details: { settings: [detail] },
});
},
);
@@ -229,6 +254,10 @@ it("refuses an invalid GDB deadline before a session starts", () => {
environment: { [DEBUGGER_COMMAND_DEADLINE_SETTING]: "0" },
}),
).toThrow(ConfigurationError);
const parsed = parseDebuggerSessionLimits({
[DEBUGGER_COMMAND_DEADLINE_SETTING]: "0",
});
if (parsed.ok) throw new Error("invalid deadline was accepted");
try {
new GdbSessionManager({
environment: { [DEBUGGER_COMMAND_DEADLINE_SETTING]: "0" },
@@ -238,12 +267,7 @@ it("refuses an invalid GDB deadline before a session starts", () => {
expect(projectAnalysisError(error)).toMatchObject({
code: "configuration_invalid",
details: {
settings: [
{
setting: DEBUGGER_COMMAND_DEADLINE_SETTING,
constraint: debuggerCommandDeadlineConstraint,
},
],
settings: parsed.error.settings,
},
});
}
+5 -12
View File
@@ -34,7 +34,7 @@ export const DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_SETTING =
export interface DebuggerAdmissionLimit {
readonly setting: string;
readonly value: number;
readonly source: "default" | "setting" | "runtime";
readonly source: "default" | "setting";
readonly defaultValue: number;
readonly minimum: number;
readonly maximum: number;
@@ -96,16 +96,16 @@ const constraintFor = (admission: DebuggerAdmissionLimit): string =>
: ""
}`;
export const debuggerCommandDeadlineConstraint = constraintFor(
const debuggerCommandDeadlineConstraint = constraintFor(
DEFAULT_DEBUGGER_COMMAND_DEADLINE,
);
export const debuggerMaxSessionsConstraint = constraintFor(
const debuggerMaxSessionsConstraint = constraintFor(
DEFAULT_DEBUGGER_MAX_SESSIONS_LIMIT,
);
export const debuggerMaxPendingCommandsConstraint = constraintFor(
const debuggerMaxPendingCommandsConstraint = constraintFor(
DEFAULT_DEBUGGER_MAX_PENDING_COMMANDS_LIMIT,
);
export const debuggerMaxCommandOutputBytesConstraint = constraintFor(
const debuggerMaxCommandOutputBytesConstraint = constraintFor(
DEFAULT_DEBUGGER_MAX_COMMAND_OUTPUT_BYTES_LIMIT,
);
@@ -243,10 +243,3 @@ export const debuggerControlReplyOutput: DebuggerAdmissionLimit = {
maximum: DEBUGGER_CONTROL_REPLY_BYTES,
unit: "bytes",
};
/** Test and caller seams replace the launch value and record that source. */
export const applyDebuggerAdmissionOverride = (
admission: DebuggerAdmissionLimit,
value: number | undefined,
): DebuggerAdmissionLimit =>
value === undefined ? admission : { ...admission, value, source: "runtime" };
+1 -1
View File
@@ -2,7 +2,7 @@ import { isAbsolute, basename } from "node:path";
import { z } from "zod";
/** Recovery for a packed Program selected where REA requires a project. */
export const GHIDRA_PACKED_PROGRAM_RECOVERY =
const GHIDRA_PACKED_PROGRAM_RECOVERY =
"A .gzf is a packed program, not a .gpr project. Import it into a new project with Ghidra analyzeHeadless <project-directory> <project-name> -import <file.gzf> -noanalysis; select its .gpr and, if needed, set REA_GHIDRA_PROGRAM_NAME to the imported program name.";
/** A single expanded local project marker; archives must be restored first. */
+11 -4
View File
@@ -6,7 +6,6 @@ import { runtimeNativeMatchingAllowance } from "./runtimeAnalysisSettings.js";
import {
DEFAULT_NATIVE_MATCHING_ALLOWANCE,
NATIVE_MATCHING_ALLOWANCE_SETTING,
nativeMatchingRepresentationBytesConstraint,
parseNativeMatchingAllowance,
} from "./nativeMatchingAllowance.js";
import { launchAnalysisSetting } from "./analysisSettings.js";
@@ -56,9 +55,17 @@ it("refuses invalid launch values instead of falling back to the default", () =>
expect(parsed.ok).toBe(false);
if (parsed.ok) continue;
expect(parsed.error).toBeInstanceOf(ConfigurationError);
expect(parsed.error.message).toBe(
nativeMatchingRepresentationBytesConstraint,
);
expect(parsed.error.message).toContain(NATIVE_MATCHING_ALLOWANCE_SETTING);
expect(parsed.error.message).toMatch(/positive decimal integer/i);
expect(parsed.error.message).toContain("1073741824");
expect(parsed.error.message).toContain("100663296");
expect(parsed.error.message).toMatch(/bytes/i);
expect(parsed.error.settings).toEqual([
{
setting: NATIVE_MATCHING_ALLOWANCE_SETTING,
constraint: parsed.error.message,
},
]);
expect(
launchAnalysisSetting("native.matching_representation_bytes", environment)
.ok,
+1 -1
View File
@@ -21,7 +21,7 @@ export const DEFAULT_NATIVE_MATCHING_ALLOWANCE: NativeMatchingAllowance = {
source: "default",
};
export const nativeMatchingRepresentationBytesConstraint = `${NATIVE_MATCHING_ALLOWANCE_SETTING} must be a positive decimal integer of at most ${String(MAXIMUM_NATIVE_MATCHING_REPRESENTATION_BYTES)} bytes (1 GiB); the default is ${String(DEFAULT_NATIVE_MATCHING_REPRESENTATION_BYTES)} bytes (96 MiB).`;
const nativeMatchingRepresentationBytesConstraint = `${NATIVE_MATCHING_ALLOWANCE_SETTING} must be a positive decimal integer of at most ${String(MAXIMUM_NATIVE_MATCHING_REPRESENTATION_BYTES)} bytes (1 GiB); the default is ${String(DEFAULT_NATIVE_MATCHING_REPRESENTATION_BYTES)} bytes (96 MiB).`;
/** Optional decimal byte count for the native function-matching allowance. */
const nativeMatchingRepresentationBytesSchema = z
+19 -4
View File
@@ -12,7 +12,6 @@ import {
DEFAULT_REGEX_MATCHING_DEADLINE,
parseRegexMatchingDeadline,
REGEX_MATCHING_DEADLINE_SETTING,
regexMatchingDeadlineConstraint,
regexMatchingDeadlineRecovery,
} from "./regexMatchingDeadline.js";
import { MAXIMUM_REGEX_MATCHING_DEADLINE_MS } from "../domain/analysisResourceLimits.js";
@@ -59,6 +58,18 @@ it("keeps the 5000 ms deadline when the setting is unset", () => {
},
});
expect(projected.remediation.action).toContain(recovery);
expect(projected.remediation.action).toContain(
REGEX_MATCHING_DEADLINE_SETTING,
);
expect(projected.remediation.action).toContain("5000 ms");
expect(projected.remediation.action).toContain("source default");
expect(projected.remediation.action).toContain("update_analysis_settings");
expect(projected.remediation.action).toContain("regex.matching_deadline_ms");
expect(projected.remediation.action).toMatch(/restart REA/i);
expect(projected.remediation.action).toMatch(/without a REA restart/i);
expect(projected.remediation.action).toMatch(
/heap does not raise this deadline/i,
);
});
it("uses a valid REA_REGEX_MATCHING_DEADLINE_MS override", () => {
@@ -123,18 +134,22 @@ it.each([
const parsed = parseRegexMatchingDeadline(value);
if (parsed.ok) throw new Error(`Accepted ${JSON.stringify(value)}`);
expect(parsed.error).toBeInstanceOf(ConfigurationError);
expect(parsed.error.message).toContain(REGEX_MATCHING_DEADLINE_SETTING);
expect(parsed.error.message).toMatch(/positive decimal integer/i);
expect(parsed.error.message).toMatch(/1 to 2147483647 ms/i);
expect(parsed.error.message).toMatch(/default.*5000 ms/i);
expect(parsed.error.message).toMatch(/Node.*1 ms/i);
expect(parsed.error.settings).toEqual([
{
setting: "REA_REGEX_MATCHING_DEADLINE_MS",
constraint: regexMatchingDeadlineConstraint,
constraint: parsed.error.message,
},
]);
expect(parsed.error.message).toBe(regexMatchingDeadlineConstraint);
const startup = parseEnvironment({ REA_REGEX_MATCHING_DEADLINE_MS: value });
if (startup.ok) throw new Error(`Startup accepted ${JSON.stringify(value)}`);
expect(startup.error.settings).toContainEqual({
setting: REGEX_MATCHING_DEADLINE_SETTING,
constraint: regexMatchingDeadlineConstraint,
constraint: parsed.error.message,
});
const config = parseConfig({ REA_REGEX_MATCHING_DEADLINE_MS: value });
if (config.ok)
+1 -1
View File
@@ -20,7 +20,7 @@ export const DEFAULT_REGEX_MATCHING_DEADLINE: RegexMatchingDeadline = {
source: "default",
};
export const regexMatchingDeadlineConstraint = `${REGEX_MATCHING_DEADLINE_SETTING} must be a positive decimal integer from 1 to ${String(MAXIMUM_REGEX_MATCHING_DEADLINE_MS)} ms; the default is ${String(DEFAULT_REGEX_MATCHING_DEADLINE_MS)} ms. Node schedules a delay above that maximum as 1 ms, so a larger value is refused.`;
const regexMatchingDeadlineConstraint = `${REGEX_MATCHING_DEADLINE_SETTING} must be a positive decimal integer from 1 to ${String(MAXIMUM_REGEX_MATCHING_DEADLINE_MS)} ms; the default is ${String(DEFAULT_REGEX_MATCHING_DEADLINE_MS)} ms. Node schedules a delay above that maximum as 1 ms, so a larger value is refused.`;
/** Optional decimal millisecond count for the supervised regex matching deadline. */
export const regexMatchingDeadlineMsSchema = positiveDecimalIntegerSchema(
+21 -4
View File
@@ -12,7 +12,6 @@ import {
DEFAULT_REGEX_WORKER_HEAP_REQUEST,
parseRegexWorkerHeapRequest,
REGEX_WORKER_HEAP_REQUEST_SETTING,
regexWorkerHeapRequestConstraint,
regexWorkerHeapRequestRecovery,
} from "./regexWorkerHeapRequest.js";
import {
@@ -66,6 +65,20 @@ it("keeps the 128 MiB request when the setting is unset", () => {
},
});
expect(projected.remediation.action).toContain(recovery);
expect(projected.remediation.action).toContain(
REGEX_WORKER_HEAP_REQUEST_SETTING,
);
expect(projected.remediation.action).toContain("128 MiB");
expect(projected.remediation.action).toContain("source default");
expect(projected.remediation.action).toContain("update_analysis_settings");
expect(projected.remediation.action).toContain(
"regex.worker_heap_request_mib",
);
expect(projected.remediation.action).toContain("--max-old-space-size");
expect(projected.remediation.action).toContain("NODE_OPTIONS");
expect(projected.remediation.action).toMatch(/restart REA/i);
expect(projected.remediation.action).toMatch(/without a REA restart/i);
expect(projected.remediation.action).toMatch(/overrides this request/i);
});
it("uses a valid REA_REGEX_WORKER_HEAP_REQUEST_MIB override", () => {
@@ -140,20 +153,24 @@ it.each([
const parsed = parseRegexWorkerHeapRequest(value);
if (parsed.ok) throw new Error(`Accepted ${JSON.stringify(value)}`);
expect(parsed.error).toBeInstanceOf(ConfigurationError);
expect(parsed.error.message).toContain(REGEX_WORKER_HEAP_REQUEST_SETTING);
expect(parsed.error.message).toMatch(/decimal integer/i);
expect(parsed.error.message).toMatch(/7 to 16384 MiB/i);
expect(parsed.error.message).toMatch(/default.*128 MiB/i);
expect(parsed.error.message).toMatch(/abort.*worker.*startup/i);
expect(parsed.error.settings).toEqual([
{
setting: "REA_REGEX_WORKER_HEAP_REQUEST_MIB",
constraint: regexWorkerHeapRequestConstraint,
constraint: parsed.error.message,
},
]);
expect(parsed.error.message).toBe(regexWorkerHeapRequestConstraint);
const startup = parseEnvironment({
REA_REGEX_WORKER_HEAP_REQUEST_MIB: value,
});
if (startup.ok) throw new Error(`Startup accepted ${JSON.stringify(value)}`);
expect(startup.error.settings).toContainEqual({
setting: REGEX_WORKER_HEAP_REQUEST_SETTING,
constraint: regexWorkerHeapRequestConstraint,
constraint: parsed.error.message,
});
const config = parseConfig({ REA_REGEX_WORKER_HEAP_REQUEST_MIB: value });
if (config.ok)
+1 -1
View File
@@ -22,7 +22,7 @@ export const DEFAULT_REGEX_WORKER_HEAP_REQUEST: RegexWorkerHeapRequest = {
source: "default",
};
export const regexWorkerHeapRequestConstraint = `${REGEX_WORKER_HEAP_REQUEST_SETTING} must be a decimal integer from ${String(MINIMUM_REGEX_WORKER_HEAP_REQUEST_MIB)} to ${String(MAXIMUM_REGEX_WORKER_HEAP_REQUEST_MIB)} MiB; the default is ${String(DEFAULT_REGEX_WORKER_HEAP_REQUEST_MIB)} MiB. A request below ${String(MINIMUM_REGEX_WORKER_HEAP_REQUEST_MIB)} MiB aborts the worker during startup, and a larger value is refused.`;
const regexWorkerHeapRequestConstraint = `${REGEX_WORKER_HEAP_REQUEST_SETTING} must be a decimal integer from ${String(MINIMUM_REGEX_WORKER_HEAP_REQUEST_MIB)} to ${String(MAXIMUM_REGEX_WORKER_HEAP_REQUEST_MIB)} MiB; the default is ${String(DEFAULT_REGEX_WORKER_HEAP_REQUEST_MIB)} MiB. A request below ${String(MINIMUM_REGEX_WORKER_HEAP_REQUEST_MIB)} MiB aborts the worker during startup, and a larger value is refused.`;
/** Optional decimal mebibyte count for the regex worker old-generation request. */
export const regexWorkerHeapRequestMiBSchema = positiveDecimalIntegerSchema(
Loaded 100 of 325 files, more files were not shown because too many files have changed in this diff. Show more