Skip to content

fix(reverse): refuse a Windows objdump or Rizin command that PATH does not find - #10953

Merged
morluto merged 2 commits into
refactor/posix-path-searchfrom
fix/windows-provider-executable-unresolved
Nov 15, 2026
Merged

morluto merged 2 commits into
refactor/posix-path-searchfrom
fix/windows-provider-executable-unresolved

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

On Windows, inspect_with_objdump and execute_rizin_command resolved a bare command (objdump, rizin, or a bare REA_OBJDUMP_COMMAND/REA_RIZIN_COMMAND) on PATH/PATHEXT, but when nothing matched they launched the bare name anyway, and Windows process creation then also searches the current directory. This PR makes the unresolved case a typed capability_unavailable refusal before any launch, as findWindowsExecutable already does for the other Windows tools. Stacked on #10891, which now carries #10916 (the Windows PATH/PATHEXT search owner).

Problem and expected behavior

  • Trigger: Windows host, objdump not on PATH, an objdump.exe in REA's current directory. Before: resolveWindowsProviderExecutable returned "objdump", the spawn searched the current directory and could run that file. An invalid PATHEXT entry likewise fell back to the bare name.
  • Expected (coordinator decision for plan W8; output change accepted): when the configured bare command is not found on PATH, or PATHEXT makes the search unknown, the operation refuses with capability_unavailable and nothing is launched. Configured paths (absolute, relative with a separator) are unchanged; POSIX is unchanged (execvp does not search the current directory unless PATH names it).

Change and scope

  • resolveWindowsProviderExecutable returns Result<string, { kind: "not_found" } | WindowsPathSearchFailure> and never returns the bare name.
  • The application port (ReverseEngineeringCommandPort) now returns ReverseEngineeringCommandSelection = Result<ReverseEngineeringProviderCommand, ReverseEngineeringCommandUnavailable>; ReverseEngineeringCommandUnavailable carries the provider identity, the configured command and a tagged reason (not_found, invalid_pathext). Composition (src/composition/reverseEngineering.ts) binds the executable once through selectCommand.
  • ReverseEngineeringService.#observe turns a refused selection into AnalysisCapabilityUnavailableError after the cancellation and closed-service checks and before reserving capacity or touching the target, and records it per dispatch through #recordUnavailable (shared with the launch-failure path), so observedLaunchFailures() and capability discovery report the refusal and its repair until a later success, with diagnostics { boundary: "provider-lookup", command, lookup_failure, pathext_entry? }. The provider/setting/repair text the launch-failure path wrote inline moved to reverseCommandRepair, which both the lookup refusal and the launch failure use.
  • Docs: docs/reverse-engineering-tools.md states the Windows lookup and refusal.
  • Not included: an async lookup with a deadline (the port stays synchronous, as before, using statSync per candidate); gdb's command lookup (different owner).
  • Contribution scope: fix within existing boundaries, coordinator-approved output change.

Contract and boundary impact

  • Semantic owner and earliest changed stage: resolveWindowsProviderExecutable (composition) decides found/not-found; the port carries that decision as a Result; the service owns the error and its repair text. Superseded: the bare-name fallback and the inline launch repair text.
  • Contribution scope fit and linked maintainer decision: coordinator decision (plan W8): fail with a typed tool-unavailable refusal instead of passing a bare name.
  • CLI and MCP/tool-catalog contract: no schema change. Windows only: a missing bare objdump/Rizin command now yields capability_unavailable with boundary: "provider-lookup" instead of a launch attempt (previously capability_unavailable with boundary: "provider-launch" and system_code: "ENOENT", or a run of a same-named file in the current directory).
  • Provider, bridge, target-format, or platform compatibility: Windows objdump and Rizin lookups.
  • Evidence, artifact, provenance, or reconstruction contract: none; a refused lookup produces no Evidence, as a launch failure did not.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): nothing is launched on refusal; no target preflight runs.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/composition/resolveWindowsProviderExecutable.test.ts (unresolved bare name and invalid PATHEXT return typed failures; composition returns the provider identity and reason); tests/composition/reverseEngineeringCommandPort.test.ts (objdump not found and Rizin invalid PATHEXT through the real composition port and service: capability_unavailable, boundary: "provider-lookup", schema-valid projection, runner never called; observedLaunchFailures() carries the refusal; an already-aborted signal yields AnalysisCancelledError with the caller's reason). Fake ports in three composition tests now return ok(...).
  • Base reproduction: on the base, the resolver returns the bare name for both cases (the updated resolver tests fail; the API changed, so all 7 fail there).
  • User-visible output: the capability_unavailable refusal above, e.g. "Could not find the selected objdump command "rea-missing-objdump" on PATH; REA did not search the current directory."
  • Remaining proof gaps: no Windows run; the current-directory search claim is from documented CreateProcess behavior, and Windows is simulated through win32 path functions and an injected file probe.

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/composition/reverseEngineeringEdgeCases.test.ts tests/boundary/cli/reverseEngineeringCommands.test.ts tests/composition/resolveWindowsProviderExecutable.test.ts tests/composition/reverseEngineeringCommandPort.test.ts tests/composition/reverseEngineering.test.ts tests/composition/reverseEngineeringUnknownFailures.test.ts — 143 passed.
  • After review fixes: the same files plus the observedLaunchFailures consumer tests — 185 passed; the two refusal cases fail on the previous commit (discovery and cancellation assertions).
  • npm run typecheck, npx oxlint src/composition src/application/reverse tests/composition (no new findings), npx oxfmt on changed files, node scripts/verify/architecture-guards.mjs — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for configured paths; on Windows a bare command that only existed in the current directory is no longer run.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS host; Windows simulated.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: removes an implicit current-directory executable search on Windows.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T09:02:51.911224Z 4e4ffc0 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a664ff68c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge, with both earlier findings addressed.

Summary

Windows objdump and Rizin lookups now refuse unresolved bare commands instead of passing them to Windows for another search.

  • Windows refuses bare objdump or Rizin commands that PATH cannot find.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Select command] --> B{Cancelled or service closed?}
  B -->|Yes| C[Return existing error]
  B -->|No| D{Command found?}
  D -->|No| E[Record unavailable outcome]
  E --> F[Return capability_unavailable]
  D -->|Yes| G[Check capacity and cleanup]
  G --> H[Read target if needed]
  H --> I[Launch selected command]
  I --> J[Record launch outcome]
Loading

Reviews (4) · Last reviewed commit: "fix(reverse): report a Windows lookup re..." · Reviewed by Greptile

@morluto
morluto merged commit 16dc669 into refactor/posix-path-search Nov 15, 2026
1 check passed
@morluto
morluto deleted the fix/windows-provider-executable-unresolved branch November 15, 2026 09:17
morluto added a commit that referenced this pull request Nov 15, 2026
* refactor(process): give POSIX PATH search order one owner

Program lookup, the packet-tool locator and Jadx's Java lookup each split
PATH and resolved empty and relative entries themselves. They now take the
candidates from posixPathCandidates in src/process/executableSearch and keep
only their own probe and failure reporting. A counted architecture guard
keeps new PATH splits from returning; the remaining Windows and Ghidra
searches are baselined.

* refactor(process): move the colon-split PATH searches onto the search owner

REA's launcher-alias lookup and Ghidra's macOS Java lookup split PATH on
":" and skipped relative entries themselves; they now use
posixPathCandidates with relativeEntries: "skip", and the guard counts
colon splits of PATH as well.

* fix(process): produce PATH candidates lazily so an unused entry cannot fail an earlier match

* refactor(process): give Windows PATH/PATHEXT search order the executable search owner (#10916)

* refactor(process): give Windows PATH/PATHEXT search order the executable search owner

* fix(process): keep later PATH entries searchable after a stray quote or a removed working directory

* fix(reverse): refuse a Windows objdump or Rizin command that PATH does not find (#10953)

* fix(reverse): refuse an objdump or Rizin command Windows PATH does not find instead of launching the bare name

* fix(reverse): report a Windows lookup refusal after cancellation and to capability discovery

* fix(desktop): search a Windows host's PATH as Windows does when doctor looks up a program

programOnPath sent every host through the POSIX PATH search, so on Windows a
relative PATH entry reached absoluteCallerPath with platform linux and the
Windows working directory, which resolved against itself until the stack
overflowed. programOnPath now searches PATH and PATHEXT through
windowsPathCandidates on a Windows host, and absoluteCallerPath refuses a
non-POSIX working directory with a TypeError instead of recursing.
@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working provider: objdump Analysis provider / engine: objdump provider: rizin Analysis provider / engine: rizin labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working provider: objdump Analysis provider / engine: objdump provider: rizin Analysis provider / engine: rizin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant