Skip to content

Reject coerced MCP approvals and keep malformed input from terminating stdio - #3

Merged
rxslice merged 2 commits into
mainfrom
fix/mcp-strict-approval-validation
Nov 15, 2026
Merged

rxslice merged 2 commits into
mainfrom
fix/mcp-strict-approval-validation

Conversation

@rxslice

@rxslice rxslice commented Nov 15, 2026

Copy link
Copy Markdown
Owner

The MCP tool converts allow_review with bool(), so the string "false" grants permission to proceed on REVIEW. Non-object JSON messages can also terminate the stdio server, and malformed params are not consistently rejected.

Require a real boolean for allow_review, a nonempty string command and a supported policy. Validate request envelopes, IDs and params before dispatch; ignore notifications without executing a tool; and support ping. Valid true/false approvals retain their existing behavior.

Validation: 14 of the initial 16 regression cases failed before the fix. The final suite passes all 113 tests, including 18 new validation and stdio-continuity cases. Tests use mocked command decisions and do not execute installs. One existing FastAPI/Starlette test-client deprecation warning remains.

Not merged or released to PyPI.

codex and others added 2 commits November 15, 2026 16:13
…hema

On top of the strict-boolean and envelope validation already on this branch:

- initialize answers with the client's protocol version when supported
  (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05), else the newest.
- authorize_install_command declares readOnlyHint, title and outputSchema.
- Unknown tool names are -32602 (invalid params), as the MCP spec requires.
- 116 tests pass (21 new across this branch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GFY8tiYGqCiEEE36EPdjo
@rxslice
rxslice merged commit fc3503c into main Nov 15, 2026
4 checks passed
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.

3 participants