Repository navigation
Description
Problem Description
The MCP tool ai_benchmark publishes the options servers ("Comma-separated Ollama server URLs") and models (an entry can be model@url). The model that calls the tool gives both. The benchmark sends its chat requests to each URL with POST {url}/api/chat. The client dials at the configured level, which admits loopback without ai.allow_private_network. The AI API key does not go to such a URL (#954), but the requests do.
The URL can end in ?x=. Then the path of the request is the path that the caller wrote. So a model can make the tool send many POST requests, with a prompt body, to any path of any loopback service of the host.
The cause is the same as in #2480: a URL from the caller is used as configuration.
Reproduction Steps
- Leave
ai.allow_private_networkunset, and setai.providertoollama. - In a test, install
record_connectsfromtests/web_fakes.pywith canned Ollama chat answers. - Call the MCP tool
ai_benchmarkwithservers="http://127.0.0.1:8200/v1/sys/seal-status?x="andmodels="qwen3:0.6b". Run it again withmodels="qwen3:0.6b@http://127.0.0.1:8200/v1/sys/seal-status?x=". - Read
recorder.dialledandrecorder.written.
Expected vs Actual Behavior
Expected: the tool benchmarks only the configured servers. The URL options stay for a person at the command line.
Actual: on main at a3eb41f4, each call dialled 127.0.0.1:8200 eight times and wrote POST /v1/sys/seal-status?x=/api/chat.
Environment Diagnostics
- DevOps CLI Version: 0.15.1 (
mainata3eb41f4) - Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: DevContainer
Logs, Traces, or Terminal Output
recorder.dialled -> [('127.0.0.1', 8200)] x 8
recorder.written -> [b'POST /v1/sys/seal-status?x=/api/chat HTTP/1.1\r\nHost: 127.0.0.1:8200\r\n...']
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
The MCP tool ai_benchmark publishes servers and models options that a model can supply. A model can use these to direct POST requests to any loopback path on the host. This is a server-side request forgery vulnerability. The fix removes the model-supplied URL options from the tool schema. The tool uses only the server configured by ai.provider.
Acceptance criteria
Requirement: No servers option in tool schema
The ai_benchmark MCP tool SHALL NOT publish a servers option in its input schema.
Scenario: Schema inspection
- WHEN A client reads the ai_benchmark tool input schema
- THEN The schema has no servers property
Requirement: No model@url in models option
The ai_benchmark MCP tool SHALL NOT accept a model@url format in its models option.
Scenario: Model-supplied URL rejected
- WHEN A model calls ai_benchmark with models set to qwen3:0.6b
@http://127.0.0.1:8200 - THEN The tool does not dial 127.0.0.1:8200
Requirement: Uses configured server only
The ai_benchmark tool SHALL send its chat requests only to the server configured by ai.provider.
Scenario: Configured server used
- WHEN ai.provider is set to ollama and the tool is called with no servers option
- THEN The request goes to the configured Ollama endpoint
Requirement: Loopback not reached
A model-supplied loopback URL in any option SHALL NOT cause a dial to a loopback address.
Scenario: Loopback dial blocked
- WHEN record_connects is installed and the tool is called with a loopback URL in the servers field
- THEN recorder.dialled contains no loopback address
Existing Tool Considered
The project builds its own MCP tool. No open library provides this fix. The cost is the tokens to remove the servers option and model@url parsing from the tool schema, add a loopback-dial test, and update docs/MCP_TOOLS.md. Estimate: 3000 tokens to write, 500 tokens per regression fix, and 2 hours of elapsed time.
Key questions
- What is the fix pattern for this tool?: Remove the servers option and the model
@urlparsing from the ai_benchmark tool schema. The tool uses only the server configured by ai.provider. The CLI command line keeps the servers option for a person. (best practice) [sources: openspec/changes/archive/2026-10-29-2480-mcp-gateway-url-override/design.md:29, openspec/changes/archive/2026-10-29-2634-valkey-mcp-tools-no-url/design.md:18, openspec/changes/archive/2026-10-29-2480-mcp-gateway-url-override/tasks.md:33]- Chosen: Remove servers and model
@urlfrom tool schema. Matches the pattern in 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 design and fix(valkey): a url that an mcp valkey tool gets from the model gets the valkey password #2634 design. Each fix removes its own tool's URL option. The CLI keeps the option for a person. - Rejected: Validate the URL to block loopback. A validation check is an allow list. A new loopback range or a bypass would re-open the defect. The fix(valkey): a url that an mcp valkey tool gets from the model gets the valkey password #2634 design rejects an allow list as an escape.
- Rejected: Route through ai.allow_private_network gate. The gate already admits loopback at the configured level. The defect is that the model supplies the URL, not that the gate is too permissive.
- Chosen: Remove servers and model
- Does the tool still benchmark multiple servers?: No. The tool benchmarks the single server configured by ai.provider. A person who needs multiple servers uses the CLI command line, which keeps the servers option. (best practice) [sources: docs/MCP_TOOLS.md:190, openspec/changes/archive/2026-10-29-2480-mcp-gateway-url-override/design.md:29]
- Chosen: Single configured server. The MCP tool is called by a model. A model should not choose the target. The configured server is the only safe target.
- Rejected: Keep multi-server with validation. Validation is an allow list. The fix(valkey): a url that an mcp valkey tool gets from the model gets the valkey password #2634 design rejects this pattern.
- Is the test infrastructure already in place?: Yes. tests/web_fakes.py provides record_connects and ConnectRecorder. The issue reproduction uses them directly. [sources: tests/web_fakes.py]
- Is this issue a dependency of or dependent on fix(ai): a url that the mcp tool ai_prewarm gets from the model reaches loopback with a post request #2637 (ai_prewarm)?: No. They are parallel fixes for different tools. fix(ai): a url that the mcp tool ai_prewarm gets from the model reaches loopback with a post request #2637 covers ai_prewarm and this covers ai_benchmark. Neither depends on the other. [sources: openspec/changes/archive/2026-10-29-2480-mcp-gateway-url-override/tasks.md:33]
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 direct POST requests to any loopback path, a server-side request forgery vulnerability.The vulnerability lets a model issue arbitrary POST requests to local services without ai.allow_private_network.It exposes all local services to model-directed POST requests, a direct security risk to the host.The fix removes or restricts the servers and model@url options from the tool schema, a targeted change.Both fix model-supplied URLs in an MCP tool reaching loopback with POST, but #2637 covers ai_prewarm and this covers ai_benchmark.fix(ai): the MCP gateway tools take no URL and guard the AI key (#2640)
fix(ai): the MCP prewarm tool takes no URL from the model (#2677)
devops-cli-service commentedon Oct 29, 2026
Status set to Ready at 8036e7e (see proposed design in issue body).
chore(main): release 0.21.0 (#2711)
docs(openspec): plan #2743 fix MCP ai_benchmark models description (#…