From 8ccb60c711ada9abdb46e9afa24760bb899bdd89 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 28 Nov 2026 19:25:42 +0000 Subject: [PATCH] fix: read scope for listing mcp tools Also fixes the image viewer size after two changes crossed. Co-Authored-By: Claude Opus 5.5 --- backend/windmill-api-auth/src/scopes.rs | 5 +++++ frontend/src/lib/components/common/image/ImageViewer.svelte | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/windmill-api-auth/src/scopes.rs b/backend/windmill-api-auth/src/scopes.rs index 9247411bb2..beaa253780 100644 --- a/backend/windmill-api-auth/src/scopes.rs +++ b/backend/windmill-api-auth/src/scopes.rs @@ -251,6 +251,11 @@ fn map_http_method_to_action(method: &str, route_path: &str) -> ScopeAction { return ScopeAction::Run; } + // Lists a resource's tools; a POST only so that a navigation cannot reach it. + if method.eq_ignore_ascii_case("POST") && route_path.contains("/resources/mcp_tools/") { + return ScopeAction::Read; + } + match method.to_uppercase().as_str() { "GET" | "HEAD" | "OPTIONS" => ScopeAction::Read, "POST" | "PUT" | "PATCH" | "DELETE" => ScopeAction::Write, diff --git a/frontend/src/lib/components/common/image/ImageViewer.svelte b/frontend/src/lib/components/common/image/ImageViewer.svelte index 8c6595c0de..1fe157d04a 100644 --- a/frontend/src/lib/components/common/image/ImageViewer.svelte +++ b/frontend/src/lib/components/common/image/ImageViewer.svelte @@ -130,8 +130,8 @@ /** The displayed image as PNG bytes, drawn through a canvas. */ function rasterize(): Promise { const canvas = document.createElement('canvas') - canvas.width = natural?.w ?? imgEl!.naturalWidth - canvas.height = natural?.h ?? imgEl!.naturalHeight + canvas.width = view.natural?.w ?? imgEl!.naturalWidth + canvas.height = view.natural?.h ?? imgEl!.naturalHeight canvas.getContext('2d')!.drawImage(imgEl!, 0, 0, canvas.width, canvas.height) return new Promise((resolve, reject) => canvas.toBlob((b) => (b ? resolve(b) : reject(new Error('encoding failed'))), 'image/png')