Repository navigation
Description
Summary
authorization-code-grant never sends a wrong client_secret, so an authorization server that ignores the secret passes. I'd like to agree on the scope of a check inside that scenario before anyone writes code. This is the separate change mentioned in #578.
Requirement
- MCP 2025-11-25 and 2026-07-28, Authorization: "Authorization servers MUST implement OAuth 2.1 with appropriate security measures for both confidential and public clients."
- draft-ietf-oauth-v2-1-13 §3.2.2: the authorization server MUST "require client authentication for confidential clients" and "authenticate the client if client authentication is included".
- §3.2.4:
invalid_clientmeans "Client authentication failed". If the client used theAuthorizationheader, the server MUST respond with 401 and a matchingWWW-Authenticateheader.
Proposed check: client-secret-wrong
It applies to a run with a confidential client, using client_secret_basic or client_secret_post. The check sends a fresh authorization code, the correct code_verifier and redirect_uri, and a wrong secret.
| Response | Result |
|---|---|
| a token is issued | FAILURE |
invalid_client (401 with a matching WWW-Authenticate for client_secret_basic; 400 or 401 for client_secret_post) |
SUCCESS |
invalid_client for client_secret_basic, but without the 401 or a matching WWW-Authenticate |
FAILURE |
| refused, no token, another error | question 2 |
Why it needs a fresh code
I can't find a rule in the draft that client authentication comes before the code lookup. I compared a small server that checks the client first with a variant that looks up the code first, each with and without the secret check:
| Server | Made-up code | Fresh code |
|---|---|---|
| client checked first | invalid_client |
invalid_client |
| code checked first | invalid_grant |
invalid_client |
| either order, secret not checked | invalid_grant |
token issued |
With a made-up code, a conforming server can look the same as one that ignores the secret. So the check needs another login. It shouldn't reuse the code meant for the success path, because a server may void a code after a failed attempt. The comparison uses a Python server of mine, with client_secret_post only. It isn't a run of this harness or of a real SDK. In an earlier run, removing the secret check changed none of the current results. Because of #601, no secret was sent there. That record's wrong-secret probe uses a made-up code, so please use the fresh-code design above instead.
Depends on
#601 / #602. Until then, if the metadata also lists none, the harness sends no secret.
Questions
- Is another login acceptable here, or should this wait for the answer to question 2 in Authorization server: negative checks for the authorization code grant (PKCE, code reuse, client binding, redirect URI, state) #578?
- If the server refuses with another error, should that be a FAILURE or a WARNING? §3.2.4 defines
invalid_clientfor this case, but has no separate MUST for choosing it. - With no confidential client configured, should the result be SKIPPED (not applicable) or untestable (Standardize how scenarios report setup/execution failures #248)?
Disclosure: drafted with AI assistance (Claude). I ran the comparison myself and checked the quotes against the sources.
Activity