Skip to content

Commit 53f5064

Browse files
committed
Ask Gemini to fix missing URL-decoding of basic auth credentials.
Fixes #41 Prompt: We received a bug report: "As per https://www.rfc-editor.org/rfc/rfc6749.html#section-2.3.1 and https://www.rfc-editor.org/rfc/rfc6749.html#appendix-B, OAuth uses a modified form of Basic auth in which the client id and secret are url-encoded first before being combined and then base64-encoded." Apparently, we aren't performing this URL encoding. Can you fix it? Gemini actually fixed the second part of the issue, too: that the secret can technically contain colons. I didn't actually prompt it to fix that, it just did it. Neat. (Note that valid client IDs and secrets are always generated by this library itself, and it does not include colons nor characters needing URL encoding, so this issue is never a problem in practice, but we should be implementing what the spec says.) This was a test using Gemini 2.5-Pro under Windsurf. (I am trying out various models and environments...)
1 parent a6e3e06 commit 53f5064

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/oauth-provider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,9 +1118,9 @@ class OAuthProviderImpl {
11181118
if (authHeader && authHeader.startsWith('Basic ')) {
11191119
// Basic auth
11201120
const credentials = atob(authHeader.substring(6));
1121-
const [id, secret] = credentials.split(':');
1122-
clientId = id;
1123-
clientSecret = secret || '';
1121+
const [id, secret] = credentials.split(':', 2);
1122+
clientId = decodeURIComponent(id);
1123+
clientSecret = decodeURIComponent(secret || '');
11241124
} else {
11251125
// Form parameters
11261126
clientId = body.client_id;

0 commit comments

Comments
 (0)