GATE004: Credential embedded in URL

A remote MCP server URL carries credentials in its userinfo component or query string.

  • Name
    Severity
    Type
    Critical
    Description

    Default severity. An individual finding may be reported higher or lower when the surrounding configuration justifies it.

  • Name
    Capabilities
    Type
    secrets
    Description

    Capability classes this rule reasons about.

  • Name
    Explain locally
    Type
    gate explain GATE004
    Description

    The same text, in your terminal, with no network access.

What Gate detected

Gate found a configured URL of the form https://token@example.com, https://user:password@example.com, or https://example.com/mcp?api_key=....

Why this matters

URLs are the single leakiest place to put a secret. They appear in HTTP Referer headers, in proxy and CDN access logs, in browser history, in error reports, in DNS-adjacent telemetry, and in every log line that records "which endpoint did we call". A credential in a URL is a credential you have published to your entire request path. Query-string credentials are additionally exempt from the protections applied to headers by most logging middleware.

Example

This is the shape of configuration that triggers the rule.

{
  "mcpServers": {
    "vendor": {
      "type": "http",
      "url": "https://sk_live_51H8xY2eZvKYlo@mcp.vendor.example/v1"
    }
  }
}

And a safer version of the same thing:

{
  "mcpServers": {
    "vendor": {
      "type": "http",
      "url": "https://mcp.vendor.example/v1",
      "headers": { "Authorization": "Bearer ${env:VENDOR_TOKEN}" }
    }
  }
}

Remediation

Rotate the credential. Move it into an Authorization header supplied from an environment reference, and prefer an OAuth flow where the server supports one.

Suppressing this rule

If this finding is acceptable in your repository, record why alongside the suppression:

gate.config.ts

export default defineConfig({
  ignore: [
    {
      rule: 'GATE004',
      reason: 'Why this is acceptable here',
    },
  ],
})

Gate refuses to apply an ignore entry with no reason. The reason is the only thing that will tell the next person whether the suppression is still true.

References

Was this page helpful?