Skip to content

feat(security): refuse a secret value as an MCP tool parameter #3222

Closed

Description

@dan-petty

Problem or Motivation

The model writes the arguments of an MCP tool call. A secret in an argument passes through the model context, the provider, the LLM cache and the run trace, and a model can be induced to send it to another tool. SECURITY.md rule 11 treats a URL or host that a model gives to an MCP tool as untrusted. It has no rule for a credential. The server is to be reached by jobs through LiteLLM (see #3219), and the owner wants a credential for an execution to be set by the harness, with the permissions in the credential and not in the tool.

Proposed Solution & Architectural Design

  • Add a rule to SECURITY.md, next to rule 11: MCP Tool Secrets. A tool publishes no parameter that takes a secret value (a password, token, API key or private key). A credential for a call is carried on the connection, as a header the harness sets, or as an opaque credential_ref that the server resolves from the secret store. A tool never returns or logs a credential.
  • Add a guard test under tests/ai/mcp/ that reads the published schema of every tool and fails when a parameter has a name that suggests a secret (password, secret, token, api_key, apikey, private_key, credential, bearer), unless the tool is on a short allow-list with a reason (for example a parameter that holds a path to a key file or a name of a setting, not a value). The allow-list is a constant, and a new entry needs a reason.
  • Fix any tool that fails today: the refine step lists them. A tool that needs a credential takes a credential_ref or reads the configured credential.
  • Mask the arguments in the run trace and the tool-call logs by name, with mask_secrets as a second guard.

Open questions for the refine step: which tools fail the test today; whether any current tool takes a url or host with a credential (rule 11 covers the host); and whether the allow-list should be in the exposure table or a separate constant.

Target Subsystem

SECURITY.md, tests/ai/mcp/, src/devops_cli/ai/mcp/generator.py, src/devops_cli/config/constants.py.

Existing Tool Considered

No tool checks MCP tool schemas for secret parameters. The project already builds the tool schemas from the Click commands, so a test over the generated schema is small. Cost to build: about 50k tokens and 3 hours. To keep: a short allow-list.

Related: #3219, #3220, #3221, SECURITY.md rule 11.

Activity

  1. added
    type/feature
    scope/security
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

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

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/security. The (security) scope of the title gives the scope.
    • Priority: P2-Medium. This is preventive security hardening with no active exploit or advisory, so it is important but not urgent.
    • Value: Medium. It closes a gap in the threat model for credentials passed as tool arguments, protecting users from secret leakage.
    • Effort: Medium. The body estimates about 50k tokens and 3 hours, covering a rule, a guard test, and fixes to failing tools.
    • Related: fix(mcp): mcp tools refuse coerced arguments before they run, with prescriptive errors that never echo values #862, which asks for a different change. Both harden MCP tool argument handling, but #862 refuses coerced or invalid argument values while the candidate rejects parameters whose names suggest a secret.
  3. removed
    status/new
    on Nov 2, 2026
  4. added a commit that references this issue on Nov 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

    effort/mediumpriority/p2-mediumscope/securitytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions