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
- OWASP MCP Top 10: MCP01:2025 (Token Mismanagement & Secret Exposure)
- OWASP Agentic Top 10: ASI03 (Identity and Privilege Abuse)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-TOKEN-12 (Token in URL)
- CSA AI Controls Matrix (AICM): CEK-08
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.