Skip to content

AAK-TRANSPORT-004: Session token in URL query parameter

Severity
HIGH
Category
Transport Security (transport-security)
Scanner
agent_audit_kit/scanners/transport_security.py
Auto-fixable
No.
SARIF name
McpTokenInUrl

What it detects

A session token or API key is passed as a URL query parameter, risking exposure in logs and referrer headers. Applies to: every URL-bearing transport -- http/https, ws/wss, and SSE/Streamable HTTP, including loopback URLs, since the exposure is the URL being written down (proxy logs, shell history, referrer headers) rather than the hop being observed. A WebSocket handshake URL is logged by the same intermediaries as any other request line. Does not apply to: stdio (no URL).

How to fix

Pass tokens in HTTP headers instead of URL query parameters.

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

agent-audit-kit scan . --rules AAK-TRANSPORT-004

Limitations

Looks for ? or & followed by token, key, api_key, apikey, secret, auth, access_token or session_token and = in the server url. Other parameter names (?api-key=, ?jwt=) and a credential carried in the URL path (/s/abc123/mcp) are not matched.

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-TRANSPORT-004.md: the page then shows that text, with the registry reference appended under it.