Skip to content

fix(security): the mcp telemetry_profile tool runs any program an mcp client names #980

Closed

Description

@dan-petty

Problem

The MCP tool telemetry_profile(command=..., trace_id=...) (ai/mcp/server.py:1140-1150) runs any program an MCP client names, with the user's full environment.

  • The tool passes command to uv run devops telemetry profile <command>, after _validate_mcp_arg, which only refuses a leading hyphen.
  • _run_profiled_command (commands/telemetry.py:303-322) splits that string with shlex.split and runs it through run_subprocess(..., isolate_env=False). Nothing limits it to devops-cli commands.

The threat model treats MCP calls as untrusted input, so a prompt-injected agent with this server attached can run arbitrary commands, with every credential in the environment.

Found while reviewing #949 on 2026-10-02. With the tool's Jaeger read stubbed, telemetry_profile(command='devops review verify <session> --index 1 --status INVALIDATED -r planted') recorded a human verdict, even though #949's verify_finding tool always records agent.

Acceptance criteria

  • MCP tool. telemetry_profile no longer takes a command. MCP clients profile a trace by trace_id only, and the tool's schema and docs say so.
  • CLI. devops telemetry profile <command> runs only a devops-cli command: its first word must be devops, and it is run through the same entry point. Anything else is refused with a message, exit 1.
  • Environment. The profiled child keeps the full environment only for the devops-cli entry point; the docstring says why.
  • Other MCP tools. Every tool in ai/mcp/server.py is checked for the same pattern: a free-form string split into an argv or passed to a shell. The PR lists the result.
  • Tests:
    • The MCP tool's signature has no command parameter.
    • devops telemetry profile "bash -c true" exits 1 without starting a process.
    • devops telemetry profile "devops version" still runs.
  • uv run devops ci passes.

Key questions

  • Is this a critical fix? Yes, a security fix: arbitrary command execution from an untrusted caller.

Activity

  1. added this to the v0.2.25 milestone on Oct 2, 2026
  2. added
    type/security
    scope/mcp
    priority/p1-high
    on Oct 2, 2026
  3. dan-petty commented on Oct 2, 2026

    @dan-petty
    OwnerAuthor

    Closed by #991, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  4. added a commit that references this issue on Oct 3, 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

    priority/p1-highscope/mcptype/security

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions