[PR #6287] [MERGED] fix(managed): refuse non-PE inputs as unsupported targets #7258

Closed
opened 2026-11-01 21:46:32 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6287
Author: @mhamzasakhi
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @morluto

Base: main ← Head: fix/managed-non-pe-unsupported-target


📝 Commits (1)

  • ed86a0a fix(managed): refuse non-PE inputs as unsupported targets

📊 Changes

4 files changed (+63 additions, -3 deletions)

View changed files

📝 src/dotnet/ManagedStaticProvider.ts (+5 -2)
📝 tests/acceptance/managedCliOutput.test.ts (+37 -0)
📝 tests/boundary/mcp/managedMcp.test.ts (+15 -0)
📝 tests/boundary/providers/managed/managedStaticProvider.test.ts (+6 -1)

📄 Description

Summary

Fixes #6076. inspect-managed-artifact, inspect-managed-members and inspect-managed-native-boundaries refused a readable non-PE executable as capability_unavailable / unsupported_provider, and the selected path was missing from the error details. The refusal is about the target's format, not a missing provider capability.

Problem and expected behavior

ManagedStaticClient.execute in src/dotnet/ManagedStaticProvider.ts returned AnalysisCapabilityUnavailableError for a non-PE target. That is the same type as the adjacent guard for operations the provider does not implement.

AnalysisUnsupportedTargetError is documented for exactly this case: "a readable supplied artifact lies outside this operation's supported target formats". It is already projected as unsupported_target, with operation, path and reason details and format-based recovery advice.

Change and scope

  • The non-PE guard now returns AnalysisUnsupportedTargetError(operation, target.path, reason). The reason text, including the observed format, is unchanged.
  • The unimplemented-operation guard keeps AnalysisCapabilityUnavailableError.
  • No new remediation text. The existing unsupported_target default already gives the advice the issue asks for.
  • CLI and MCP both reach this producer, through runManagedProviderExecution, so both adapters change together. BinarySession runtime-availability marking is not on this path.
  • Not included: managed inspection still supports PE/CLI only.

Contribution scope: an ordinary error-classification fix within existing boundaries; a maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the managed static provider's format guard.

  • Contribution scope fit and linked maintainer decision: in scope; not applicable.

  • CLI and MCP/tool-catalog contract: no schema change. For non-PE inputs, the error changes from capability_unavailable / unsupported_provider to unsupported_target / unsupported_target, with details.path added. details.provider_id is no longer present for this refusal.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none. The refusal happens before any read of the target's bytes.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • 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/acceptance/managedCliOutput.test.ts (public CLI): all three commands, each on an ELF64 and a thin Mach-O fixture. Each must return unsupported_target, non-retryable, with the default remediation and exact operation, path and reason details.
    • tests/boundary/mcp/managedMcp.test.ts: inspect_managed_artifact with a non-PE path through the registered MCP tool returns the same typed error. The reporter did not test the MCP transport.
    • tests/boundary/providers/managed/managedStaticProvider.test.ts: the existing ELF case asserted the old AnalysisCapabilityUnavailableError. It now asserts the corrected error, with operation, path and reason.
  • Base reproduction (executed): with only ManagedStaticProvider.ts reverted, all three changed tests fail.

  • User-visible CLI output (executed on Linux x64; ELF, which the original Mach-O report did not cover). rea inspect-managed-members /usr/bin/true --json:

    {"error":"Analysis failed","code":"unsupported_target","category":"unsupported_target","message":"Unsupported target for inspect_managed_members at /usr/bin/true: Managed static triage requires a PE target; observed elf.","retryable":false,"remediation":{"action":"Select a target supported by this operation or choose an operation supporting the reported target format."},"details":{"operation":"inspect_managed_members","path":"/usr/bin/true","reason":"Managed static triage requires a PE target; observed elf."}}
    

    Before this change, the same command returned capability_unavailable / unsupported_provider with provider_id and no path.

  • Remaining proof gaps: macOS and Windows were not run. The universal Mach-O case from the report is covered only through the same producer, with a thin Mach-O fixture.

  • 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

Run on Ubuntu 24.04 x64 with Node 24.18.0 and npm 11.16.0:

  • npm run test:focused -- with the 3 changed test files: 19 passed. With the fix reverted: 3 failed.
  • npm run test:focused -- with every test file that references managed inspection (35 files): 517 passed, 0 failed.
  • npm run check:fast: passed.
  • rea inspect-managed-members /usr/bin/true --json: output shown above.

Compatibility, safety, and release

  • Breaking changes or migration steps: callers that matched capability_unavailable for non-PE managed inputs will now see unsupported_target. That is the documented classification for this condition, and the error details now carry the selected path.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (static provider). Linux only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new reads, execution, or network access.

Author readiness

Human owner: @mhamzasakhi

  • 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.

🔄 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/6287 **Author:** [@mhamzasakhi](https://github.com/mhamzasakhi) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/managed-non-pe-unsupported-target` --- ### 📝 Commits (1) - [`ed86a0a`](https://github.com/morluto/rea/commit/ed86a0a8c5d02e6c2270436be7b8797525c797d3) fix(managed): refuse non-PE inputs as unsupported targets ### 📊 Changes **4 files changed** (+63 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/dotnet/ManagedStaticProvider.ts` (+5 -2) 📝 `tests/acceptance/managedCliOutput.test.ts` (+37 -0) 📝 `tests/boundary/mcp/managedMcp.test.ts` (+15 -0) 📝 `tests/boundary/providers/managed/managedStaticProvider.test.ts` (+6 -1) </details> ### 📄 Description ## Summary Fixes #6076. `inspect-managed-artifact`, `inspect-managed-members` and `inspect-managed-native-boundaries` refused a readable non-PE executable as `capability_unavailable` / `unsupported_provider`, and the selected path was missing from the error details. The refusal is about the target's format, not a missing provider capability. ## Problem and expected behavior `ManagedStaticClient.execute` in `src/dotnet/ManagedStaticProvider.ts` returned `AnalysisCapabilityUnavailableError` for a non-PE target. That is the same type as the adjacent guard for operations the provider does not implement. `AnalysisUnsupportedTargetError` is documented for exactly this case: "a readable supplied artifact lies outside this operation's supported target formats". It is already projected as `unsupported_target`, with `operation`, `path` and `reason` details and format-based recovery advice. ## Change and scope - The non-PE guard now returns `AnalysisUnsupportedTargetError(operation, target.path, reason)`. The reason text, including the observed format, is unchanged. - The unimplemented-operation guard keeps `AnalysisCapabilityUnavailableError`. - No new remediation text. The existing `unsupported_target` default already gives the advice the issue asks for. - CLI and MCP both reach this producer, through `runManagedProviderExecution`, so both adapters change together. `BinarySession` runtime-availability marking is not on this path. - Not included: managed inspection still supports PE/CLI only. Contribution scope: an ordinary error-classification fix within existing boundaries; a maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: the managed static provider's format guard. - Contribution scope fit and linked maintainer decision: in scope; not applicable. - CLI and MCP/tool-catalog contract: no schema change. For non-PE inputs, the error changes from `capability_unavailable` / `unsupported_provider` to `unsupported_target` / `unsupported_target`, with `details.path` added. `details.provider_id` is no longer present for this refusal. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. The refusal happens before any read of the target's bytes. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [x] 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/acceptance/managedCliOutput.test.ts` (public CLI): all three commands, each on an ELF64 and a thin Mach-O fixture. Each must return `unsupported_target`, non-retryable, with the default remediation and exact `operation`, `path` and `reason` details. - `tests/boundary/mcp/managedMcp.test.ts`: `inspect_managed_artifact` with a non-PE path through the registered MCP tool returns the same typed error. The reporter did not test the MCP transport. - `tests/boundary/providers/managed/managedStaticProvider.test.ts`: the existing ELF case asserted the old `AnalysisCapabilityUnavailableError`. It now asserts the corrected error, with operation, path and reason. - Base reproduction (executed): with only `ManagedStaticProvider.ts` reverted, all three changed tests fail. - User-visible CLI output (executed on Linux x64; ELF, which the original Mach-O report did not cover). `rea inspect-managed-members /usr/bin/true --json`: ```json {"error":"Analysis failed","code":"unsupported_target","category":"unsupported_target","message":"Unsupported target for inspect_managed_members at /usr/bin/true: Managed static triage requires a PE target; observed elf.","retryable":false,"remediation":{"action":"Select a target supported by this operation or choose an operation supporting the reported target format."},"details":{"operation":"inspect_managed_members","path":"/usr/bin/true","reason":"Managed static triage requires a PE target; observed elf."}} ``` Before this change, the same command returned `capability_unavailable` / `unsupported_provider` with `provider_id` and no `path`. - Remaining proof gaps: macOS and Windows were not run. The universal Mach-O case from the report is covered only through the same producer, with a thin Mach-O fixture. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Run on Ubuntu 24.04 x64 with Node 24.18.0 and npm 11.16.0: - `npm run test:focused --` with the 3 changed test files: 19 passed. With the fix reverted: 3 failed. - `npm run test:focused --` with every test file that references managed inspection (35 files): 517 passed, 0 failed. - `npm run check:fast`: passed. - `rea inspect-managed-members /usr/bin/true --json`: output shown above. ## Compatibility, safety, and release - Breaking changes or migration steps: callers that matched `capability_unavailable` for non-PE managed inputs will now see `unsupported_target`. That is the documented classification for this condition, and the error details now carry the selected path. - Real Hopper/Ghidra, browser, or OS coverage: not applicable (static provider). Linux only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new reads, execution, or network access. ## Author readiness Human owner: @mhamzasakhi - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:46:32 +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#7258
No description provided.