fix: hide Claude permission modes from MCP callers#64
Draft
Disaster-Terminator wants to merge 1 commit into
Draft
fix: hide Claude permission modes from MCP callers#64Disaster-Terminator wants to merge 1 commit into
Disaster-Terminator wants to merge 1 commit into
Conversation
Reviewer's Guide本次 PR 移除了通过 MCP 层面控制 Claude 在调用 Claude 后端前剥离调用方 permissionMode 的序列图sequenceDiagram
actor McpClient
participant McpServer
participant stripCallerPermissionMode
participant RetinueApi
McpClient->>McpServer: claude_run(args_with_permissionMode)
McpServer->>stripCallerPermissionMode: stripCallerPermissionMode(args_with_permissionMode)
stripCallerPermissionMode-->>McpServer: safeArgs_without_permissionMode
McpServer->>RetinueApi: run(safeArgs_without_permissionMode)
alt claude_continue
McpClient->>McpServer: claude_continue(args_with_permissionMode)
McpServer->>stripCallerPermissionMode: stripCallerPermissionMode(args_with_permissionMode)
stripCallerPermissionMode-->>McpServer: safeArgs_without_permissionMode
McpServer->>RetinueApi: continueJob(safeArgs_without_permissionMode)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideThis PR removes MCP-surface control of Claude Sequence diagram for stripping caller permissionMode before Claude backend callssequenceDiagram
actor McpClient
participant McpServer
participant stripCallerPermissionMode
participant RetinueApi
McpClient->>McpServer: claude_run(args_with_permissionMode)
McpServer->>stripCallerPermissionMode: stripCallerPermissionMode(args_with_permissionMode)
stripCallerPermissionMode-->>McpServer: safeArgs_without_permissionMode
McpServer->>RetinueApi: run(safeArgs_without_permissionMode)
alt claude_continue
McpClient->>McpServer: claude_continue(args_with_permissionMode)
McpServer->>stripCallerPermissionMode: stripCallerPermissionMode(args_with_permissionMode)
stripCallerPermissionMode-->>McpServer: safeArgs_without_permissionMode
McpServer->>RetinueApi: continueJob(safeArgs_without_permissionMode)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
permissionModethat could be forwarded to the Claude CLI, creating a confused-deputy permission bypass risk.Description
permissionModefrom theclaude_runandclaude_continueMCP input schemas so the tool surface no longer advertises caller-controlled permission modes (src/mcp.ts).stripCallerPermissionModeto sanitize MCP tool arguments by dropping any caller-suppliedpermissionModebefore forwarding to the backend (src/mcp.ts).permissionModeand to verify injectedpermissionModevalues are not forwarded toretinue.run/retinue.continueJob(tests/mcp-tools.test.ts).Testing
pnpm exec tsc -p tsconfig.json --noEmitwhich completed successfully.pnpm exec vitest run --maxWorkers=1 tests/mcp-tools.test.ts tests/core/claudeArgs.test.tsand the test suite passed (Test Files 2 passed,Tests 61 passed).Codex Task
Summary by Sourcery
通过从 MCP 工具接口中移除由调用方配置的
permissionMode,并对转发的参数进行清理,强化 Claude 的 MCP 集成,以避免绕过权限模式的情况。Bug Fixes:
permissionMode,防止 MCP 调用方控制 Claude 的权限模式。Enhancements:
claude_run和claude_continueMCP 工具 schema 中停止暴露permissionMode,以降低“受骗代理人”(confused-deputy)风险。RetinueApi接口而非ClaudeRetinue协同工作。Tests:
permissionMode被从工具 schema 中省略,并且不会被转发到retinue.run或retinue.continueJob。Original summary in English
Summary by Sourcery
Harden the MCP integration with Claude by removing caller-configurable permissionMode from the MCP tool surface and sanitizing forwarded arguments to avoid permission-mode bypasses.
Bug Fixes:
Enhancements:
Tests: