#13299
[Design] Native composed workflows and provider scale bounds (binary_overview, trace_feature, call graph BFS, decompile_all, Hopper/Cutter/Kuna)
Before submitting
- I searched the open and closed issues and pull requests for a related discussion (#13276, #13277, #13278, #13292).
- I understand the contribution scope must be reviewed before integration; open questions are welcome here.
- This discussion does not include credentials, private samples, or sensitive target data.
Decision needed
Should REA establish explicit bounded-execution and summary-count contracts across composed native workflows and long-running native bridges:
- Provider-side
read_binary_inventory_summarysupport (or upstream capability integration) for IDA, Hopper, and Kuna sobinary_overviewstops pulling full procedure and string inventories solely for.length, - Explicit match, reference, depth, node, edge, and deadline budgets (matching
trace_native_valuesandtrace_native_ui_action) ontrace_feature,get_call_graph, andtrace_call_path, - Clear
decompile_allresume-with-limitsemantics (verified disk state vs journal-indexed skip) and filteredlist_procedurespushdown, and - Explicit operation deadlines and paginated/streamed large-reply protocols in Hopper (
bridge/hopper_bridge.py/HopperClient.ts) and Cutter (bridge/cutter/rea_bridge.py/CutterBridgeClient.ts), plus removing Kuna's single-string128 MiBkuna functions --jsonwall and serial--jobs 1export bottleneck?
Context and evidence
Source-derived analysis of REA's composed native workflows and provider adapters shows multiple places where large binaries (500k+ functions, 1M+ strings) fail or hang indefinitely due to missing summary/pagination/timeout contracts:
binary_overview(src/application/EnhancedTools.ts:690-732):- Attempts
read_binary_inventory_summary(currently implemented only by Ghidra). - For IDA, Hopper, and Kuna, falls back to
Promise.all([list_segments, list_procedures, list_strings])(lines 705-711) viaexecuteFact, transferring and Zod-validating every procedure and string row solely to read.fact.length(lines 727-728) and discard the arrays. - In Hopper, unpaginated single-line
list_strings/list_proceduresreplies can exceedDEFAULT_BRIDGE_MAX_REPLY_BYTES(256 MiB); in IDA, 100-item paging forces thousands of sequential RPCs; in Kuna,kuna functions --jsonhits the128 MiBsingle-string output cap (KunaCommand.ts:61).
- Attempts
trace_feature,get_call_graph, andtrace_call_path(src/application/EnhancedLiteralTracing.ts:49-240,src/application/EnhancedTools.ts:525-625,src/application/CallPathTracing.ts:85-136):traceLiteralFeature(EnhancedLiteralTracing.ts:92-118, 138-238) runs sequentially over every string and procedure match (xrefsper match ×resolve_containing_procedureper xref source) with no match cap, total-reference cap, or deadline.EnhancedTools.#callGraph(lines 553-623) andtraceCallPath(lines 106-133) execute unbounded BFS traversals with nomax_depth,max_nodes,max_edges, or deadline.
decompile_allresume +limit(src/application/decompileDirectory/decompileAll.ts:397-438):- Always fetches unfiltered
list_procedureseven whenname,namespace, oraddress_start..address_endfilters are specified. - On resume with
limit, line437-438(if (input.limit !== undefined && input.state.attempted >= input.limit) continue;) continues iterating over all remaining procedures and callingexistingFile(...)(reading and SHA-256 hashing every already-written output file on disk) even after the attempt budget is exhausted.
- Always fetches unfiltered
- Provider timeouts and unpaginated bridge replies:
- Hopper (
src/hopper/HopperProvider.ts,bridge/hopper_bridge.py:690-741, 1190-1205, 1352):list_strings,list_procedures, andlist_namesemit single-line unpaginated NDJSON replies that can breach the 256 MiB limit;_search_resultseagerly runs_string_recordFFI decoding for every string on first search;connection.settimeout(None)leaves bridge calls untimed without a caller timeout contract. - Cutter (
bridge/cutter/rea_bridge.py:172, 819-827,src/cutter/CutterBridgeClient.ts:134): Hardcoded 20s bridge / 25s client timeout permanently poisons the bridge session (self.poisoned = True) on legitimate large commands rather than honoring configurable deadlines. - Kuna (
src/kuna/):KunaSessionClientbufferskuna functions --jsonas a single string capped at128 MiB, falls back to unfilteredkuna strings(pending verification ofkuna strings --filtercase-folding/regex semantics), and runs serial--jobs 1whole-binary exports (DEFAULT_KUNA_PROJECT_TIMEOUT_MS).
- Hopper (
Expected interaction with targets
- Read existing files or captured data (local binaries / bridge sessions under existing read-only analysis boundaries).
Boundary details (optional)
- Bounded traversals (
trace_feature,get_call_graph,trace_call_path) must preserve REA's completeness invariant: stopping at a bound or budget must set explicittruncated: true, report the active limit and recovery, and never silently claim a partial graph/reference set is complete. decompile_allresume-with-limitchanges must keepcounts.skippedvscounts.remaininghonest (distinguishing verified disk state from unverified remaining entries).- Hopper and Kuna server-side filter/count extensions must match REA's canonical Unicode simple case-folding and symbol identity rules.
Options and tradeoffs
- Inventory summary pushdown: Implement direct O(count)
read_binary_inventory_summaryin Hopper and Kuna bridges (and Hex-Rays IDA bridge, plussurvey_binary/count support where upstream IDA MCP exposes it). - Traversal & search bounds: Align
trace_feature,get_call_graph, andtrace_call_pathwithtrace_native_values/trace_native_ui_action(max_depth,max_nodes,max_edges, max matches/refs, and whole-operation timeout budgets). - Paginated / streamed bridge IPC: Stream
kuna functions --jsonviaKunaJsonDocumentReader(eliminating the128 MiBsingle-string wall) and add chunked/cursor paging + operation deadlines to Hopper and configurable deadlines to Cutter.
Verification available so far
- Idea only; I need help defining checks
Success criteria and open questions
- Which summary/pagination/bound parameters (
max_matches,max_references,max_depth,max_nodes,limit) belong in the public CLI/MCP contracts fortrace_feature,get_call_graph, andtrace_call_path? - When
decompile_allstops atlimitduring resume, should unexamined trailing entries be counted as unverified/remaining rather than re-hashing every previously written file on disk? - Can Kuna CLI
--filtersemantics (exact regex/Unicode rules) and non-single-threaded project export be verified and adopted without altering string-matching parity?
References
- Related issues: #13276, #13277, #13278, #13292
src/application/EnhancedTools.ts:525-625, 690-732src/application/EnhancedLiteralTracing.ts:49-240src/application/CallPathTracing.ts:85-136src/application/decompileDirectory/decompileAll.ts:397-438bridge/hopper_bridge.py:690-741, 1190-1205, 1352bridge/cutter/rea_bridge.py:172, 819-827
Activity
0No activity yet.