Repository navigation
fix(frida)!: require an absolute script path over MCP - #11580
Conversation
`load_frida_script` and `instrument_with_frida` admitted a relative script `path`, which the MCP server read against its own working directory rather than the caller's. Both contracts now admit only an absolute local path, as the pcap and debugger contracts do. The `instrument-with-frida` CLI resolves a relative `--script-file` against its working directory before the contract sees it. `program` is unchanged: on a remote device it may name a path there. BREAKING CHANGE: MCP `load_frida_script` and `instrument_with_frida` refuse a relative script `path` with `invalid_request`; send an absolute path. CLI `--script-file` still accepts a relative path, and Evidence `source_path` is now the resolved absolute path. Fixes #11506
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The reviewed changes appear safe to merge; the removed test duplicates stronger MCP checks. SummaryThe PR requires absolute script paths over MCP while keeping caller-relative
Reviews (5) · Last reviewed commit: "test(frida): drop the contract-level rel..." · Reviewed by Greptile |
|
Greptile Issue 1 (relative-path fixture on Windows drives): valid, fixed in 18ad54e. The CLI test now checks that the fixture's spelling is relative ( @greptileai review |
The load and instrument contracts admit only an absolute script path, so the contract test's relative script.js no longer parsed. Use a resolved path for the accepted inputs and refuse the relative spelling in its own test.
Summary
Fixes #11506. MCP
load_frida_scriptandinstrument_with_fridaadmitted a relative scriptpath, which the server read against its own working directory, not the caller's. Both now require an absolute path, matching the sibling local-file contracts (#11079 / #11508). The CLI keeps accepting a relative--script-fileand resolves it against the caller's directory.Problem and expected behavior
Trigger:
load_frida_script {source_kind: "file", path: "script.js"}over MCP read<server cwd>/script.js. Expected: a relative path is refused as invalid input before any session work; the CLI, which runs in the caller's directory, resolves it.Change and scope
src/contracts/fridaToolContracts.ts: the scriptpathof both contracts usesabsoluteLocalPathStringSchema.src/cli/fridaCommands.ts:instrument-with-fridadeclarescallerPaths: ["path"], so the shared CLI projection resolves--script-filewithabsoluteCallerPathbefore the contract admits it.program(spawn target). On a remote device it may name a path on that device, so it stays as is (per the issue).Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
callerPathsowns caller-relative resolution. No downstream repair.pathschemas gain the absolute-path pattern (breaking for MCP callers that sent relative paths).verify:advertised-schemas -- --update-summaryproduced no summary change.source_pathis the path read; from the CLI with a relative spelling it is now the resolved absolute path.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): Catalog regenerates from the contract; no committed generated file changed.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/mcp/fridaLifecycleMcp.test.ts: both MCP tools refuse a relative path withinvalid_requestat["path"]and load nothing.tests/boundary/cli/fridaCli.test.ts: the script-identity test passes one file as a path relative to the CLI's cwd and asserts the bytes loaded and an absolutesource_path.source_pathis relative).{"code":"invalid_request","details":{"operation":"load_frida_script","issues":[{"path":["path"],"reason":"invalid_format",...}]}}.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/cli/fridaCli.test.ts tests/boundary/mcp/fridaLifecycleMcp.test.ts tests/boundary/cli/cliInputSchemaRequired.test.ts— 3 files, 92 passed.npm run verify:advertised-schemas -- --update-summary— passed, summary unchanged.npm run docs:check— passed.npm run check:fast— passed.npx oxfmt --checkon changed files — clean. Pre-push hook ran.src/contracts/fridaToolContracts.test.tsstill used a relativescript.js. Fixed in f5ecffe (absolute path for accepted inputs); b48624b drops a contract-level relative-path check that the MCP lifecycle test already covers.npm run test:local -- src/contracts/fridaToolContracts.test.ts: 6 passed. The same gate run'stests/acceptance/applications/bundleResourceRootCliMcp.test.tsfailures also fail on main (subjectshape after feat(evidence)!: name the Evidence subject by its target identity (format revision 2) #11416) and are not from this PR.Compatibility, safety, and release
load_frida_scriptandinstrument_with_fridarefuse a relative scriptpath(previously read against the server's cwd). Migration: send an absolute path. CLI--script-filestill accepts a relative path. A compatibility path cannot be kept: the server cannot know the caller's directory.Author readiness
Human owner:
Before merge
type(scope): outcome.