[PR #887] [MERGED] fix(dotnet): inspect native boundaries of non-managed and malformed PEs #2319

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

📋 Pull Request Information

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

Base: main ← Head: fix/managed-native-boundaries-non-managed


📝 Commits (2)

  • d98dcfa fix(dotnet): inspect native boundaries of non-managed and malformed PEs
  • e5ba693 fix(dotnet): keep admitted CLI header facts when metadata is unreadable

📊 Changes

3 files changed (+124 additions, -43 deletions)

View changed files

📝 src/dotnet/ManagedNativeBoundaryHelpers.ts (+30 -17)
📝 src/dotnet/ManagedNativeBoundaryInspector.test.ts (+56 -0)
📝 src/dotnet/ManagedNativeBoundaryInspector.ts (+38 -26)

📄 Description

Summary

inspect_managed_native_boundaries / rea inspect-managed-native-boundaries failed on every PE without admitted CLI metadata. That includes an ordinary native DLL and a managed PE whose metadata root is corrupt:

{"code":"execution_failure","message":"Analysis could not complete. Retry once; if it continues, run `rea doctor`.","details":{"provider_id":"rea-dotnet-static","operation":"inspect_managed_native_boundaries"}}

Cause: emptyInspection passed its classification ("not-managed" / "malformed") as coverage.state, but managedNativeBoundaryInspectionSchema only allows complete | partial | unavailable. The inspector's own parse threw a ZodError, which surfaced as a provider failure. The sibling inspect_managed_artifact and inspect_managed_members succeed on the same files and report unavailable coverage.

Now these files return a normal result:

{"metadata":{"status":"absent","version":null,"table_row_counts":{}},"coverage":{"state":"unavailable","issues":[]},"limitations":["No CLI data was admitted; native boundary declarations are unavailable.", "..."]}

A malformed CLI PE keeps metadata.status: "malformed" and its parse issue (for example invalid-metadata-root). The unused "not-available"/"managed" classification values were removed from the helper's parameter type.

The existing native/malformed assertions in ManagedNativeBoundaryInspector.test.ts called inspectManagedMembersBytes, so this path had no coverage.

No schema or catalog change.

Verification

  • New case in src/dotnet/ManagedNativeBoundaryInspector.test.ts runs inspectManagedNativeBoundariesBytes on the native and corrupt-metadata PE fixtures. It fails on main with the ZodError.
  • Real files: a native PE (attach_x86.dll from the VS Code debugpy extension) returns the result above, and managed Microsoft.PowerShell.*.dll assemblies are unchanged.
  • npm run check:changed, npm run docs:check, and every managed boundary/acceptance test (20 files, 157 tests) pass.

No Hopper/Ghidra/IDA verification is needed.

🤖 Generated with Claude Code


🔄 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/887 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/managed-native-boundaries-non-managed` --- ### 📝 Commits (2) - [`d98dcfa`](https://github.com/morluto/rea/commit/d98dcfa8c2e46a7cc918aeb01058c26c4a84060c) fix(dotnet): inspect native boundaries of non-managed and malformed PEs - [`e5ba693`](https://github.com/morluto/rea/commit/e5ba6934e4ff819c09077ca70bd2417d37f85bc0) fix(dotnet): keep admitted CLI header facts when metadata is unreadable ### 📊 Changes **3 files changed** (+124 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `src/dotnet/ManagedNativeBoundaryHelpers.ts` (+30 -17) 📝 `src/dotnet/ManagedNativeBoundaryInspector.test.ts` (+56 -0) 📝 `src/dotnet/ManagedNativeBoundaryInspector.ts` (+38 -26) </details> ### 📄 Description ## Summary `inspect_managed_native_boundaries` / `rea inspect-managed-native-boundaries` failed on every PE without admitted CLI metadata. That includes an ordinary native DLL and a managed PE whose metadata root is corrupt: ```json {"code":"execution_failure","message":"Analysis could not complete. Retry once; if it continues, run `rea doctor`.","details":{"provider_id":"rea-dotnet-static","operation":"inspect_managed_native_boundaries"}} ``` Cause: `emptyInspection` passed its classification (`"not-managed"` / `"malformed"`) as `coverage.state`, but `managedNativeBoundaryInspectionSchema` only allows `complete | partial | unavailable`. The inspector's own `parse` threw a `ZodError`, which surfaced as a provider failure. The sibling `inspect_managed_artifact` and `inspect_managed_members` succeed on the same files and report `unavailable` coverage. Now these files return a normal result: ```json {"metadata":{"status":"absent","version":null,"table_row_counts":{}},"coverage":{"state":"unavailable","issues":[]},"limitations":["No CLI data was admitted; native boundary declarations are unavailable.", "..."]} ``` A malformed CLI PE keeps `metadata.status: "malformed"` and its parse issue (for example `invalid-metadata-root`). The unused `"not-available"`/`"managed"` classification values were removed from the helper's parameter type. The existing native/malformed assertions in `ManagedNativeBoundaryInspector.test.ts` called `inspectManagedMembersBytes`, so this path had no coverage. No schema or catalog change. ## Verification - New case in `src/dotnet/ManagedNativeBoundaryInspector.test.ts` runs `inspectManagedNativeBoundariesBytes` on the native and corrupt-metadata PE fixtures. It fails on `main` with the `ZodError`. - Real files: a native PE (`attach_x86.dll` from the VS Code debugpy extension) returns the result above, and managed `Microsoft.PowerShell.*.dll` assemblies are unchanged. - `npm run check:changed`, `npm run docs:check`, and every managed boundary/acceptance test (20 files, 157 tests) pass. No Hopper/Ghidra/IDA verification is needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:17:13 +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#2319
No description provided.