Skip to content

AAK-OAUTH-007: OAuth flow does not set the RFC 8707 resource parameter (Resource Indicators)

Severity
MEDIUM
Category
MCP Configuration (mcp-config)
Scanner
agent_audit_kit/scanners/oauth_misconfig.py
Auto-fixable
No.
SARIF name
OAuthMissingResourceIndicator

What it detects

An OAuth 2.1 authorization/token flow — or an MCP client/server config that advertises OAuth 2.1 — builds authorization and/or token requests without the RFC 8707 resource parameter. The ratified MCP 2025-11-25 authorization spec requires MCP clients to send resource on both the authorization request and the token request, identifying the MCP server by its canonical URI, so the authorization server audience-binds the issued token. Without Resource Indicators the token is not bound to a specific MCP server, so a token minted for one server can be replayed at another (token replay / audience confusion) — the confused-deputy class OAuth 2.1 §5.2 and the MCP spec's Access Token Privilege Restriction section forbid.

How to fix

Set the resource parameter to the MCP server's canonical URI so issued tokens are audience-bound (RFC 8707, on both the authorization and token requests); reject tokens whose audience is not this server (validate the audience per RFC 8707 §2 / RFC 9728 §7.4).

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

agent-audit-kit scan . --rules AAK-OAUTH-007

Limitations

Examines only files that contain a word starting with oauth, authorization_endpoint, token_endpoint or client_id (in any case; GOOGLE_CLIENT_ID does not count) or the call authorize(. In them it fires on a token request (grant_type=..., response_type=code, authorize(, authorization_endpoint, token_endpoint or an /authorize or /token path) in a file with no resource parameter. In a .json, .yaml, .yml or .toml file the request has to be data: a grant_type, authorization_endpoint or token_endpoint key, response_type: code, or a value that is wholly a URL or path ending in /authorize or /token, so a token path written inside a sentence there is not one. Any resource = ... assignment, "resource": key, ?resource= or &resource= parameter, resource_indicator(s) or the text RFC 8707 (any case, a comment included) counts as the RFC 8707 parameter, including an unrelated local variable named resource, and the same request in a file with none of those words is not reported.

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