[PR #1200] [MERGED] fix(ghidra): reject relative installation and Java paths in doctor and setup #2713

Closed
opened 2026-10-17 21:09:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1200
Author: @kaoru0822-kitauji
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/doctor-setup-relative-provider-paths


📝 Commits (1)

  • 5356856 fix(ghidra): reject relative installation and Java paths in doctor and setup

📊 Changes

2 files changed (+80 additions, -7 deletions)

View changed files

📝 src/ghidra/GhidraInstallation.test.ts (+45 -0)
📝 src/ghidra/GhidraInstallation.ts (+35 -7)

📄 Description

Summary

With a relative GHIDRA_INSTALL_DIR that happened to resolve from the current directory, doctor reported Ghidra available and healthy, and setup copied GHIDRA_INSTALL_DIR = "./fixture" into the client's MCP registration. But REA's configuration parser requires an absolute path, so providers and capabilities failed, and the registered MCP server exited before initialization. A relative JAVA_HOME showed the same doctor/parser mismatch.

Fixes #1183

Change (src/ghidra/GhidraInstallation.ts)

The installation inspection's configuration check now applies the parser's rule. A GHIDRA_INSTALL_DIR or JAVA_HOME that is not absolute fails it, with detail GHIDRA_INSTALL_DIR must be absolute (or JAVA_HOME, or both) and remediation to set an absolute path. Absoluteness is judged by the inspected platform's path syntax (win32 or posix), as the rest of the inspection already does.

Because a failed configuration check makes the inspection unavailable:

  • scoped and unscoped doctor report Ghidra unavailable, with that check as the reason;
  • projectGhidraDoctorInspection publishes no registrationEnvironment, and setup builds the registration only from published environments (providerRegistrationEnvironment), so the relative path is no longer written.

At analysis time the parser has already rejected relative values, so the provider's own use of the inspection is unaffected.

Built CLI

GHIDRA_INSTALL_DIR=./fixture rea doctor --provider ghidra --json → healthy: false, Ghidra available: false, registrationEnvironment: {}, check configuration: GHIDRA_INSTALL_DIR must be absolute / "Set GHIDRA_INSTALL_DIR to an absolute path. REA's analysis and MCP server reject relative paths even when they resolve from the current directory."

Tests

src/ghidra/GhidraInstallation.test.ts (Ghidra configuration paths):

  • relative install dir, relative JAVA_HOME, and both are each unavailable with not_configured and the named setting(s), and the doctor projection is unavailable with an empty registration environment (all three fail on main);
  • a Windows absolute path passes the configuration check when inspecting win32.

Verification

  • npm run check:fast, npm run jscpd
  • npm run test:focused -- every test using the Ghidra installation inspection, Ghidra doctor, or setup's registration environment (4 files, 69 passed)
  • Built CLI doctor run, as above

No real Ghidra installation here. This changes only the configuration check, which runs before any installation file or Java probe matters.

Related: #1199 makes configuration_invalid errors name the setting. A later change could have doctor run the full configuration parser, which would also catch a relative REA_GHIDRA_NATIVEAOT_JAR (also mentioned in #1184), currently outside the Ghidra installation inspection.

🤖 Generated with Claude Code


🔄 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/1200 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/doctor-setup-relative-provider-paths` --- ### 📝 Commits (1) - [`5356856`](https://github.com/morluto/rea/commit/53568568bf32b36274ba3a532f1e2cfb2daed271) fix(ghidra): reject relative installation and Java paths in doctor and setup ### 📊 Changes **2 files changed** (+80 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/ghidra/GhidraInstallation.test.ts` (+45 -0) 📝 `src/ghidra/GhidraInstallation.ts` (+35 -7) </details> ### 📄 Description ## Summary With a relative `GHIDRA_INSTALL_DIR` that happened to resolve from the current directory, doctor reported Ghidra available and healthy, and setup copied `GHIDRA_INSTALL_DIR = "./fixture"` into the client's MCP registration. But REA's configuration parser requires an absolute path, so `providers` and `capabilities` failed, and the registered MCP server exited before initialization. A relative `JAVA_HOME` showed the same doctor/parser mismatch. Fixes #1183 ## Change (`src/ghidra/GhidraInstallation.ts`) The installation inspection's `configuration` check now applies the parser's rule. A `GHIDRA_INSTALL_DIR` or `JAVA_HOME` that is not absolute fails it, with detail `GHIDRA_INSTALL_DIR must be absolute` (or `JAVA_HOME`, or both) and remediation to set an absolute path. Absoluteness is judged by the inspected platform's path syntax (`win32` or `posix`), as the rest of the inspection already does. Because a failed configuration check makes the inspection `unavailable`: - scoped and unscoped doctor report Ghidra unavailable, with that check as the reason; - `projectGhidraDoctorInspection` publishes no `registrationEnvironment`, and setup builds the registration only from published environments (`providerRegistrationEnvironment`), so the relative path is no longer written. At analysis time the parser has already rejected relative values, so the provider's own use of the inspection is unaffected. ## Built CLI `GHIDRA_INSTALL_DIR=./fixture rea doctor --provider ghidra --json` → `healthy: false`, Ghidra `available: false`, `registrationEnvironment: {}`, check `configuration`: `GHIDRA_INSTALL_DIR must be absolute` / "Set GHIDRA_INSTALL_DIR to an absolute path. REA's analysis and MCP server reject relative paths even when they resolve from the current directory." ## Tests `src/ghidra/GhidraInstallation.test.ts` (`Ghidra configuration paths`): - relative install dir, relative `JAVA_HOME`, and both are each `unavailable` with `not_configured` and the named setting(s), and the doctor projection is unavailable with an empty registration environment (all three fail on `main`); - a Windows absolute path passes the configuration check when inspecting `win32`. ## Verification - `npm run check:fast`, `npm run jscpd` - `npm run test:focused --` every test using the Ghidra installation inspection, Ghidra doctor, or setup's registration environment (4 files, 69 passed) - Built CLI doctor run, as above No real Ghidra installation here. This changes only the configuration check, which runs before any installation file or Java probe matters. Related: #1199 makes `configuration_invalid` errors name the setting. A later change could have doctor run the full configuration parser, which would also catch a relative `REA_GHIDRA_NATIVEAOT_JAR` (also mentioned in #1184), currently outside the Ghidra installation inspection. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:23 +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#2713
No description provided.