Repository navigation
fix(ghidra): report selected project identity failures - #8379
Merged
Merged
Conversation
This was referenced Oct 31, 2026
Contributor
[Medium impact] The PR appears safe to merge; no new actionable issue was found. SummaryThis PR distinguishes unavailable Ghidra import identity from a known digest mismatch without admitting either program.
DiagramsequenceDiagram
participant Client as REA client
participant Bridge as Ghidra bridge
Bridge->>Bridge: Check recorded import digest
alt Digest unavailable or different
Bridge->>Bridge: Roll back script transaction
Client->>Bridge: Authenticated ping
Bridge-->>Client: Distinct identity refusal
Note over Bridge: Refuse all analysis requests
Client->>Bridge: Authenticated shutdown
Bridge-->>Client: Shutdown acknowledgement
Client->>Client: Stop owned process and remove runtime
else Digest matches
Bridge->>Bridge: Initialize analysis services
Client->>Bridge: Authenticated ping
Bridge-->>Client: Session identity
end
Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
morluto
marked this pull request as ready for review
November 1, 2026 03:55
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…identity-refusal # Conflicts: # src/ghidra/GhidraProvider.behavior.test.ts
This was referenced Nov 1, 2026
Closed
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A selected Ghidra project with a missing or different recorded import digest is refused, but REA reports a generic startup failure and suggests
rea doctor. Report unavailable identity separately from a known mismatch, while preserving the refusal. Fixes #8169.Problem and expected behavior
open_binarybinds the target lazily; the first Ghidra-backed query starts the bridge. The bridge previously exited before its authenticated connection was ready, so the structured cause was lost. A program whose saved digest isunknownand a program with a different known digest both produced generic doctor advice. Neither case should be admitted; a caller needs the reason and a matching target/project recovery path.Change and scope
On an identity refusal, roll back the bridge script transaction and serve authenticated failure-only responses until the client closes or sends shutdown. This keeps the producer alive until the refusal can be consumed; all analysis requests remain refused. Tag the two codes as admission errors only when received during startup; a later remote error with the same code remains an operation error. Project the typed cause with selected-project guidance, or provider failure guidance for a fresh import. Do not open an unverified program for analysis or fall back to a fresh import.
This changes an existing read-only admission boundary, not provider or target authority. No additional maintainer scope decision is applicable.
Contract and boundary impact
configuration_invalidwith identity-specific guidance instead of genericexecution_failure; fresh-import failures remain provider failures and do not blame project configuration. No request schema changes.Expected effects:
Evidence and regression coverage
Generated-project public MCP regression on Ghidra 12.1.4 / macOS arm64: a known mismatching import and a deliberately cleared digest produced distinct typed reasons. The matching target reopened successfully on the same MCP connection; both projects and both target files remained unchanged. Public CLI controls returned the same distinct reasons. The regression fails against the pre-change baseline at the mismatched-project assertion.
The regression is integrated into the real host-native Ghidra lane. It creates private projects, checks the saved digest-clear operation, verifies the source files and runtime cleanup, and removes its own fixtures. It passed with a short temporary path before rebasing and with a long path on the rebased commit.
Real fresh-import failure injection returned the unavailable-identity reason without naming
REA_GHIDRA_PROJECT_PATH. This is a controlled bridge injection, not evidence that Ghidra naturally omits a fresh-import digest.Production-client boundary checks exercise both startup codes, Unix socket and authenticated-loopback fixture transports, a same-code error after startup, cleanup failure/retry and cancellation during final cleanup. The loopback fixture is not real Windows verification.
Remaining: real Windows and Linux, unauthorized-peer behavior for this failure-only path, malformed/truncated failure frames, multiple waiting callers and other JDK/Ghidra versions have not been independently verified. Existing cleanup ownership and protocol checks remain applicable.
Additional restored packed-program control on head
0212145b0: compact and full real Ghidra MCP sessions selected an expanded project previously imported from.gzf. A different target produced the digest-mismatchconfiguration_invalidrefusal; reopening the matching target on the same connection successfully decompiled the expected function. Both target hashes and project-file hashes remained unchanged. This is one macOS arm64 fixture, not a Windows, missing-digest, or cancellation control.Validation performed
npm run check:ci:fast,npm run docs:check,npm run verify:ghidra:bridge-sources,npm run test:local -- src/ghidra/GhidraProvider.behavior.test.ts(186 passed), andnpm run test:focused -- tests/boundary/providers/ghidra/ghidraClient.test.ts(100 passed) — all passed after the shutdown fix.npm run verify:ghidrapassed on rebased34670812in an isolated checkout with two verifier-only corrections: retained-Evidence references for [Bug] Ghidra verification sends function Evidence beyond the default MCP input allowance #8172 and the snapshot-history correction tracked in [Bug] Ghidra snapshot verifier expects retained Evidence to disappear #8380 / PR test(ghidra): check retained historical snapshot evidence #8381. Ghidra 12.1.4 reported 433 successful and 52 rejected boundary calls, the new project identity checks, complete cleanup and an empty verified descendant list. This was before the subsequent shutdown-race fix and is not a clean-tree or final-head lane pass. The final shutdown behavior was checked through the targeted real-provider regression and client boundary tests above.After merging main through
46c13b998(head0212145b0), the 196 Ghidra provider and 100 Ghidra client boundary tests passed,npm run check:fastpassed, andnpm run verify:ghidra:bridge-sourcescompiled against Ghidra 12.1.4/JDK 21. The generated-project identity verifier passed on macOS arm64 through CLI and MCP: distinct mismatch/unavailable refusals, matching-target recovery, and unchanged source files. On this head,npm run verify:ghidrafailed atcompare_functionsbefore schema validation: the verifier sent inline Evidence exceeding the default 1,024-element MCP input allowance (#8172; fix proposed in #8541). It did not complete the full lane. A process-list check afterward found no matching Ghidra headless or verifier process; this is not a complete process-family ownership audit.A separate controlled real-Ghidra MCP run at
0212145b0replaced the bridge in a temporary checkout with a script that throws an unrelated exception. Ghidra exited zero after logging the script error; REA returned a genericexecution_failure, retained the diagnostic, did not label it as either identity refusal, and cleaned the runtime. The target remained unchanged. This is an injected fault, not a naturally observed installation failure.A separate temporary integration checkout at head
0212145b0with verifier-only changes from #8541, #8381, #8536 and #8578 passednpm run verify:ghidraon macOS arm64, Ghidra 12.1.4 and JDK 21. It reported 439 successful and 52 rejected boundary calls, verified process lineage and no remaining descendants. This is a combined run, not a clean-tree pass of #8379 alone. The first combined attempt without #8536 stopped at the old profile-mismatch wording; the second without #8578 stopped at the old regex-retention assertion.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.