gogcli-mcp 2.21.1 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/dist/index.js +119 -8
- package/dist/lib.js +119 -8
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/auth-log.ts +59 -1
- package/src/connector-auth.ts +265 -8
- package/src/connector-runtime.ts +186 -1
- package/src/google-probe.ts +113 -0
- package/src/timestamps.ts +7 -0
- package/src/tools/auth.ts +8 -2
- package/src/worker.ts +25 -6
- package/tests/auth-log.test.ts +24 -2
- package/tests/connector-auth.test.ts +539 -8
- package/tests/connector-runtime.test.ts +447 -1
- package/tests/google-probe.test.ts +116 -0
- package/tests/timestamps.test.ts +52 -0
- package/tests/tools/auth.test.ts +28 -0
- package/tests/worker.test.ts +33 -8
package/tests/worker.test.ts
CHANGED
|
@@ -80,16 +80,41 @@ describe('gogcli Cloudflare connector — OAuth surface', () => {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
it('GET /authorize renders the gogcli login page with the connector-key field', async () => {
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
// 0.8.x
|
|
87
|
-
//
|
|
88
|
-
// `redirect_uri`
|
|
89
|
-
//
|
|
83
|
+
// `/authorize` is only reachable for a REGISTERED client, so the request has
|
|
84
|
+
// to be preceded by a real dynamic client registration.
|
|
85
|
+
//
|
|
86
|
+
// It did not always: workers-oauth-provider 0.8.x parsed the request without
|
|
87
|
+
// a `client_id` (it only called validateRedirectUriScheme unconditionally,
|
|
88
|
+
// which is why `redirect_uri` was already here). 0.10.x moved the
|
|
89
|
+
// `client_id is required` check and the client lookup ahead of everything
|
|
90
|
+
// else in parseAuthRequest, so the old URL now throws before the login page
|
|
91
|
+
// is ever rendered — an AuthorizationError from inside the library, not from
|
|
92
|
+
// any code in this repo. Registering first is the fix, and it exercises the
|
|
93
|
+
// path a real client actually takes.
|
|
94
|
+
const redirectUri = 'https://example.com/callback';
|
|
95
|
+
const registration = await SELF.fetch('https://example.com/register', {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers: { 'content-type': 'application/json' },
|
|
98
|
+
body: JSON.stringify({
|
|
99
|
+
client_name: 'worker test client',
|
|
100
|
+
redirect_uris: [redirectUri],
|
|
101
|
+
token_endpoint_auth_method: 'none',
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
expect(registration.status).toBe(201);
|
|
105
|
+
const { client_id: clientId } = (await registration.json()) as { client_id: string };
|
|
106
|
+
expect(clientId).toBeTruthy();
|
|
107
|
+
|
|
108
|
+
// PKCE is mandatory for a public client (`token_endpoint_auth_method: none`)
|
|
109
|
+
// on the authorization-code flow, and the provider enforces it during the
|
|
110
|
+
// same parse. The challenge is never redeemed here — this test stops at the
|
|
111
|
+
// rendered page — so any well-formed S256 value will do.
|
|
112
|
+
const codeChallenge = 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM';
|
|
90
113
|
const res = await SELF.fetch(
|
|
91
114
|
'https://example.com/authorize?response_type=code&state=abc' +
|
|
92
|
-
`&
|
|
115
|
+
`&client_id=${encodeURIComponent(clientId)}` +
|
|
116
|
+
`&redirect_uri=${encodeURIComponent(redirectUri)}` +
|
|
117
|
+
`&code_challenge=${codeChallenge}&code_challenge_method=S256`,
|
|
93
118
|
);
|
|
94
119
|
expect(res.status).toBe(200);
|
|
95
120
|
expect(res.headers.get('content-type')).toContain('text/html');
|