[PR #1161] [MERGED] fix(artifacts): report wrong target kinds as unsupported targets #2696

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

📋 Pull Request Information

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

Base: main ← Head: fix/artifact-unsupported-target-errors


📝 Commits (4)

  • 637bcb5 fix(artifacts): report wrong target kinds as unsupported targets
  • 44d5b4b test(artifacts): assert asset-catalog target refusal only on macOS
  • 8e74c9c fix(artifacts): refuse unsupported extraction formats before scanning
  • de43da7 fix(artifacts): report encrypted archive entries as unsupported extraction

📊 Changes

5 files changed (+144 additions, -27 deletions)

View changed files

📝 src/artifacts/ArtifactProvider.ts (+28 -10)
📝 src/artifacts/extraction/ArtifactExtraction.ts (+44 -16)
📝 tests/boundary/filesystem/artifactZipIntegrity.test.ts (+16 -0)
📝 tests/boundary/mcp/dylibResolutionMcp.test.ts (+35 -1)
📝 tests/boundary/providers/native/artifactProvider.extraction.test.ts (+21 -0)

📄 Description

Problem

Four artifact operations, and extraction of unsupported formats or encrypted entries, refuse targets they can't handle with an unavailable artifact failure that points at the host:

{"code":"artifact_operation_failed","category":"unavailable","message":"Artifact processing is unavailable for the current target or host. Check artifact support and required tools.","details":{"operation":"inspect_asset_catalog","reason":"unavailable","detail":"inspect_asset_catalog requires an active .app bundle target"}}

Reproduced on main with rea decode-interface-builder /bin/ls, rea inspect-asset-catalog /bin/ls, rea inspect-keyed-archive /bin/ls x.plist, and MCP trace_dylib_resolution on an opened plist. No host tool is missing. The operation simply doesn't support that kind of target, which REA already models as AnalysisUnsupportedTargetError (used by the EVM and pwntools providers).

Change

  • decode_interface_builder, inspect_asset_catalog, inspect_keyed_archive and trace_dylib_resolution raise AnalysisUnsupportedTargetError for their target-kind checks, with the active target's path.
  • extract_artifact on a format without an extraction reader, such as a DMG, used to run the full inventory scan (mounting the image) and then fail with the same unavailable message. It now checks the format before any inventory or output work and raises the same unsupported_target error. A real APFS DMG now fails in 0.38 s without being mounted.
  • extract_artifact on a ZIP with a password-protected entry failed with "Artifact is invalid or has changed. Get a fresh copy", naming only an occurrence ID. It now reports unsupported_target: "Archive entry secret.txt is encrypted; REA does not decrypt archive entries, so the archive cannot be extracted completely". Other unextractable occurrences keep their format failure but now name the logical path too.
  • ArtifactProvider.translateFailure keeps that typed error, as it already keeps AnalysisInputError (#1070), instead of reducing it to an io failure.

The result now names the operation, path and requirement, and gives advice that applies:

{"code":"unsupported_target","category":"unsupported_target","message":"Unsupported target for inspect_asset_catalog at /bin/ls: inspect_asset_catalog requires an active .app bundle target","remediation":{"action":"Select a target supported by this operation or choose an operation supporting the reported target format."}}

No schemas change.

Verification

  • tests/boundary/mcp/dylibResolutionMcp.test.ts:
    • new case: interface-builder and asset-catalog calls on a plist target, and a keyed-archive call on a standalone Mach-O;
    • updated case: "rejects targets that are not Mach-O" asserted only the string "unavailable" and now expects unsupported_target.
    • Both fail on main.
  • artifactProvider.extraction.test.ts: a DMG-format target is refused with AnalysisUnsupportedTargetError and no output root is created.
  • artifactZipIntegrity.test.ts: extracting the encrypted-entry fixture reports the encrypted entry, and no output is created.
  • The asset-catalog case runs only on Darwin. Elsewhere the session correctly reports the capability as unavailable on the host first (review feedback).
  • All 26 test files that reference ArtifactProvider, these four operations or ArtifactOperationError: 294 passed.
  • npm run check:fast. npm run jscpd matches main's baseline at 2.49%.
  • Test-merged with #1159, which touches the same test file: it merges cleanly and all 24 dylib CLI and MCP tests pass together.

No real Hopper or Ghidra verification was run, because this change does not touch those providers.

🤖 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/1161 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/artifact-unsupported-target-errors` --- ### 📝 Commits (4) - [`637bcb5`](https://github.com/morluto/rea/commit/637bcb5e4182b6c60e922b18688642d8e1008e90) fix(artifacts): report wrong target kinds as unsupported targets - [`44d5b4b`](https://github.com/morluto/rea/commit/44d5b4b25e0831769c1bd4e5426ef498d0bd3c74) test(artifacts): assert asset-catalog target refusal only on macOS - [`8e74c9c`](https://github.com/morluto/rea/commit/8e74c9c62fb44556b90f20bb6c12771ac05a18f2) fix(artifacts): refuse unsupported extraction formats before scanning - [`de43da7`](https://github.com/morluto/rea/commit/de43da71ae982dd0f3d7b5ae49c914729db3a6ec) fix(artifacts): report encrypted archive entries as unsupported extraction ### 📊 Changes **5 files changed** (+144 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/ArtifactProvider.ts` (+28 -10) 📝 `src/artifacts/extraction/ArtifactExtraction.ts` (+44 -16) 📝 `tests/boundary/filesystem/artifactZipIntegrity.test.ts` (+16 -0) 📝 `tests/boundary/mcp/dylibResolutionMcp.test.ts` (+35 -1) 📝 `tests/boundary/providers/native/artifactProvider.extraction.test.ts` (+21 -0) </details> ### 📄 Description ## Problem Four artifact operations, and extraction of unsupported formats or encrypted entries, refuse targets they can't handle with an `unavailable` artifact failure that points at the host: ```json {"code":"artifact_operation_failed","category":"unavailable","message":"Artifact processing is unavailable for the current target or host. Check artifact support and required tools.","details":{"operation":"inspect_asset_catalog","reason":"unavailable","detail":"inspect_asset_catalog requires an active .app bundle target"}} ``` Reproduced on `main` with `rea decode-interface-builder /bin/ls`, `rea inspect-asset-catalog /bin/ls`, `rea inspect-keyed-archive /bin/ls x.plist`, and MCP `trace_dylib_resolution` on an opened plist. No host tool is missing. The operation simply doesn't support that kind of target, which REA already models as `AnalysisUnsupportedTargetError` (used by the EVM and pwntools providers). ## Change - `decode_interface_builder`, `inspect_asset_catalog`, `inspect_keyed_archive` and `trace_dylib_resolution` raise `AnalysisUnsupportedTargetError` for their target-kind checks, with the active target's path. - `extract_artifact` on a format without an extraction reader, such as a DMG, used to run the full inventory scan (mounting the image) and then fail with the same `unavailable` message. It now checks the format before any inventory or output work and raises the same `unsupported_target` error. A real APFS DMG now fails in 0.38 s without being mounted. - `extract_artifact` on a ZIP with a password-protected entry failed with "Artifact is invalid or has changed. Get a fresh copy", naming only an occurrence ID. It now reports `unsupported_target`: "Archive entry secret.txt is encrypted; REA does not decrypt archive entries, so the archive cannot be extracted completely". Other unextractable occurrences keep their format failure but now name the logical path too. - `ArtifactProvider.translateFailure` keeps that typed error, as it already keeps `AnalysisInputError` (#1070), instead of reducing it to an `io` failure. The result now names the operation, path and requirement, and gives advice that applies: ```json {"code":"unsupported_target","category":"unsupported_target","message":"Unsupported target for inspect_asset_catalog at /bin/ls: inspect_asset_catalog requires an active .app bundle target","remediation":{"action":"Select a target supported by this operation or choose an operation supporting the reported target format."}} ``` No schemas change. ## Verification - `tests/boundary/mcp/dylibResolutionMcp.test.ts`: - new case: interface-builder and asset-catalog calls on a plist target, and a keyed-archive call on a standalone Mach-O; - updated case: "rejects targets that are not Mach-O" asserted only the string "unavailable" and now expects `unsupported_target`. - Both fail on `main`. - `artifactProvider.extraction.test.ts`: a DMG-format target is refused with `AnalysisUnsupportedTargetError` and no output root is created. - `artifactZipIntegrity.test.ts`: extracting the encrypted-entry fixture reports the encrypted entry, and no output is created. - The asset-catalog case runs only on Darwin. Elsewhere the session correctly reports the capability as unavailable on the host first (review feedback). - All 26 test files that reference `ArtifactProvider`, these four operations or `ArtifactOperationError`: 294 passed. - `npm run check:fast`. `npm run jscpd` matches `main`'s baseline at 2.49%. - Test-merged with #1159, which touches the same test file: it merges cleanly and all 24 dylib CLI and MCP tests pass together. No real Hopper or Ghidra verification was run, because this change does not touch those providers. 🤖 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-17 21:09:11 +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#2696
No description provided.