Skip to content

AAK-MCP-TUNNEL-003: MCP Tunnels: tunnel credentials hardcoded in repo / CI

Severity
CRITICAL
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/mcp_tunnel.py
Auto-fixable
No.
SARIF name
McpTunnelCredentialHardcoded

What it detects

A tunnel token or server TLS private key is checked into the repository or pinned as a literal value in a CI workflow. Per the MCP Tunnels overview, "if an attacker obtains your tunnel token AND one of your TLS private keys, they could impersonate your proxy and read MCP request payloads — treat both as high-value secrets." Triggers on literal tunnel-token env vars in CI, PEM private keys committed under MCP-Tunnels paths, and Kubernetes Secret manifests named mcp-tunnel / mcp-tunnel-token / mcp-tunnel-cert carrying inline data: values.

How to fix

Move tunnel tokens and server-cert material into a secrets manager (GitHub Actions secrets, Vault, sealed-secrets, External Secrets Operator, vault-secrets-operator). For the setup CLI, use Workload Identity Federation (ANTHROPIC_IDENTITY_TOKEN_FILE) instead of a literal token. See https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/security (Protect credentials at rest, Rotate credentials).

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-TUNNEL-003

Limitations

Looks for a literal value for one of a fixed set of token names (MCP_TUNNEL_TOKEN, TUNNEL_TOKEN, ANTHROPIC_IDENTITY_TOKEN and two more) on a KEY: value line of a GitHub Actions, GitLab CI, Azure Pipelines or CircleCI file, for a PEM private key in a file under a tunnel or gateway directory, and for a Kubernetes Secret named exactly mcp-tunnel, mcp-tunnel-token or mcp-tunnel-cert. The same token in a docker-compose.yml, or in a Secret with any other name, is not examined.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-TUNNEL-003.md: the page then shows that text, with the registry reference appended under it.