Skip to content

Authorization server: check that a wrong client_secret is refused #611

Backlog

Description

@Tetsurohhori

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_client means "Client authentication failed". If the client used the Authorization header, the server MUST respond with 401 and a matching WWW-Authenticate header.

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

  1. 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?
  2. If the server refuses with another error, should that be a FAILURE or a WARNING? §3.2.4 defines invalid_client for this case, but has no separate MUST for choosing it.
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions