Skip to content

Refuse stateful ADB tools unless explicitly allowed#121

Merged
adamcohenhillel merged 1 commit into
mainfrom
fix/adb-stateful-gating
Jul 5, 2026
Merged

Refuse stateful ADB tools unless explicitly allowed#121
adamcohenhillel merged 1 commit into
mainfrom
fix/adb-stateful-gating

Conversation

@adamcohenhillel

Copy link
Copy Markdown
Contributor

Summary

  • The ADB transport now loads each tool's confirmation level from runtime/protocol/openphone-commands.json and refuses state-changing tools (tap, type, clipboard, open-url, send, etc.) by default with a clear stateful_tool_refused error explaining how to opt in, since ADB has no on-device confirmation UI.
  • New opt-in: OPENPHONE_ADB_ALLOW_STATEFUL=1 env var or allowStateful: true constructor option (mirroring dryRun). An explicit option overrides the environment. OPENPHONE_DRY_RUN keeps precedence: nothing executes in dry-run, even with the opt-in.
  • Documented OPENPHONE_DRY_RUN as the safe exploration default and OPENPHONE_ADB_ALLOW_STATEFUL for real device driving in the MCP server README; synced the packaged transport copies in integrations/cli and integrations/mcp-server.
  • Added tests/integrations/adb-stateful-gating-contract.mjs (refused by default, env/option opt-in, option-over-env, dry-run precedence, read-only tools unaffected) and wired it into scripts/check-runtime-protocol.sh and scripts/check.sh.

Test plan

  • node tests/integrations/adb-stateful-gating-contract.mjs
  • ./scripts/check-runtime-protocol.sh
  • ./scripts/check.sh

Closes #66

🤖 Generated with Claude Code

The ADB transport executed manifest-flagged confirmation tools (tap,
type, clipboard, open-url) with no gate, so any MCP client could drive
the device with full input injection. Load each tool's confirmation
level from the runtime manifest and refuse state-changing tools by
default, with OPENPHONE_ADB_ALLOW_STATEFUL=1 or allowStateful: true as
the explicit per-session opt-in. Dry-run precedence is unchanged.

Closes #66

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openphone-docs Ready Ready Preview, Comment Jul 4, 2026 2:24am

Request Review

@adamcohenhillel adamcohenhillel merged commit 4a6e8db into main Jul 5, 2026
3 checks passed
@adamcohenhillel adamcohenhillel deleted the fix/adb-stateful-gating branch July 6, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADB transport ignores manifest confirmation: "always" on dangerous tools

1 participant