diff --git a/cloud/apps/sandbox-control/src/mcp/consent.ts b/cloud/apps/sandbox-control/src/mcp/consent.ts index 32a744a4091..5456205068c 100644 --- a/cloud/apps/sandbox-control/src/mcp/consent.ts +++ b/cloud/apps/sandbox-control/src/mcp/consent.ts @@ -81,7 +81,7 @@ export function consentPage(view: ConsentView, csrf: string, formAction: string, const scopes = view.scopes .map( ({ scope, label }) => - `
  • ` + `
  • ` ) .join('') const body = diff --git a/cloud/apps/sandbox-control/src/mcp/oauth.ts b/cloud/apps/sandbox-control/src/mcp/oauth.ts index a9cbef3ab37..62af6710b6b 100644 --- a/cloud/apps/sandbox-control/src/mcp/oauth.ts +++ b/cloud/apps/sandbox-control/src/mcp/oauth.ts @@ -313,7 +313,7 @@ export async function authorize(request: Request, url: URL, env: OAuthEnv): Prom return consentPage(viewFor(req, client, fresh, 'That approval code or API key is not valid (it may have expired or been used). Get a new one from Orca.'), fresh, redirectTarget(req.redirectUri).formAction, 401) } // Only what was requested, what the user left ticked, and what the credential itself may do. - const ticked = new Set(form.getAll('scope')) + const ticked = new Set(form.getAll('grant')) const scopes = req.scopes.filter((scope) => ticked.has(scope) && grantor.scopes.has(scope)) if (scopes.length === 0) { return redirectWith(req.redirectUri, { error: 'invalid_scope', error_description: 'None of the requested scopes could be granted', state: req.state, iss: env.origin }) diff --git a/cloud/apps/sandbox-control/test/mcp.test.ts b/cloud/apps/sandbox-control/test/mcp.test.ts index 320f55a5506..b95d6034375 100644 --- a/cloud/apps/sandbox-control/test/mcp.test.ts +++ b/cloud/apps/sandbox-control/test/mcp.test.ts @@ -74,8 +74,8 @@ async function harness() { for (const [, name = '', value = ''] of html.matchAll(//g)) { form.set(name, value.replaceAll('&', '&').replaceAll('"', '"').replaceAll(''', "'").replaceAll('<', '<').replaceAll('>', '>')) } - for (const [, scope = ''] of html.matchAll(/name="scope" value="([^"]+)" checked/g)) { - if (!opts.untick?.includes(scope)) form.append('scope', scope) + for (const [, scope = ''] of html.matchAll(/name="grant" value="([^"]+)" checked/g)) { + if (!opts.untick?.includes(scope)) form.append('grant', scope) } if (opts.csrf !== undefined) { opts.csrf === null ? form.delete('csrf') : form.set('csrf', opts.csrf)