mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

[Bug]: Preflight ignores effective profile tool policy on REST, CLI and MCP

Open Dumbris opened this issue 1 month ago • 0 comments

What happened?

Preflight reports ready for tools that the same caller's effective profile blocks at execution. Reproduced on the v0.70.0 release through all three entry points:

  • REST: POST /api/v1/preflight, authenticated with a profile-pinned agent token, both with and without an explicit profile in the body.
  • CLI: mcpproxy tools preflight ... --profile research -o json returns verdict: ready and exit 0.
  • MCP: describe_tool with check: true in the pinned token's session returns verdict: ready.

Both a write tool above the profile's read cap and a read tool explicitly denied by a profile rule were reported ready. Execution correctly refused them, and access explain correctly identified the tier restriction.

This gives unattended tasks a false go-ahead: they pass their prerequisite check, spend model time, then fail on a refusal that was already knowable from local policy. This reproduction does not demonstrate an execution authorization bypass.

Expected behavior

Preflight must evaluate the effective profile tool policy, not only server membership and runtime readiness. For the same identity and policy snapshot, a locally policy-blocked tool must never be ready.

Keep the check observational: zero upstream calls, no connects/reconnects, and no configuration or approval changes. REST may still return HTTP 200 for a successfully performed check; the semantic verdict must be non-ready.

Steps to reproduce

  1. Start an isolated daemon with require_mcp_auth: true and a connected, approved synthetic server named work. Disable quarantine only for the trusted fixture, or explicitly approve its tools. Have the server expose:

    Tool Annotations
    read_document readOnlyHint: true, destructiveHint: false
    read_payroll readOnlyHint: true, destructiveHint: false
    create_issue readOnlyHint: false, destructiveHint: false
  2. Configure this profile and create a token pinned to it:

    {
      "name": "research",
      "title": "Research only",
      "servers": ["work"],
      "max_tier": "read",
      "tools": {"deny": ["work:read_payroll"]},
      "code_execution": false,
      "management_tools": false
    }
    
    mcpproxy token create --name research-agent --profile research --expires 1h
    
  3. Using that agent token, POST this body to /api/v1/preflight:

    {
      "profile": "research",
      "tools": [{"id": "work:create_issue"}]
    }
    

    Observed HTTP 200 with:

    {
      "success": true,
      "data": {
        "verdict": "ready",
        "tools": [{"id": "work:create_issue", "status": "ready"}]
      }
    }
    

    Omitting profile gives the same false-ready result. Checking work:read_payroll under the pinned token also returns ready.

  4. Run the CLI check against the same isolated daemon:

    mcpproxy tools preflight work:read_document work:create_issue \
      --profile research -o json
    

    Observed: both tools ready, overall ready, exit 0.

  5. In an initialized MCP session authenticated with the pinned token, call:

    {
      "name": "describe_tool",
      "arguments": {
        "tool_ids": ["work:read_document", "work:create_issue"],
        "check": true
      }
    }
    

    Observed: both tools ready, overall ready.

  6. Attempt execution with the same agent token:

    • call_tool_write, name: work:create_issue, args_json: "{}": isError: true, blocked by profile: work:create_issue is a write tool; profile "Research only" (research) allows read tools only.
    • call_tool_read, name: work:read_payroll, args_json: "{}": isError: true, blocked by profile: work:read_payroll is denied by a rule in profile "Research only" (research).

    The fixture's upstream-call ledger contained neither blocked dispatch. The permitted work:read_document did execute.

  7. As an operator, GET /api/v1/access/explain?profile=research&tool=work:create_issue reports the tier_cap step as fail, detail above_tier_cap.

Acceptance criteria

  • [ ] REST, CLI and MCP check mode reuse the effective profile policy decision used by dispatch (or a shared equivalent), including tier caps, deny rules, unannotated handling and classification.
  • [ ] Caller scope composes correctly: credential pin/client binding, URL/session selection where applicable, and an explicit preflight profile may only narrow authorized access. Preserve existing scope-silent responses for inaccessible tools.
  • [ ] Above-cap writes/destructive tools and explicitly denied reads receive non-ready semantic verdicts on every preflight surface. CLI exits with the existing appropriate blocked code, not 0.
  • [ ] Positive cases remain ready: permitted reads, allowed exact exceptions, and valid classification entries. Test deny-over-allow precedence and composition with token permission tiers.
  • [ ] Add regression cases for unknown tools, deleted pins, and policy changes between requests; a stale policy snapshot must not silently widen a grant.
  • [ ] Verify evaluator/dispatch parity with a fixture counter: checks make zero upstream calls, and blocked execution never dispatches. Do not make test fakes prefilter away the policy cases under test.
  • [ ] Preserve the existing quarantine, approval, schema-pin, readiness, audit and retryability behavior. A point-in-time preflight still cannot guarantee later transport or upstream success.

Version and evidence

  • MCPProxy v0.70.0 (personal), darwin/arm64, macOS; tested 2026-10-10.
  • Executable extracted from the official release tar archive. Archive SHA-256: 077d2ec0c783aa7bf0f724fec6e257018320d07abfa051315bf2f12a17e1eaf7, matching the release checksum file.
  • Build VCS revision: 48ad26eee224a57b05e06c2be300047b4747c985 (peeled v0.70.0 tag). Release build metadata reports vcs.modified=true.
  • Reproduction used scratch HOME/config/data, loopback port 18873, telemetry disabled, Unix socket disabled, and synthetic stdio upstreams. No real service credentials or external writes.
  • These are captured release observations; current main was not claimed to have been runtime-retested.
  • Full request/response evidence was retained in QA scenario 10 / finding F01. Essential payloads and outcomes are included above so the issue is reproducible without local artifacts.

Related background: #969 introduced the automation-critical preflight use case. No matching open issue was found in searches for preflight and preflight profile.

Dumbris avatar Oct 10 '26 10:10 Dumbris