From 7206f92f63b5e840941c8677e35cff7975a26d15 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 16 Sep 2026 10:38:24 +0200 Subject: [PATCH] fix: read the MCP URL policy when a URL is asked for, and drop the all-workspaces option Two review findings on the token drawer: The policy was read once per page load and cached for the browser session, so a superadmin turning the setting on left every open tab handing out `?token=` URLs the server now refuses. Both entry points now read it when the user actually asks for an MCP URL: when MCP mode is entered, and when the connect drawer opens. The workspace picker offered "All workspaces / Multi-workspace", but the gateway's consent screen binds the token it issues to the one workspace picked there, so OAuth has no multi-workspace grant to hand out. That entry is now token-only. Co-Authored-By: Claude Opus 5 --- .../components/home/HomeConnectDrawer.svelte | 6 +---- .../components/settings/CreateToken.svelte | 20 ++++---------- frontend/src/lib/mcpAuth.ts | 26 ++++++++++--------- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/frontend/src/lib/components/home/HomeConnectDrawer.svelte b/frontend/src/lib/components/home/HomeConnectDrawer.svelte index 529d66e2f3..09cc51dc7f 100644 --- a/frontend/src/lib/components/home/HomeConnectDrawer.svelte +++ b/frontend/src/lib/components/home/HomeConnectDrawer.svelte @@ -6,7 +6,6 @@ import { Bot, ExternalLink, Terminal } from 'lucide-svelte' import { shell } from 'svelte-highlight/languages' import { mcpTokenUrlDisabled } from '$lib/mcpAuth' - import { onMount } from 'svelte' type ConnectTab = 'cli' | 'mcp' @@ -22,15 +21,12 @@ wmill workspace add ${workspaceId} ${workspaceId} ${origin} wmill init wmill sync pull`) - onMount(async () => { - tokenUrlDisabled = await mcpTokenUrlDisabled() - }) - function noop() {} export function openDrawer(tab: ConnectTab = 'cli') { selectedTab = tab openVersion += 1 + void mcpTokenUrlDisabled().then((v) => (tokenUrlDisabled = v)) drawer?.openDrawer() } diff --git a/frontend/src/lib/components/settings/CreateToken.svelte b/frontend/src/lib/components/settings/CreateToken.svelte index e66782a619..f7f904dec9 100644 --- a/frontend/src/lib/components/settings/CreateToken.svelte +++ b/frontend/src/lib/components/settings/CreateToken.svelte @@ -1,5 +1,5 @@