Repository navigation
fix(managed): refuse non-PE inputs as unsupported targets - #6287
Conversation
The managed static provider refused a readable non-PE executable with AnalysisCapabilityUnavailableError, the same type as its unimplemented operation guard. inspect-managed-artifact, inspect-managed-members and inspect-managed-native-boundaries therefore reported capability_unavailable / unsupported_provider and omitted the selected path. Return AnalysisUnsupportedTargetError with the operation, path and observed format instead. Unimplemented operations keep the capability error. Fixes morluto#6076
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] This PR appears safe to merge; no actionable issues were found. SummaryCorrects non-PE refusals in
Reviews (1) · Last reviewed commit: "fix(managed): refuse non-PE inputs as un..." · Reviewed by Greptile |
|
Thanks for correcting the managed-inspection errors, @mhamzasakhi. Reporting a non-PE file as an unsupported target, with its selected path, gives CLI and MCP callers useful guidance about the input format. Welcome to REA! |
Summary
Fixes #6076.
inspect-managed-artifact,inspect-managed-membersandinspect-managed-native-boundariesrefused a readable non-PE executable ascapability_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.executeinsrc/dotnet/ManagedStaticProvider.tsreturnedAnalysisCapabilityUnavailableErrorfor a non-PE target. That is the same type as the adjacent guard for operations the provider does not implement.AnalysisUnsupportedTargetErroris documented for exactly this case: "a readable supplied artifact lies outside this operation's supported target formats". It is already projected asunsupported_target, withoperation,pathandreasondetails and format-based recovery advice.Change and scope
AnalysisUnsupportedTargetError(operation, target.path, reason). The reason text, including the observed format, is unchanged.AnalysisCapabilityUnavailableError.unsupported_targetdefault already gives the advice the issue asks for.runManagedProviderExecution, so both adapters change together.BinarySessionruntime-availability marking is not on this path.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_providertounsupported_target/unsupported_target, withdetails.pathadded.details.provider_idis 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 returnunsupported_target, non-retryable, with the default remediation and exactoperation,pathandreasondetails.tests/boundary/mcp/managedMcp.test.ts:inspect_managed_artifactwith 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 oldAnalysisCapabilityUnavailableError. It now asserts the corrected error, with operation, path and reason.Base reproduction (executed): with only
ManagedStaticProvider.tsreverted, 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_providerwithprovider_idand nopath.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
capability_unavailablefor non-PE managed inputs will now seeunsupported_target. That is the documented classification for this condition, and the error details now carry the selected path.Author readiness
Human owner: @mhamzasakhi
Before merge
type(scope): outcome.