[PR #800] [MERGED] fix(ghidra): select exact packaged bridge scripts #2248

Closed
opened 2026-10-16 21:16:14 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/800
Author: @N0zoM1z0
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/790-exact-ghidra-bridge-script


📝 Commits (1)

  • 648ae8b fix(ghidra): select exact packaged bridge scripts

📊 Changes

4 files changed (+31 additions, -5 deletions)

View changed files

📝 docs/windows-ghidra-p0.md (+4 -0)
📝 scripts/verify-packaged-ghidra-windows.mjs (+16 -1)
📝 src/ghidra/GhidraLauncher.ts (+7 -2)
📝 tests/boundary/providers/ghidra/ghidraLauncher.test.ts (+4 -2)

📄 Description

Summary

Fixes #790. Ghidra now receives the selected packaged bridge and COM preparation script paths directly, so unrelated same-named entries in the caller's working directory cannot shadow them. The script source directory remains registered for bundle compilation.

Problem and expected behavior

An empty ReaGhidraBridge.java directory in the caller cwd made an otherwise valid Windows installation fail after analysis. Upstream findScript checks an existing cwd entry before searching scriptPath when given a basename. Select REA's packaged source without asking users to clean their working directory.

Change and scope

  • Pass the selected bridge path to postScript and its sibling preparation path to preScript.
  • Keep scriptPath, target import, descriptor, quoting, authority and lifecycle unchanged.
  • Extend real packaged Windows acceptance: both CLI and MCP start in an owned cwd with same-named directories, complete the existing read-only suite, and leave those entries unchanged.
  • Document the working-directory independence in the Windows guide.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Ghidra headless script argument construction and upstream script discovery.
  • CLI and MCP/tool-catalog contract: unchanged names, schemas and outputs.
  • Provider, bridge, target-format, or platform compatibility: exact packaged script selection; no new operation or format support.
  • Evidence, artifact, provenance, or reconstruction contract: original target and snapshot identity retained.
  • Process execution, authorization, cleanup, or containment impact: no new permission field, script cleanup demand, or process ownership change.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Before-fix actual Windows runs selected an empty same-named cwd directory despite the readable installed bridge appearing in scriptPath. Removing only that owned directory yielded a passing control.
  • Named production provider construction selects an absolute bridge path from import.meta.url. Upstream source confirms basename cwd precedence and script-source directory lookup.
  • Updated argument tests retain read-only/import ordering and verify explicit preparation/bridge coordinates. Real Windows acceptance verifies caller-entry preservation and all admitted operations.
  • Remaining proof gaps: no real macOS Ghidra, Hopper, or DOS COM workflow was run for this batch; no new support claim for those combinations. Nondefault Node symlink-preservation modes were not tested.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/providers/ghidra/ghidraLauncher.test.ts src/ghidra/GhidraLauncherEnvironment.test.ts — 16 passed.
  • npm run check:fast, npm run docs:check, formatting and git diff --check — passed.
  • npm pack --json --pack-destination <isolated-directory> and isolated Windows-native production installation — passed.
  • Updated Windows verify-packaged-ghidra-windows.mjs against the installed artifact, ordinary-user token, Ghidra 12.1.4 and JDK 21 — full CLI and 28 MCP calls passed; caller entries, target digest/bytes and caller token preserved; runtime cleanup verified.
  • Actual Linux production CLI/MCP with a source-owned host-native ELF, existing Ghidra 12.1.4/JDK 21, and same-named cwd directories — inspection, main-function decompilation, original-file byte oracle, close/cleanup and caller-entry preservation passed. An initial old 12.1.3 prerequisite was correctly rejected; the matching existing distribution was reused without installing or altering tools.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; user configuration unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: real Windows x64 packaged Ghidra P0 and real Linux x64 Ghidra native-ELF workflow; no Hopper/macOS run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: user cwd no longer selects the bridge; no target execution or caller-file cleanup; existing quoting/native controls unchanged. Heavy engine runs were serial, two-CPU-affined, with 512 MiB JVM heaps and resource monitoring; raw diagnostics stayed private.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning guide and verification lane updated; generated metadata unchanged.
  • Concrete sanitized before/after behavior described.
  • Final diff checked for credentials, private paths, unrelated cleanup and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/800 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/790-exact-ghidra-bridge-script` --- ### 📝 Commits (1) - [`648ae8b`](https://github.com/morluto/rea/commit/648ae8b69784ed842701c6fa198a4698cfb2f487) fix(ghidra): select exact packaged bridge scripts ### 📊 Changes **4 files changed** (+31 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/windows-ghidra-p0.md` (+4 -0) 📝 `scripts/verify-packaged-ghidra-windows.mjs` (+16 -1) 📝 `src/ghidra/GhidraLauncher.ts` (+7 -2) 📝 `tests/boundary/providers/ghidra/ghidraLauncher.test.ts` (+4 -2) </details> ### 📄 Description ## Summary Fixes #790. Ghidra now receives the selected packaged bridge and COM preparation script paths directly, so unrelated same-named entries in the caller's working directory cannot shadow them. The script source directory remains registered for bundle compilation. ## Problem and expected behavior An empty `ReaGhidraBridge.java` directory in the caller cwd made an otherwise valid Windows installation fail after analysis. Upstream findScript checks an existing cwd entry before searching scriptPath when given a basename. Select REA's packaged source without asking users to clean their working directory. ## Change and scope - Pass the selected bridge path to postScript and its sibling preparation path to preScript. - Keep scriptPath, target import, descriptor, quoting, authority and lifecycle unchanged. - Extend real packaged Windows acceptance: both CLI and MCP start in an owned cwd with same-named directories, complete the existing read-only suite, and leave those entries unchanged. - Document the working-directory independence in the Windows guide. ## Contract and boundary impact - Semantic owner and earliest changed stage: Ghidra headless script argument construction and upstream script discovery. - CLI and MCP/tool-catalog contract: unchanged names, schemas and outputs. - Provider, bridge, target-format, or platform compatibility: exact packaged script selection; no new operation or format support. - Evidence, artifact, provenance, or reconstruction contract: original target and snapshot identity retained. - Process execution, authorization, cleanup, or containment impact: no new permission field, script cleanup demand, or process ownership change. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Before-fix actual Windows runs selected an empty same-named cwd directory despite the readable installed bridge appearing in scriptPath. Removing only that owned directory yielded a passing control. - Named production provider construction selects an absolute bridge path from import.meta.url. Upstream source confirms basename cwd precedence and script-source directory lookup. - Updated argument tests retain read-only/import ordering and verify explicit preparation/bridge coordinates. Real Windows acceptance verifies caller-entry preservation and all admitted operations. - Remaining proof gaps: no real macOS Ghidra, Hopper, or DOS COM workflow was run for this batch; no new support claim for those combinations. Nondefault Node symlink-preservation modes were not tested. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/boundary/providers/ghidra/ghidraLauncher.test.ts src/ghidra/GhidraLauncherEnvironment.test.ts` — 16 passed. - `npm run check:fast`, `npm run docs:check`, formatting and `git diff --check` — passed. - `npm pack --json --pack-destination <isolated-directory>` and isolated Windows-native production installation — passed. - Updated Windows verify-packaged-ghidra-windows.mjs against the installed artifact, ordinary-user token, Ghidra 12.1.4 and JDK 21 — full CLI and 28 MCP calls passed; caller entries, target digest/bytes and caller token preserved; runtime cleanup verified. - Actual Linux production CLI/MCP with a source-owned host-native ELF, existing Ghidra 12.1.4/JDK 21, and same-named cwd directories — inspection, main-function decompilation, original-file byte oracle, close/cleanup and caller-entry preservation passed. An initial old 12.1.3 prerequisite was correctly rejected; the matching existing distribution was reused without installing or altering tools. ## Compatibility, safety, and release - Breaking changes or migration steps: none; user configuration unchanged. - Real Hopper/Ghidra, browser, or OS coverage: real Windows x64 packaged Ghidra P0 and real Linux x64 Ghidra native-ELF workflow; no Hopper/macOS run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: user cwd no longer selects the bridge; no target execution or caller-file cleanup; existing quoting/native controls unchanged. Heavy engine runs were serial, two-CPU-affined, with 512 MiB JVM heaps and resource monitoring; raw diagnostics stayed private. ## Review checklist - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning guide and verification lane updated; generated metadata unchanged. - [x] Concrete sanitized before/after behavior described. - [x] Final diff checked for credentials, private paths, unrelated cleanup and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:16:14 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2248
No description provided.