AAK-MCP-TOKENVERIFIER-AUD-001: A python-sdk resource server leaves out protected-resource metadata or the token audience check
- Severity
- MEDIUM
- Category
- Trust Boundaries (
trust-boundary) - Scanner
agent_audit_kit/scanners/mcp_authz_code.py- Auto-fixable
- No.
- SARIF name
McpTokenVerifierNoAudience
What it detects
A python-sdk resource server sets token_verifier= with resource_server_url=None, which serves no protected-resource metadata and leaves the audience check to the verifier, or a custom verify_token never reads an audience or a resource, so a token issued for another server is accepted. The MCP spec says servers MUST validate that a token was issued for them as the intended audience. A version pin covers the SDK's own audience-blind check; this rule reads the code shape on any version.
How to fix
Set resource_server_url to the server's canonical URL, and check the token's aud or resource in verify_token, or use the SDK's resource validation.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-TOKENVERIFIER-AUD-001
Limitations
Python only. The settings arm reads an explicit resource_server_url=None in a file naming token_verifier. The verifier arm reads a method named verify_token on a class, leaving out stubs, in a file where no aud, audience, validate_token_resource, check_resource_allowed or resource_url appears anywhere, so a mention in another function counts as the check, and a helper in another file does not. A verifier for opaque tokens checked upstream, which have no audience of their own, is reported all the same. A source file over 512 KB is not read.
References
- OWASP MCP Top 10: MCP07:2025 (Insufficient Authentication & Authorization)
- OWASP Agentic Top 10: ASI03 (Identity and Privilege Abuse)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-AUTH-01 (Missing Authentication)
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-TOKENVERIFIER-AUD-001.md: the page then shows that text, with the registry reference appended under it.