Repository navigation
Percent-encode client_secret_basic credentials (RFC 6749 §2.3.1) - #300
Merged
andreyvelich merged 2 commits intoOct 21, 2026
Merged
andreyvelich merged 2 commits into
andreyvelich merged 2 commits into
Conversation
RFC 6749 section 2.3.1 requires encoding the client_id and client_secret with application/x-www-form-urlencoded before forming the Basic auth header. Credentials containing ':', '@', '%', '+', or non-ASCII characters were previously included verbatim, which could produce a header that authorization servers decode to the wrong credentials.
Covers unreserved passthrough, reserved characters (: @ % + / =), a colon in the client ID not shifting the user/password boundary, and UTF-8 encoding of non-ASCII secrets.
varun06
force-pushed
the
client-secret-basic-encoding
branch
from
October 21, 2026 19:17
37c42f0 to
f2ca733
Compare
andreyvelich
merged commit Oct 21, 2026
85078bf
into
modelcontextprotocol:main
11 of 12 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
RFC 6749 §2.3.1 requires the client identifier and secret to be encoded with
application/x-www-form-urlencodedbefore being joined with:and Base64-encoded forHTTP Basic. They were used verbatim, so secrets containing
:,@,%,+, ornon-ASCII characters produced headers that authorization servers decode to the wrong
credentials (a
:in the client ID even moves the user/password split).Both values are now percent-encoded, leaving only RFC 3986 unreserved characters as-is.
How Has This Been Tested?
New
OAuthClientSecretBasicTestscovering unreserved passthrough, reserved characters,the
:boundary case, and UTF-8 secrets. The encoding tests fail without the fix.swift testpasses.Breaking Changes
Credentials made only of unreserved characters are unchanged. Credentials with reserved
characters now produce the spec-compliant header.
Types of changes