[PR #1667] [MERGED] feat(ghidra): configurable import language and analysis seeds #4737

Closed
opened 2026-10-31 00:54:33 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1667
Author: @sqmagellan
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @morluto

Base: main ← Head: feat/ghidra-language-and-seeds


📝 Commits (4)

  • 0909094 feat(ghidra): configurable import language and analysis seeds
  • 5527bac fix(ghidra): parse language XML and preserve seed ordering
  • becc381 test(ghidra): use explicit platform paths for seed launch checks
  • 1122ae7 fix(javascript): retain cleanup failure reason in error causes

📊 Changes

27 files changed (+1827 additions, -20 deletions)

View changed files

➕ bridge/ghidra/ReaGhidraApplySeeds.java (+151 -0)
📝 bridge/ghidra/ReaGhidraBridge.java (+5 -0)
📝 docs/ghidra-provider.md (+3 -0)
📝 docs/installation.md (+21 -0)
📝 docs/testing.md (+1 -0)
📝 package-lock.json (+1 -0)
📝 package.json (+3 -0)
📝 scripts/verify-packaged-ghidra-windows.mjs (+1 -0)
➕ scripts/verify/ghidra/seeds.mjs (+97 -0)
📝 src/config/environment.ts (+11 -0)
➕ src/config/ghidraLanguageOverride.ts (+28 -0)
📝 src/config/parseConfig.ts (+29 -1)
📝 src/config/types.ts (+3 -0)
📝 src/ghidra/GhidraAnalysisProfile.ts (+46 -2)
➕ src/ghidra/GhidraAnalysisSeeds.test.ts (+258 -0)
➕ src/ghidra/GhidraAnalysisSeeds.ts (+286 -0)
➕ src/ghidra/GhidraLanguageCatalog.ts (+118 -0)
➕ src/ghidra/GhidraLanguageOverride.test.ts (+320 -0)
📝 src/ghidra/GhidraLauncher.ts (+49 -1)
📝 src/ghidra/GhidraProvider.behavior.test.ts (+152 -0)

...and 7 more files

📄 Description

Summary

Ghidra imports always auto-detect the language and use default analysis. That misses Borland C++ PE images (wrong compiler spec) and code reached only through computed jumps or data. No linked issue.

Change and scope

  • REA_GHIDRA_LANGUAGE_ID / REA_GHIDRA_COMPILER_SPEC_ID: passed as -processor / -cspec; checked against the installation's .ldefs; rejected for DOS imports.
  • REA_GHIDRA_SEED_FILE: address<TAB>function|code|label[<TAB>name] lines applied by a pre-script before auto-analysis.
  • Not included: persistent projects, data seeds, CLI flags.

Contract and boundary impact

  • CLI and MCP/tool-catalog contract: none.
  • Provider compatibility: unchanged when the variables are unset.
  • Evidence: the analysis profile records language_id, compiler_spec_id, language_selection and analysis_seeds (digest and counts). The handshake must report the committed language and seed digest, or the session fails closed. Limitations report seed outcome counts.
  • Package: adds bridge/ghidra/ReaGhidraApplySeeds.java.

Evidence and regression coverage

  • Tests: config parsing, .ldefs admission, profile digests, launcher arguments, seed parsing/snapshot/tamper, handshake mismatch.
  • Real Ghidra 12.1.4 (macOS arm64) on a 3.6 MB Borland C++ PE with borlandcpp and 17,183 seeds: 14,961 functions, 1,592 code seeds and 484 labels applied; xrefs to a computed-jump dispatch global went from 0 to 17.
  • Gaps: Windows P0 and Linux not run.

Validation performed

  • npm run check: pass.
  • npx vitest run src/ghidra tests/boundary/providers/ghidra src/config.test.ts: 366 passed.

🔄 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/1667 **Author:** [@sqmagellan](https://github.com/sqmagellan) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `feat/ghidra-language-and-seeds` --- ### 📝 Commits (4) - [`0909094`](https://github.com/morluto/rea/commit/09090943ac39e12b52a9361ee25f639f8dfbc5ce) feat(ghidra): configurable import language and analysis seeds - [`5527bac`](https://github.com/morluto/rea/commit/5527bac4e288b60a835a99eb06f38694eac84722) fix(ghidra): parse language XML and preserve seed ordering - [`becc381`](https://github.com/morluto/rea/commit/becc381928847947f6cd05049b89e35865833901) test(ghidra): use explicit platform paths for seed launch checks - [`1122ae7`](https://github.com/morluto/rea/commit/1122ae736a2cce92d40e1f8e8f72892681c318dc) fix(javascript): retain cleanup failure reason in error causes ### 📊 Changes **27 files changed** (+1827 additions, -20 deletions) <details> <summary>View changed files</summary> ➕ `bridge/ghidra/ReaGhidraApplySeeds.java` (+151 -0) 📝 `bridge/ghidra/ReaGhidraBridge.java` (+5 -0) 📝 `docs/ghidra-provider.md` (+3 -0) 📝 `docs/installation.md` (+21 -0) 📝 `docs/testing.md` (+1 -0) 📝 `package-lock.json` (+1 -0) 📝 `package.json` (+3 -0) 📝 `scripts/verify-packaged-ghidra-windows.mjs` (+1 -0) ➕ `scripts/verify/ghidra/seeds.mjs` (+97 -0) 📝 `src/config/environment.ts` (+11 -0) ➕ `src/config/ghidraLanguageOverride.ts` (+28 -0) 📝 `src/config/parseConfig.ts` (+29 -1) 📝 `src/config/types.ts` (+3 -0) 📝 `src/ghidra/GhidraAnalysisProfile.ts` (+46 -2) ➕ `src/ghidra/GhidraAnalysisSeeds.test.ts` (+258 -0) ➕ `src/ghidra/GhidraAnalysisSeeds.ts` (+286 -0) ➕ `src/ghidra/GhidraLanguageCatalog.ts` (+118 -0) ➕ `src/ghidra/GhidraLanguageOverride.test.ts` (+320 -0) 📝 `src/ghidra/GhidraLauncher.ts` (+49 -1) 📝 `src/ghidra/GhidraProvider.behavior.test.ts` (+152 -0) _...and 7 more files_ </details> ### 📄 Description ## Summary Ghidra imports always auto-detect the language and use default analysis. That misses Borland C++ PE images (wrong compiler spec) and code reached only through computed jumps or data. No linked issue. ## Change and scope - `REA_GHIDRA_LANGUAGE_ID` / `REA_GHIDRA_COMPILER_SPEC_ID`: passed as `-processor` / `-cspec`; checked against the installation's `.ldefs`; rejected for DOS imports. - `REA_GHIDRA_SEED_FILE`: `address<TAB>function|code|label[<TAB>name]` lines applied by a pre-script before auto-analysis. - Not included: persistent projects, data seeds, CLI flags. ## Contract and boundary impact - CLI and MCP/tool-catalog contract: none. - Provider compatibility: unchanged when the variables are unset. - Evidence: the analysis profile records `language_id`, `compiler_spec_id`, `language_selection` and `analysis_seeds` (digest and counts). The handshake must report the committed language and seed digest, or the session fails closed. Limitations report seed outcome counts. - Package: adds `bridge/ghidra/ReaGhidraApplySeeds.java`. ## Evidence and regression coverage - Tests: config parsing, `.ldefs` admission, profile digests, launcher arguments, seed parsing/snapshot/tamper, handshake mismatch. - Real Ghidra 12.1.4 (macOS arm64) on a 3.6 MB Borland C++ PE with `borlandcpp` and 17,183 seeds: 14,961 functions, 1,592 code seeds and 484 labels applied; xrefs to a computed-jump dispatch global went from 0 to 17. - Gaps: Windows P0 and Linux not run. ## Validation performed - `npm run check`: pass. - `npx vitest run src/ghidra tests/boundary/providers/ghidra src/config.test.ts`: 366 passed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:54:33 +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#4737
No description provided.