Repository navigation
Description
Problem Description
The MCP tool k8s_logs publishes the option loki_url ("Loki service endpoint"). The model that calls the tool gives it. execute_loki_query in src/devops_cli/k8s/logql.py builds f"{loki_url}/loki/api/v1/query_range", and sends a GET with params= through a client at the private level (EgressLevel.PRIVATE). That level admits each address but cloud metadata, whatever ai.allow_private_network says. httpx2 replaces the query of the URL with params. So the URL http://<host>/some/path?x= becomes GET /some/path?query=..., with any path that the caller names.
The tool returns the answer: a non-200 answer text goes into KubernetesLoggingError (resp.text.strip()), and a 200 answer is parsed as Loki JSON. Thus a model can send GET requests to the private and loopback services of the host and read their error texts. The cause is the same as in #2480: a URL from the caller is used as configuration.
Reproduction Steps
- Leave
ai.allow_private_networkunset. - In a test, install
record_connectsfromtests/web_fakes.pywith a canned HTTP 500 answer whose body is a marker text. - Call the MCP tool
k8s_logswithquery='{namespace="a"}'andloki_url="http://<host in a private range>:8200/v1/sys/seal-status?x=". - Read
recorder.dialled,recorder.writtenand the tool error.
Expected vs Actual Behavior
Expected: the tool queries only the configured Loki. A URL option stays for a person at the command line, or the tool dials a URL from the caller at the public level.
Actual: on main at a3eb41f4, the client dialled the private host on port 8200, wrote GET /v1/sys/seal-status?query=%7Bnamespace%3D%22a%22%7D&limit=100&since=1h&direction=BACKWARD, and the tool error held the marker text of the answer: Loki query failed with HTTP 500: <marker>.
Other MCP tools that publish a URL option and are not checked yet: ai_prewarm (url), ai_benchmark (servers) and vault_status (vault_addr).
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
ToolError: Command exited with status 1:
Loki query failed with HTTP 500: <marker>
recorder.dialled -> [('<private address>', 8200)]
recorder.written -> [b'GET /v1/sys/seal-status?query=%7Bnamespace%3D%22a%22%7D&limit=100&since=1h&direction=BACKWARD HTTP/1.1\r\nHost: ...']
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.
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-supplied URL enables SSRF to private and loopback addresses and reads their responses.Confirmed SSRF in a model-callable tool with working reproduction steps.Exposes private service responses to an untrusted model caller.Requires fixing the egress level or removing the URL option for k8s_logs, plus checking three other tools named in the body.Both are MCP tools where a model-supplied URL bypasses egress controls to reach private addresses, but they target different tools and different services.fix(ai): the MCP gateway tools take no URL and guard the AI key (#2640)
fix(k8s): the MCP tool k8s_logs takes no Loki URL (#2668)
chore(main): release 0.16.5 (#2671)