feat(ghidra): implement read-only inventory operations
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
See a feature in an app that you want in your own product? Give the app to your agent—even without its source code. With REA, the agent can investigate the feature, explain how it works, show its evidence, and build a version adapted to your stack and requirements.
|
||||
|
||||
REA gives agents one consistent way to investigate software. Today that includes deep native analysis through Hopper, a bring-your-own Ghidra headless-session foundation on Linux, complete function dossiers, reproducible Evidence v2 records, controlled process capture, passive website and Electron observation, and bounded JavaScript/source-map reconstruction. The Ghidra foundation deliberately exposes no binary operations yet; Hopper remains the operation-capable deep provider. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions.
|
||||
REA gives agents one consistent way to investigate software. Today that includes deep native analysis through Hopper, bring-your-own Ghidra read-only inventory on Linux, complete Hopper function dossiers, reproducible Evidence v2 records, controlled process capture, passive website and Electron observation, and bounded JavaScript/source-map reconstruction. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions.
|
||||
|
||||
Reverse engineering normally makes the operator choose a tool, learn its API, move evidence between programs, and decide what to inspect next. REA gives that work to the agent through commands, skills, structured results, and repeatable investigation workflows.
|
||||
|
||||
@@ -153,7 +153,7 @@ Choose either the no-install commands or the global installation. You do not nee
|
||||
- Node.js 22.19+ or 24.11+ (including newer releases)
|
||||
- npm; REA does not require or install a particular npm version
|
||||
|
||||
Deep binary operations currently use [Hopper](https://www.hopperapp.com/), a separate desktop application with its own license. REA also ships the first Ghidra provider layer: Linux x64 discovery, exact Ghidra 12.1.2/JDK 21 validation, deterministic target/profile binding, and a private read-only `analyzeHeadless` session. That layer intentionally declares no binary operations until their semantic contracts and real-provider conformance land. Setup reuses an existing Hopper installation or an operator-supplied Ghidra installation. It never downloads Ghidra or installs Java. If neither provider is ready, interactive setup proposes Hopper; unattended Hopper installation requires `rea setup --yes --install-hopper`.
|
||||
Deep binary operations use [Hopper](https://www.hopperapp.com/), a separate desktop application with its own license, or a caller-selected Ghidra provider. Ghidra currently supplies program identity, procedure/string/symbol inventories, memory blocks, address/name and containing-procedure resolution, and bounded search; decompilation, calls, xrefs, GUI state, and mutations remain unavailable through that provider. Setup reuses an existing Hopper installation or an operator-supplied Ghidra installation. It never downloads Ghidra or installs Java. If neither provider is ready, interactive setup proposes Hopper; unattended Hopper installation requires `rea setup --yes --install-hopper`.
|
||||
|
||||
If something is not working, run:
|
||||
|
||||
@@ -186,7 +186,7 @@ Install the missing distribution packages and rerun `rea setup`. Linux demo auto
|
||||
|
||||
REA defaults `HOPPER_LAUNCHER_PATH` to `/Applications/Hopper Disassembler.app/Contents/MacOS/hopper` on macOS and `/opt/hopper/bin/Hopper` on Linux. Explicit configuration always takes precedence.
|
||||
|
||||
### Ghidra headless-session foundation
|
||||
### Ghidra read-only inventory provider
|
||||
|
||||
The current Ghidra adapter supports the exact official Ghidra 12.1.2 release on Linux x64 with a 64-bit full JDK 21. Download and extract those projects yourself, then configure absolute paths:
|
||||
|
||||
@@ -200,7 +200,11 @@ rea providers --json
|
||||
|
||||
Doctor distinguishes missing configuration, a bad installation root, the wrong Ghidra or Java version, a JRE without `javac`, a missing `support/analyzeHeadless`, and an unsupported platform or architecture. Approved setup only copies the verified non-secret paths into detected MCP registrations; it does not modify the Ghidra installation or install/download Ghidra or Java.
|
||||
|
||||
REA loads its packaged Java `HeadlessScript` with `-scriptPath`, imports the target into a mode-0700 temporary project, enables `-readOnly` and `-deleteProject`, caps auto-analysis at 300 seconds with two CPUs and a 2 GiB Java heap, and authenticates `ping`/`shutdown` over a mode-0600 Unix socket. It isolates Ghidra home/cache/config/temp paths and removes the owned project, socket, process group, and runtime root on close, cancellation, timeout, or process exit. This proves the provider lifecycle and analysis-profile commitment; it does **not** make `decompile`, inventory, xref, or function operations available through Ghidra in this release.
|
||||
REA loads its packaged Java `HeadlessScript` with `-scriptPath`, imports the target into a mode-0700 temporary project, enables `-readOnly` and `-deleteProject`, caps auto-analysis at 300 seconds with two CPUs and a 2 GiB Java heap, and authenticates every request over a mode-0600 Unix socket. It isolates Ghidra home/cache/config/temp paths and removes the owned project, socket, process group, and runtime root on close, cancellation, timeout, or process exit.
|
||||
|
||||
The Ghidra adapter declares exactly ten direct operations: `list_documents`, `list_procedures`, `list_strings`, `list_names`, `list_segments`, `address_name`, `procedure_address`, `resolve_containing_procedure`, `search_procedures`, and `search_strings`. These also enable the shared Swift/Objective-C inventory workflows and `binary_overview`; workflows that require decompilation, calls, or xrefs remain unavailable. Default-space addresses are lowercase `0x` hexadecimal. Other spaces, including `EXTERNAL`, use `<percent-encoded-space>:0x<hex>`. Symbol results identify primary, dynamic, external, type, and source facts; procedures distinguish external functions and thunks; strings identify charset, missing-terminator state, byte length, and value truncation; memory-block ends are exclusive and permissions come directly from Ghidra.
|
||||
|
||||
The bridge serves operations only after auto-analysis completes. An analysis timeout, inventory safety limit, request timeout, or oversized response fails explicitly instead of returning a partial result labeled complete. `npm run verify:ghidra` compiles source-owned debug and stripped ELF fixtures, validates external symbols and every admitted operation against real Ghidra 12.1.2, and proves cleanup.
|
||||
|
||||
To remove only REA-owned MCP registrations and the managed skill:
|
||||
|
||||
@@ -378,7 +382,7 @@ REA is growing into a toolkit for understanding software across static artifacts
|
||||
### Now
|
||||
|
||||
1. **Maintain truthful product metadata** — extend the shipped canonical catalog and drift checks whenever versions, tools, providers, schemas, setup clients, or CLI capabilities change.
|
||||
2. **Ghidra read-only operations** — extend the shipped discovery/profile/headless-session foundation with individually admitted inventory, decompilation, call, and xref capabilities, verified on real source-owned binaries without pretending Hopper and Ghidra results are textually identical.
|
||||
2. **Ghidra function analysis** — extend the shipped read-only inventory operations with individually admitted decompilation, assembly, call, xref, and CFG capabilities, verified on real source-owned binaries without pretending Hopper and Ghidra results are textually identical.
|
||||
3. **JavaScript application reconstruction** — connect packages, ASAR entries, main/preload/renderer bundles, source maps, Electron IPC boundaries, service-worker assets, and native add-ons in one evidence-bearing application graph.
|
||||
|
||||
### Next
|
||||
@@ -395,7 +399,7 @@ REA is growing into a toolkit for understanding software across static artifacts
|
||||
|
||||
New providers must produce the same evidence and safety metadata as existing capabilities before they become part of the public workflow. Once REA has multiple optional toolchains, setup can become capability-selective; the consent rules for that future work are recorded in the [installation roadmap](docs/roadmap.md).
|
||||
|
||||
See the [static-analysis provider evaluation](docs/provider-evaluation.md) for the shipped Ghidra foundation, remaining admission gates, and provider comparison matrix, and [ADR-0001](docs/adr/0001-provider-selection-and-analysis-profiles.md) for the binding, selection, profile, snapshot, and compatibility decisions.
|
||||
See the [static-analysis provider evaluation](docs/provider-evaluation.md) for the shipped Ghidra inventory boundary, remaining admission gates, and provider comparison matrix, and [ADR-0001](docs/adr/0001-provider-selection-and-analysis-profiles.md) for the binding, selection, profile, snapshot, and compatibility decisions.
|
||||
|
||||
## Using REA with other agents
|
||||
|
||||
@@ -429,7 +433,7 @@ flowchart LR
|
||||
REA --> Session["Target-bound session router"]
|
||||
Session --> Registry["Deep-provider registry<br/>deterministic selection"]
|
||||
Registry --> Hopper["Hopper provider"]
|
||||
Registry --> Ghidra["Ghidra provider<br/>headless foundation; no binary ops"]
|
||||
Registry --> Ghidra["Ghidra provider<br/>read-only inventory operations"]
|
||||
Hopper --> Runtime["Owned provider runtime<br/>deadline + bounded diagnostics + cleanup"]
|
||||
Ghidra --> Runtime
|
||||
Session --> Native["Native macOS provider"]
|
||||
@@ -508,9 +512,10 @@ the authoritative `analysis_provider_candidates` and
|
||||
`analysis_provider_binding` fields. Reopening the same target without a selector
|
||||
keeps its binding; runtime failure never selects another provider silently.
|
||||
Ghidra can appear as an available, target-compatible candidate after doctor
|
||||
validates its exact installation, but its capability list is empty in this
|
||||
foundation release. Selecting it does not make Hopper-backed operations
|
||||
available and never triggers a silent fallback.
|
||||
validates its exact installation. Its capability list contains only the ten
|
||||
admitted read-only inventory operations; selecting it does not make
|
||||
Hopper-only decompilation, call/xref, GUI, or mutation operations available and
|
||||
never triggers a silent fallback.
|
||||
|
||||
### CLI exit status
|
||||
|
||||
|
||||
Reference in New Issue
Block a user