[PR #2217] [MERGED] fix(frida): name the argument each Frida input error rejects #5093

Closed
opened 2026-10-31 01:03:51 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/issue-2213


📝 Commits (1)

  • 20b1ddb fix(frida): name the argument each Frida input error rejects

📊 Changes

6 files changed (+146 additions, -9 deletions)

View changed files

📝 src/application/frida/FridaInstrumentationManager.test.ts (+36 -0)
➕ src/application/frida/fridaInputErrors.ts (+27 -0)
📝 src/cli/fridaCommands.ts (+23 -2)
📝 src/frida/FridaInstrumentationManager.ts (+18 -6)
📝 src/server/registerFridaTools.ts (+2 -1)
📝 tests/boundary/cli/fridaCli.test.ts (+40 -0)

📄 Description

Summary

Most Frida input rejections returned invalid_request with an empty issues list, while the remediation said "Correct the listed arguments and retry." Each rejection now carries an AnalysisInputIssue naming the argument and the reason:

Where Argument Message
close_frida_session, resume_frida_session, load_frida_script, unload_frida_script, frida_session_status session_id No open Frida session <id>; start one with start_frida_session.
unload_frida_script (open session) script_id No loaded Frida script <id> in this session.
load_frida_script file source that cannot be read (other than EACCES/EPERM, which already return access_denied) path Cannot read Frida script file <path>.
instrument-with-frida attach <non-integer> target attach mode needs a positive integer process ID.
instrument-with-frida with neither or both of --script/--script-file script Provide exactly one of --script or --script-file.

The session and script messages live in a small src/application/frida/fridaInputErrors.ts, shared by the manager and the MCP status tool. No acceptance, routing or effect changes: the same inputs are rejected at the same points.

Fixes #2213

Before / after

MCP frida_session_status {session_id: <not open>}
before: {"error":{"code":"invalid_request","message":"Analysis input is invalid. …","remediation":{"action":"Correct the listed arguments and retry."}}}
after:  … "details":{"issues":[{"path":["session_id"],"reason":"invalid_value","message":"No open Frida session …; start one with start_frida_session."}]}

$ rea instrument-with-frida attach abc --script 'send(1)' --format json
after:  … "issues":[{"path":["target"],"reason":"invalid_value","message":"attach mode needs a positive integer process ID."}]

Validation

  • New tests: a manager test (names the unknown session or script ID it rejects) covers close, resume, load and unload with an unknown session, and unload with an unknown script. A CLI test (names the rejected instrument-with-frida argument) covers the non-integer PID and the missing script source, and asserts the provider is never started. All three fail on main and pass with this change; 30/30 tests in those files pass, and the other Frida suites (MCP, service, contracts) pass.
  • npm run lint passes.
  • npm test: 9247 passed, 14 failed in 7 files. These are the same environmental files that fail on clean origin/main on this host: Hopper not installed, Command Line Tools only (ibtool), hdiutil, and inspector target-location cases.

Related: #2211 (#2209) moves the one-shot workflow's script-file check before session start. This PR covers the explicit load_frida_script path and the session/script lookups; the two touch different files.

🤖 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/2217 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/issue-2213` --- ### 📝 Commits (1) - [`20b1ddb`](https://github.com/morluto/rea/commit/20b1ddb0b8157d323f5aef69ba979c1ebcc82190) fix(frida): name the argument each Frida input error rejects ### 📊 Changes **6 files changed** (+146 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/application/frida/FridaInstrumentationManager.test.ts` (+36 -0) ➕ `src/application/frida/fridaInputErrors.ts` (+27 -0) 📝 `src/cli/fridaCommands.ts` (+23 -2) 📝 `src/frida/FridaInstrumentationManager.ts` (+18 -6) 📝 `src/server/registerFridaTools.ts` (+2 -1) 📝 `tests/boundary/cli/fridaCli.test.ts` (+40 -0) </details> ### 📄 Description ## Summary Most Frida input rejections returned `invalid_request` with an empty `issues` list, while the remediation said "Correct the listed arguments and retry." Each rejection now carries an `AnalysisInputIssue` naming the argument and the reason: | Where | Argument | Message | | --- | --- | --- | | `close_frida_session`, `resume_frida_session`, `load_frida_script`, `unload_frida_script`, `frida_session_status` | `session_id` | `No open Frida session <id>; start one with start_frida_session.` | | `unload_frida_script` (open session) | `script_id` | `No loaded Frida script <id> in this session.` | | `load_frida_script` file source that cannot be read (other than EACCES/EPERM, which already return `access_denied`) | `path` | `Cannot read Frida script file <path>.` | | `instrument-with-frida attach <non-integer>` | `target` | `attach mode needs a positive integer process ID.` | | `instrument-with-frida` with neither or both of `--script`/`--script-file` | `script` | `Provide exactly one of --script or --script-file.` | The session and script messages live in a small `src/application/frida/fridaInputErrors.ts`, shared by the manager and the MCP status tool. No acceptance, routing or effect changes: the same inputs are rejected at the same points. Fixes #2213 ## Before / after ```text MCP frida_session_status {session_id: <not open>} before: {"error":{"code":"invalid_request","message":"Analysis input is invalid. …","remediation":{"action":"Correct the listed arguments and retry."}}} after: … "details":{"issues":[{"path":["session_id"],"reason":"invalid_value","message":"No open Frida session …; start one with start_frida_session."}]} $ rea instrument-with-frida attach abc --script 'send(1)' --format json after: … "issues":[{"path":["target"],"reason":"invalid_value","message":"attach mode needs a positive integer process ID."}] ``` ## Validation - New tests: a manager test (`names the unknown session or script ID it rejects`) covers close, resume, load and unload with an unknown session, and unload with an unknown script. A CLI test (`names the rejected instrument-with-frida argument`) covers the non-integer PID and the missing script source, and asserts the provider is never started. All three fail on main and pass with this change; 30/30 tests in those files pass, and the other Frida suites (MCP, service, contracts) pass. - `npm run lint` passes. - `npm test`: 9247 passed, 14 failed in 7 files. These are the same environmental files that fail on clean `origin/main` on this host: Hopper not installed, Command Line Tools only (`ibtool`), `hdiutil`, and inspector target-location cases. Related: #2211 (#2209) moves the one-shot workflow's script-file check before session start. This PR covers the explicit `load_frida_script` path and the session/script lookups; the two touch different files. 🤖 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-31 01:03:51 +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#5093
No description provided.