Skip to content

Commit d4bd65c

Browse files
committed
fix(providers)!: preserve readiness, coverage, and diagnostic ownership
Share tagged readiness observations, retain partial provider facts, authenticate bridge identity, bound diagnostics, and preserve cancellation and lost-session reasons. Fail closed for unparsed MIPS ABI attributes and macOS saved Hopper databases without a script-capable bridge route. Reviewed fixes: #2010, #2108, #2513, #2695, #2731, #2771, #2828, #2867, #2868, #2870, #2880, #2919, #2945, #2961, #2981, #2998, #3000, #3002. Validation: 285 focused source/boundary tests passed. Real Ghidra, IDA, Linux Hopper, and Windows provider runs were not repeated. BREAKING CHANGE: MIPS targets with unresolved GNU ABI attributes and saved Hopper databases on macOS are refused rather than advertised as supported.
1 parent ec56c1d commit d4bd65c

80 files changed

Lines changed: 6689 additions & 627 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎bridge/ghidra/ReaGhidraBridge.java‎

Lines changed: 451 additions & 115 deletions
Large diffs are not rendered by default.

‎bridge/hopper_bridge.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,12 @@ def _analyze_function(document, params):
736736
def _dispatch(method, params):
737737
"""Dispatch only the closed operation set implemented by REA's public tools."""
738738
if method == "health":
739-
return {"name": "REA Hopper bridge", "version": "1.0.0", "run_id": REA_RUN_ID}
739+
return {
740+
"name": "REA Hopper bridge",
741+
"version": "1.0.0",
742+
"run_id": REA_RUN_ID,
743+
"process_id": os.getpid(),
744+
}
740745
if method in ("shutdown", "shutdown_document"):
741746
document = _session_document()
742747
if document is None:

‎docs/adb-device-analysis.md‎

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,32 +73,32 @@ existing analysis families directly, for example
7373

7474
## Operations
7575

76-
| Tool | Kind | What it does |
77-
| ----------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
78-
| `inspect_adb_client` | read | Resolved binary, version, install path; never contacts the server |
79-
| `list_adb_devices` | read | Serial, state, transport, model metadata, inferred emulator/physical kind with basis |
80-
| `inspect_adb_device` | read | Fixed `getprop` whitelist: build, SDK, patch, fingerprint, product, ABIs, debuggable, `ro.kernel.qemu` |
81-
| `inspect_adb_display` | read | `wm size` and `wm density` as declared |
82-
| `list_adb_features` | read | `pm list features` (hardware/software features, hex GL versions) |
83-
| `list_adb_services` | read | `service list` binder services and interfaces |
84-
| `list_adb_processes` | read | `ps -A`: user, pid, ppid, rss, state, name |
85-
| `inspect_adb_window` | read | `dumpsys window` focus declarations (what is on screen) |
86-
| `read_adb_setting` | read | One `settings get` value; device-side null is reported as such |
87-
| `read_adb_logcat` | read | Bounded `logcat -d -t` dump for one buffer, optional pid filter |
88-
| `list_adb_packages` | read | `pm list packages -f` with scope; base APK device paths |
89-
| `resolve_adb_packages` | read | Case-insensitive package-name substring search with exact-match flag |
90-
| `inspect_adb_package` | read | `dumpsys package` projection: versions, install times, installer, flags, permission count |
91-
| `list_adb_directory` | read | NUL-framed immediate children, including hidden entries: kinds, permissions, owner, group, sizes, symlink targets |
92-
| `pull_adb_package` | read | Complete split APK set from `pm path`, each file digested |
93-
| `pull_adb_file` | read | One absolute device path pulled and digested |
94-
| `capture_adb_screen` | read | One `screencap -p` frame (exec-out, no device-side file) with dimensions |
95-
| `collect_adb_bugreport` | read | Device-generated bugreport zip, digested |
96-
| `push_adb_file` | **mutates device** | One local file to a device path (e.g. pushing tools into `/data/local/tmp`); refuses existing targets without explicit overwrite; verifies via the device's own sha256sum |
97-
| `install_adb_package` | **mutates device** | Local APK via `adb install [-r]`; preserves the device's Success/Failure verdict |
98-
| `uninstall_adb_package` | **mutates device** | Removes a package and its data for user 0 |
99-
| `start_adb_app` | **mutates device** | Resolves the package's launcher activity (`cmd package resolve-activity --brief`) and starts it (`am start -n`) |
100-
| `start_adb_activity` | **mutates device** | Starts an intent (`am start -a` with optional URI, component, and up to 16 typed extras); preserves the activity manager's verdict |
101-
| `stop_adb_app` | **mutates device** | Force-stops every process of a package, ending a dynamic-analysis run |
76+
| Tool | Kind | What it does |
77+
| ----------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
78+
| `inspect_adb_client` | read | Resolved binary, version, install path; never contacts the server |
79+
| `list_adb_devices` | read | Serial, state, transport, model metadata, inferred emulator/physical kind with basis |
80+
| `inspect_adb_device` | read | Fixed `getprop` whitelist: build, SDK, patch, fingerprint, product, ABIs, debuggable, `ro.kernel.qemu` |
81+
| `inspect_adb_display` | read | `wm size` and `wm density` as declared |
82+
| `list_adb_features` | read | `pm list features` (hardware/software features, hex GL versions) |
83+
| `list_adb_services` | read | `service list` binder services and interfaces |
84+
| `list_adb_processes` | read | `ps -A`: user, pid, ppid, rss, state, name |
85+
| `inspect_adb_window` | read | `dumpsys window` focus declarations (what is on screen) |
86+
| `read_adb_setting` | read | One `settings get` value; device-side null is reported as such |
87+
| `read_adb_logcat` | read | Bounded `logcat -d -t` dump for one buffer, optional pid filter |
88+
| `list_adb_packages` | read | `pm list packages -f` with scope; base APK device paths |
89+
| `resolve_adb_packages` | read | Case-insensitive package-name substring search with exact-match flag |
90+
| `inspect_adb_package` | read | `dumpsys package` projection: versions, install times, installer, flags, permission count |
91+
| `list_adb_directory` | read | NUL-framed immediate children, including hidden entries: kinds, permissions, owner, group, sizes, symlink targets |
92+
| `pull_adb_package` | read | Complete split APK set from `pm path`, each file digested |
93+
| `pull_adb_file` | read | One absolute device path pulled and digested |
94+
| `capture_adb_screen` | read | One `screencap -p` frame (exec-out, no device-side file) with dimensions |
95+
| `collect_adb_bugreport` | read | Device-generated bugreport zip, digested |
96+
| `push_adb_file` | **mutates device** | One local file to a device path (e.g. pushing tools into `/data/local/tmp`); checks for existing targets and refuses them without explicit overwrite (the check is not atomic); compares digests when device `sha256sum` is available |
97+
| `install_adb_package` | **mutates device** | Local APK via `adb install [-r]`; preserves the device's Success/Failure verdict |
98+
| `uninstall_adb_package` | **mutates device** | Removes a package and its data for user 0 |
99+
| `start_adb_app` | **mutates device** | Resolves the package's launcher activity (`cmd package resolve-activity --brief`) and starts it (`am start -n`) |
100+
| `start_adb_activity` | **mutates device** | Starts an intent (`am start -a` with optional URI, component, and up to 16 typed extras); preserves the activity manager's verdict |
101+
| `stop_adb_app` | **mutates device** | Force-stops every process of a package, ending a dynamic-analysis run |
102102

103103
## Interpret the result
104104

@@ -118,6 +118,16 @@ existing analysis families directly, for example
118118
while POSIX hosts retain valid POSIX filenames such as names with spaces or
119119
colons. A package pull checks reported names against the destination
120120
filesystem before pulling, and refuses names that would share a local path.
121+
- **Package path refusals are diagnosable.** Refusals from `pull_adb_package`
122+
return `unreadable_output` with `retryable: false`, keep the `pm path` output
123+
in `details.captured_output`, and name the refusal in `details.reason`.
124+
`unsafe_device_path` lists refused entries in
125+
`details.diagnostics.rejected_paths` as `{device_path, reason}`;
126+
`duplicate_local_destination` reports the shared `file_name` and both
127+
`device_paths`; `local_destination_unavailable` reports the `device_path`,
128+
`file_name`, and filesystem `error_code`. Diagnostics retain raw device
129+
strings, while the caller-facing message escapes invisible and bidirectional
130+
characters so they cannot hide text or reorder the path.
121131
- **Splits are part of the answer.** `pm path` enumerates the base APK and
122132
every installed split; pulls cover the whole set. System packages whose
123133
APKs keep other names report the `unknown` role rather than guessing.
@@ -127,8 +137,10 @@ existing analysis families directly, for example
127137
partial coverage instead of dropping rows.
128138
- **Mutations are explicit.** `push_adb_file`, `install_adb_package`, and
129139
`uninstall_adb_package` declare `mutatesTarget` and never run implicitly:
130-
pushes refuse existing device files unless `overwrite` is set and verify
131-
the transfer with the device's own `sha256sum`; installs preserve the
140+
pushes check for existing device files before transfer and refuse them
141+
unless `overwrite` is set. The check is not atomic, so a different process
142+
can create the path before `adb push` writes it. When available, the device's
143+
`sha256sum` verifies the transfer; installs preserve the
132144
device's `Failure [...]` reason verbatim.
133145
- **Producer identity stays attached.** Every result embeds the producing
134146
adb client (`binary_path`, `path_source`, `version`, `installed_path`).

‎docs/ghidra-mips.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ section names or the record being inside the initial 4 KiB header probe.
5252
Program and section declarations must agree; duplicate, conflicting, truncated
5353
or out-of-file records are rejected. Stripped section tables and section-only
5454
records are supported. Extended table numbering is explicitly unsupported.
55-
For carved ELFs whose section table extends beyond the captured file, REA
56-
examines every complete captured section header and records the unavailable
57-
headers as a limitation. A valid program-header ABI record can still establish
58-
the supported declaration. Available section declarations must agree with it;
59-
their duplicate, conflicting or unreadable records remain errors. A missing
60-
program-header record does not make ABI declarations in uncaptured sections
61-
absent or supply a default ABI.
55+
GNU `SHT_GNU_ATTRIBUTES` sections are refused by numeric section type until REA
56+
parses and reconciles their declarations; section names and payload sizes do not
57+
control detection or allocation. For carved ELFs whose section table extends
58+
beyond the captured file, REA examines every complete captured section header
59+
and records the unavailable headers as a limitation. The provider refuses an
60+
incomplete ABI declaration inspection even when a program-header ABI record is
61+
valid, because an unavailable section header could carry an unsupported or
62+
conflicting declaration. A missing program-header record does not make ABI
63+
declarations in uncaptured sections absent or supply a default ABI.
6264
The field layout follows
6365
[`Elf_MIPS_ABIFlags_v0`](https://github.com/bminor/glibc/blob/master/elf/elf.h).
6466

‎docs/ghidra-provider.md‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,15 @@ An inferred no-return call can terminate that body before subsequent bytes.
154154
Pseudocode, assembly, procedure info, instruction windows, callee and caller
155155
reads, and dossiers report observed terminal call sites in Evidence limitations,
156156
including resolved callee names, addresses, and FunctionManager flags when
157-
available. Instruction windows
158-
and dossiers also retain these warnings in their result limitations. An
159-
unresolved callee or unestablished terminal-flow basis remains explicit. These
160-
observations qualify the analysis; they do not prove that a no-return flag is
161-
incorrect or recover excluded code. Analysis profiles version this observation
162-
contract so older snapshots cannot replay unqualified results.
157+
available. On x86-32, the same views also report the exact Borland/Delphi-style
158+
FS exception-registration pattern when its handler address falls outside the
159+
function body. This is a static registration observation; it does not establish
160+
handler execution or change the body. Instruction windows and dossiers also
161+
retain these warnings in their result limitations. An unresolved callee or
162+
unestablished terminal-flow basis remains explicit. These observations qualify
163+
the analysis; they do not prove that a no-return flag is incorrect or recover
164+
excluded code. Analysis profiles version this observation contract so older
165+
snapshots cannot replay unqualified results.
163166

164167
On non-Windows hosts, the ephemeral import repair clears no-return flags on the
165168
known returning external ABI names `malloc`, `__tls_get_addr`, `memcpy`, `memset`,
@@ -189,7 +192,7 @@ host/provider acceptance run with only the host compiler.
189192

190193
`npm run verify:ghidra:windows` checks source-owned native x86-64 PE applications;
191194
`-- --x86` selects x86 and `-- --dll` selects DLLs, and the flags can be combined.
192-
These lanes check all 25 read-only operations, target/snapshot/import SHA-256 linkage,
195+
These lanes check all 26 read-only operations, target/snapshot/import SHA-256 linkage,
193196
and project, endpoint, process, and runtime cleanup. The independent native
194197
lane checks DACLs, handle admission, cancellation, and Job Object lifecycle.
195198
`npm run verify:ghidra:windows:package` packs and installs REA into an isolated

0 commit comments

Comments
 (0)