[PR #713] [MERGED] fix(ghidra): refuse ambiguous universal Mach-O imports #2193

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

📋 Pull Request Information

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

Base: main ← Head: fix/ghidra-universal-macho-refusal


📝 Commits (1)

  • 6582b24 fix(ghidra): refuse ambiguous universal Mach-O imports

📊 Changes

2 files changed (+45 additions, -2 deletions)

View changed files

📝 src/ghidra/GhidraProvider.behavior.test.ts (+27 -0)
📝 src/ghidra/GhidraProvider.ts (+18 -2)

📄 Description

Summary

  • refuse universal Mach-O targets before Ghidra import because the current auto-loader cannot enforce REA's selected slice
  • return the existing typed architecture_unsupported outcome with the selected and available architectures in diagnostics
  • preserve Ghidra support for thin Mach-O targets

Closes #656.

Evidence

Issue #656 records a complete macOS reproduction where REA selects arm64 for a universal Mach-O, but Ghidra imports the x86_64 slice and returns x86-64 instructions, sections, and pseudocode under an arm64 subject/profile. The current launcher passes the original universal file to Ghidra's auto-loader without a slice choice.

A regression against current main first observed inspectTargetSupport returning supported for an x86_64 + arm64 Mach-O. The test now verifies that the production provider-support seam returns a typed refusal with both architectures, while a thin arm64 Mach-O remains supported. This implements the issue's accepted safe outcome without changing artifact identity or silently analyzing a different slice.

Validation

Passed:

  • npx vitest run src/ghidra/GhidraProvider.behavior.test.ts (22 tests)
  • npm exec --package=typescript@5.9.3 -- tsc --noEmit
  • npm run lint
  • npm run knip
  • npm run metadata:check
  • targeted oxfmt --check for both changed files
  • git diff --check

Materially unverified:

  • Real Ghidra/macOS execution was unavailable because this Linux environment has no configured Ghidra installation.
  • npm run check could not complete because the repository's TypeScript 7 binary panics while resolving /proc/self/exe in this sandbox. Stable TypeScript 5.9 passed; lint, knip, metadata, and targeted formatting were run separately.

🔄 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/713 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/ghidra-universal-macho-refusal` --- ### 📝 Commits (1) - [`6582b24`](https://github.com/morluto/rea/commit/6582b2433a955167e33246ad07de1a40bcb20144) fix(ghidra): refuse ambiguous universal Mach-O imports ### 📊 Changes **2 files changed** (+45 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/ghidra/GhidraProvider.behavior.test.ts` (+27 -0) 📝 `src/ghidra/GhidraProvider.ts` (+18 -2) </details> ### 📄 Description ## Summary - refuse universal Mach-O targets before Ghidra import because the current auto-loader cannot enforce REA's selected slice - return the existing typed `architecture_unsupported` outcome with the selected and available architectures in diagnostics - preserve Ghidra support for thin Mach-O targets Closes #656. ## Evidence Issue #656 records a complete macOS reproduction where REA selects `arm64` for a universal Mach-O, but Ghidra imports the `x86_64` slice and returns x86-64 instructions, sections, and pseudocode under an arm64 subject/profile. The current launcher passes the original universal file to Ghidra's auto-loader without a slice choice. A regression against current `main` first observed `inspectTargetSupport` returning `supported` for an `x86_64 + arm64` Mach-O. The test now verifies that the production provider-support seam returns a typed refusal with both architectures, while a thin arm64 Mach-O remains supported. This implements the issue's accepted safe outcome without changing artifact identity or silently analyzing a different slice. ## Validation Passed: - `npx vitest run src/ghidra/GhidraProvider.behavior.test.ts` (22 tests) - `npm exec --package=typescript@5.9.3 -- tsc --noEmit` - `npm run lint` - `npm run knip` - `npm run metadata:check` - targeted `oxfmt --check` for both changed files - `git diff --check` Materially unverified: - Real Ghidra/macOS execution was unavailable because this Linux environment has no configured Ghidra installation. - `npm run check` could not complete because the repository's TypeScript 7 binary panics while resolving `/proc/self/exe` in this sandbox. Stable TypeScript 5.9 passed; lint, knip, metadata, and targeted formatting were run separately. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15:29 +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#2193
No description provided.