Repository navigation
Description
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).
outputis a file path that the command writes. A model can choose a path and make the tool write a report there.documentandcodeare 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
- 2026-10-29: the review of the fix of fix(ai): a server url that the mcp tool ai_benchmark gets from the model reaches loopback with post requests #2638 listed the published options and read
generator.py. No path restriction applies to these three options.
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
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
A model can write to any path and read any file, which is an arbitrary file read/write vulnerability.Arbitrary file write and read by a model is a direct security gap with no guard in place.Prevents a model from exfiltrating sensitive files or overwriting arbitrary files on the host.A path-restriction pattern already exists in #2480, so the work is to apply it to three options and add tests.Both address unvalidated model-supplied input to the same ai_benchmark tool, but #2638 covers URL options while this covers file path options.devops-cli-service commentedon Oct 29, 2026
Status set to Ready at 244bafb (see proposed design in issue body).
fix(ai): the mcp benchmark tool takes no file path (#2738)
chore(main): release 0.21.4 (#2741)