Skip to content

fix(ai): the mcp tool ai_benchmark takes file paths from the model #2704

Description

@dan-petty

Problem Description

The MCP tool ai_benchmark publishes the options output, document and code. The model that calls the tool gives each value. No guard checks them (src/devops_cli/ai/mcp/generator.py refuses only a leading hyphen).

  • output is a file path that the command writes. A model can choose a path and make the tool write a report there.
  • document and code are paths that the command reads. A model can choose a path of any readable file and send its content to a model server as a prompt.

Found while the review of #2638 (the URL options of the same tool). #2638 covers URL options only.

Evidence

Expected

Decide with the owner what a model may give. Follow the pattern of _PATH_PARAM_RESTRICTIONS (#2480): remove an option that a model must not set, or confine a path to the workspace through one library helper. Test with real file writes and reads in a temporary directory.

Proposed design

Problem statement

The MCP tool ai_benchmark publishes file path options output, document and code. A model that calls the tool can set each to any path. This lets a model write a report to any location or read any file and send its content to an external model server. The project rule in SECURITY.md states that a tool publishes no option for untrusted input from a model.

Acceptance criteria

Requirement: Remove path options from published schema

The ai_benchmark MCP tool SHALL NOT publish output, document or code as options in its schema.

Scenario: Schema inspection

  • WHEN A client reads the ai_benchmark tool schema from the MCP server
  • THEN The schema names none of output, document or code as a parameter

Requirement: Reject path options at the argument contract

A call to ai_benchmark that passes output, document or code SHALL be rejected before any command runs.

Scenario: Argument contract refusal

  • WHEN A model calls ai_benchmark with the document option set to a file path
  • THEN The server returns an error and no subprocess starts

Requirement: Benchmark still runs with defaults

The ai_benchmark MCP tool SHALL run the benchmark command with its default tasks when no path options are given.

Scenario: Default benchmark run

  • WHEN A model calls ai_benchmark with only models and benchmark_type
  • THEN The command runs and returns a report to stdout

Existing Tool Considered

No check has run. No open tool covers the need of restricting file path options in this project's custom MCP generator. The fix is a small edit to the _PATH_PARAM_RESTRICTIONS table in src/devops_cli/ai/mcp/generator.py, following the pattern already used for the URL options of the same tool in #2638.

Key questions

  • What may a model set for output, document and code on ai_benchmark?: Remove all three from the allowed set. A model must not choose a write path or a read path. The benchmark runs with its default tasks. A person who needs a specific file uses the CLI directly. (best practice) [sources: SECURITY.md:32, openspec/changes/archive/2026-10-29-2480-mcp-gateway-url-override/design.md:5, src/devops_cli/ai/mcp/generator.py]
    • Chosen: Remove output, document and code from the allowed set. SECURITY.md states a tool publishes no option for untrusted input from a model. The fix(ai): a url that an mcp tool gives to devops ai gateway status, routes or probe-backend reaches loopback and gets the ai api key #2480 pattern removed URL options the same way. This is the smallest change and closes both the write and the read vector.
    • Rejected: Confine paths to a workspace directory with a helper. The body lists this as an alternative. It adds a validation helper and a workspace setting. It still lets a model read any file inside the workspace and send it to an external server, which is the data-exfiltration vector. The SECURITY.md rule is stronger: do not publish the option at all.
  • Which file holds the change?: src/devops_cli/ai/mcp/generator.py, the _PATH_PARAM_RESTRICTIONS entry for ("ai", "benchmark"). Remove output, document and code from the allowed frozenset. [sources: src/devops_cli/ai/mcp/generator.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/security
    status/new
    value/high
    effort/medium
    on Oct 29, 2026
  2. dan-petty commented on Oct 29, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/security. A model can write to any path and read any file, which is an arbitrary file read/write vulnerability.
    • Priority: P1-High. Arbitrary file write and read by a model is a direct security gap with no guard in place.
    • Value: High. Prevents a model from exfiltrating sensitive files or overwriting arbitrary files on the host.
    • Effort: Medium. A path-restriction pattern already exists in #2480, so the work is to apply it to three options and add tests.
    • Related: fix(ai): a server url that the mcp tool ai_benchmark gets from the model reaches loopback with post requests #2638, which asks for a different change. Both address unvalidated model-supplied input to the same ai_benchmark tool, but #2638 covers URL options while this covers file path options.
  3. added
    priority/p1-high
    on Oct 29, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 29, 2026
  5. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 244bafb (see proposed design in issue body).

  6. added
    type/bug
    scope/ai
    and removed
    type/security
    on Oct 30, 2026
  7. added a commit that references this issue on Oct 30, 2026
    5d5da15
  8. removed
    status/ready
    on Oct 30, 2026
  9. added a commit that references this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/aisource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions