← Back to Pull requests

fix(configurable): require approval for MCP subprocesses #1591

Open
unknown opened this pull request with 346 lines diff across 4 files
View on GitHub
unknown unknown commented on Sep 14, 2026 01:06 UTC
Author

Link to Issue or Description of Change

Closes #1569.

YAML McpToolset configs can start arbitrary local commands when tools are first listed. Require an operator-provided --mcp-policy JSON file approving executable paths and complete argument lists. Empty arguments approve only commands with no arguments.

Launch through the approved policy path to preserve virtual environments, and recheck its target before startup. Both agent and Workflow node caches include the policy identity so later loads cannot inherit another policy's approvals.

Behavior change

The internal YAML loader rejects stdio MCP configs without approval. The CLI logs and skips rejected agents; an invalid policy file stops startup. Direct use of mcptoolset.New is unchanged. Approval does not sandbox programs or revoke existing toolsets.

The README documents first-match behavior for aliases, JSON field matching, and the trusted working-directory requirement.

Testing Plan

Passed locally on macOS with Go 1.26.6 against main at 12f7cab:

  • go build -mod=readonly work

  • go test -race -mod=readonly -count=1 -shuffle=on work

  • golangci-lint run (v2.3.1) in both modules

  • go mod tidy -diff in both modules; no diff
  • Regression tests exercise the factory, exact arguments, malformed policies, symlinks, and cache isolation. Workflow cases cover chains, routed edges, nested workflows, and another workflow sharing the child. Absent, empty, and different-argument policies are rejected after an approved load; the original policy still reuses cached nodes.

    Removing factory authorization fails TestResolveToolReferenceMCPPolicy. Reverting Workflow cache isolation, or dropping the policy from its key, lookup, or insertion, fails TestFromConfigWorkflowMCPPolicyIsolation. A fresh independent review of the full diff found no actionable issues.

    Local subprocess tests verify lazy startup and approved invocation paths. A manual Python 3 venv check preserved sys.prefix; it exercised startup without an MCP handshake. No model or remote MCP calls were made. Windows verification passed all five executable/symlink cases with none skipped.

    Checklist

  • Read the contribution guide.

  • Added regression tests and usage documentation.

  • Verified local subprocess startup and Python venv behavior.

  • Completed checks and an independent review.
  • Additional context

    ADK Python also denies stdio MCP configs by default. Its opt-in permits all such configs; this change requires exact command and argument approvals as requested in #1569.

    Diff: 346 lines (+259 / -87) across 4 files Reviewer: ktsoator Review duration: 36770m
    All Vouch review confidence checks passed
    Residual risk 0.37 = Change Risk (0.66) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 346 lines diff across 4 files
    0.66
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.350
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #1591"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 43.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 65.6% (HIGH) · Higher = larger blast radius
    65.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 37.4% · Moderate risk
    37.4%
    Repository