From 37b1ea23f93dcf052351b7cdb2fb52ace5bf6469 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 30 Oct 2026 18:17:35 +0100 Subject: [PATCH 01/19] fix: keep secret values out of stored step inputs from flow_env (#12130) * fix: keep secret values out of stored step inputs reached through flow_env Co-Authored-By: Claude Opus 5.5 * fix: pass secret flow_env entries to subflow steps as references Co-Authored-By: Claude Opus 5.5 * test: cover a subflow input computed from a secret flow_env entry Co-Authored-By: Claude Opus 5.5 * fix: detect a secret flow_env read only through a flow_env access Co-Authored-By: Claude Opus 5.5 * fix: pass a subflow input computed from a secret flow_env entry encrypted Co-Authored-By: Claude Opus 5.5 * perf: load flow_env secrets only for an input that reads flow_env Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- ...fc2fe29682ec0673bf29d8ee21a313bef6bd6.json | 23 +++ .../tests/flow_env_secret_refs.rs | 104 ++++++++++ backend/windmill-worker/src/common.rs | 8 +- backend/windmill-worker/src/worker_flow.rs | 192 ++++++++++++++++++ 4 files changed, 324 insertions(+), 3 deletions(-) create mode 100644 backend/.sqlx/query-4985970f9ea9e0e7644e9fe3f81fc2fe29682ec0673bf29d8ee21a313bef6bd6.json create mode 100644 backend/windmill-api-integration-tests/tests/flow_env_secret_refs.rs diff --git a/backend/.sqlx/query-4985970f9ea9e0e7644e9fe3f81fc2fe29682ec0673bf29d8ee21a313bef6bd6.json b/backend/.sqlx/query-4985970f9ea9e0e7644e9fe3f81fc2fe29682ec0673bf29d8ee21a313bef6bd6.json new file mode 100644 index 0000000000..0449c10bf4 --- /dev/null +++ b/backend/.sqlx/query-4985970f9ea9e0e7644e9fe3f81fc2fe29682ec0673bf29d8ee21a313bef6bd6.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT path FROM variable WHERE workspace_id = $1 AND path = ANY($2) AND is_secret", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "path", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text", + "TextArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "4985970f9ea9e0e7644e9fe3f81fc2fe29682ec0673bf29d8ee21a313bef6bd6" +} diff --git a/backend/windmill-api-integration-tests/tests/flow_env_secret_refs.rs b/backend/windmill-api-integration-tests/tests/flow_env_secret_refs.rs new file mode 100644 index 0000000000..0cefff6342 --- /dev/null +++ b/backend/windmill-api-integration-tests/tests/flow_env_secret_refs.rs @@ -0,0 +1,104 @@ +//! A secret reached through `flow_env` is stored on the step job as a reference (exact +//! `flow_env.X` read) or encrypted (computed from it), and still resolves when the step runs. +//! A subflow step, which resolves nothing in its args, gets a secret entry as a reference or +//! encrypted, and the resolved value of a non-secret one. +//! +//! cargo test -p windmill-api-integration-tests --features deno_core --test flow_env_secret_refs +#![cfg(feature = "deno_core")] + +use serde_json::json; +use sqlx::{Pool, Postgres}; +use windmill_common::{flows::FlowValue, jobs::JobPayload}; +use windmill_test_utils::*; + +async fn api_create(port: u16, kind: &str, body: serde_json::Value) { + let resp = reqwest::Client::new() + .post(format!( + "http://localhost:{port}/api/w/test-workspace/{kind}/create" + )) + .header("Authorization", "Bearer SECRET_TOKEN") + .json(&body) + .send() + .await + .unwrap(); + assert_eq!( + resp.status(), + 201, + "{}", + resp.text().await.unwrap_or_default() + ); +} + +#[sqlx::test(migrations = "../migrations", fixtures("base"))] +async fn test_flow_env_secret_kept_out_of_step_args(db: Pool) -> anyhow::Result<()> { + initialize_tracing().await; + let server = ApiServer::start(db.clone()).await?; + let port = server.addr.port(); + let secret = "flow_env_secret_value_8k2q"; + for (path, value, is_secret) in [ + ("u/test-user/tok", secret, true), + ("u/test-user/host", "example.com", false), + ] { + let body = json!({"path": path, "value": value, "is_secret": is_secret, "description": ""}); + api_create(port, "variables", body).await; + } + // A flow without steps returns its own inputs. + let sub = json!({"path": "u/test-user/sub", "summary": "", "description": "", + "schema": {"type": "object", "properties": {}}, "value": {"modules": []}}); + api_create(port, "flows", sub).await; + + let flow: FlowValue = serde_json::from_value(json!({ + "flow_env": {"TOKEN": "$var:u/test-user/tok", "HOST": "$var:u/test-user/host"}, + "modules": [ + {"id": "a", "value": { + "type": "rawscript", + "language": "bash", + "content": "tok=\"$1\"\nhdr=\"$2\"\nurl=\"$3\"\necho \"{\\\"tok\\\":\\\"$tok\\\",\\\"hdr\\\":\\\"$hdr\\\",\\\"url\\\":\\\"$url\\\"}\" > result.json", + "input_transforms": { + "tok": {"type": "javascript", "expr": "flow_env.TOKEN"}, + "hdr": {"type": "javascript", "expr": "\"Bearer \" + flow_env.TOKEN"}, + "url": {"type": "javascript", "expr": "\"https://\" + flow_env.HOST"} + } + }}, + {"id": "s", "value": { + "type": "flow", + "path": "u/test-user/sub", + "input_transforms": { + "tok": {"type": "javascript", "expr": "flow_env.TOKEN"}, + "hdr": {"type": "javascript", "expr": "\"Bearer \" + flow_env.TOKEN"}, + "host": {"type": "javascript", "expr": "flow_env.HOST"} + } + }} + ] + }))?; + + let flow_job = + RunJob::from(JobPayload::RawFlow { value: flow, path: None, restarted_from: None }) + .run_until_complete(&db, false, port) + .await; + let sub_args = flow_job.json_result().unwrap(); + assert_eq!(sub_args["tok"], "$var:u/test-user/tok"); + assert!(sub_args["hdr"].as_str().unwrap().starts_with("$encrypted:")); + assert_eq!(sub_args["host"], "example.com"); + + let (step_args, step_result): (serde_json::Value, serde_json::Value) = sqlx::query_as( + "SELECT j.args, c.result FROM v2_job j JOIN v2_job_completed c ON c.id = j.id + WHERE j.parent_job = $1 AND j.kind <> 'flow'", + ) + .bind(flow_job.id) + .fetch_one(&db) + .await?; + assert_eq!( + step_result, + json!({"tok": secret, "hdr": format!("Bearer {secret}"), "url": "https://example.com"}) + ); + assert_eq!(step_args["tok"], "$var:u/test-user/tok"); + assert!(step_args["hdr"] + .as_str() + .unwrap() + .starts_with("$encrypted:")); + assert_eq!(step_args["url"], "https://example.com"); + assert!(!step_args.to_string().contains(secret)); + + Ok(()) +} diff --git a/backend/windmill-worker/src/common.rs b/backend/windmill-worker/src/common.rs index c0ae372e38..f0697283aa 100644 --- a/backend/windmill-worker/src/common.rs +++ b/backend/windmill-worker/src/common.rs @@ -369,9 +369,11 @@ pub async fn transform_json_value( }) }) } - Connection::Http(_) => { - Err(Error::NotFound("Http connection not supported".to_string())) - } + Connection::Http(_) => Err(Error::ExecutionErr(format!( + "`{name}` is an `$encrypted:` value, which an agent worker cannot decrypt: \ + pass the secret as a `$var:` reference (in a flow, a static input or an \ + exact `flow_env.` read) and build the value inside the script" + ))), } // let path = y.strip_prefix("$res:").unwrap(); diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index ff2a9db436..23f8fb69e9 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -18,6 +18,7 @@ use crate::{ JobCompletedSender, PreviousResult, SameWorkerSender, SendResultPayload, StepFailureKind, UpdateFlow, KEEP_JOB_DIR, }; +use windmill_common::variables::{build_crypt_with_key_suffix, encrypt, WorkspaceCrypt}; use anyhow::Context; use async_once_cell::Lazy; @@ -2888,11 +2889,132 @@ where } } +/// The unresolved `flow_env` and its secret entries, so that the args stored on a step job +/// never hold a resolved secret: an exact `flow_env.X` read stores the entry's reference, +/// resolved (audited and masked) when the step runs like a static input, and any other +/// expression reading a secret entry stores its result encrypted. +/// +/// A subflow step resolves nothing in its args, so it gets the resolved value of a +/// non-secret entry, while a secret one reaches it as a reference or encrypted, which its own +/// steps resolve or decrypt (they share its root job id). +pub(crate) struct FlowEnvRefs<'a> { + raw: &'a HashMap>, + db: &'a DB, + workspace_id: String, + root_job_id: Uuid, + // Loaded by the first input whose expression mentions `flow_env`, so that the steps + // reading none of it cost no query. + secrets: tokio::sync::OnceCell, +} + +struct FlowEnvSecrets { + entries: HashMap>, + // Keyed on the root job id, which is what the step's worker decrypts `$encrypted:` + // args with. Present only when `entries` is non-empty. + crypt: Option, +} + +impl<'a> FlowEnvRefs<'a> { + fn new(db: &'a DB, flow_job: &MiniPulledJob, raw: &'a HashMap>) -> Self { + Self { + raw, + db, + workspace_id: flow_job.workspace_id.clone(), + root_job_id: get_root_job_id(flow_job), + secrets: tokio::sync::OnceCell::new(), + } + } + + async fn secrets(&self) -> error::Result<&FlowEnvSecrets> { + self.secrets.get_or_try_init(|| self.load_secrets()).await + } + + async fn load_secrets(&self) -> error::Result { + let raw = self.raw; + let mut secret_keys = vec![]; + let mut var_keys: Vec<(String, String)> = vec![]; + for (k, v) in raw { + if !v.get().starts_with("\"$") { + continue; + } + let Ok(s) = serde_json::from_str::(v.get()) else { + continue; + }; + if s.starts_with("$encrypted:") { + secret_keys.push(k.clone()); + } else if let Some(path) = s + .strip_prefix("$var:") + .or_else(|| s.strip_prefix("$jsonvar:")) + { + var_keys.push((k.clone(), path.to_string())); + } + } + if !var_keys.is_empty() { + let paths: Vec = var_keys.iter().map(|(_, p)| p.clone()).collect(); + let secret_paths = sqlx::query_scalar!( + "SELECT path FROM variable WHERE workspace_id = $1 AND path = ANY($2) AND is_secret", + &self.workspace_id, + &paths + ) + .fetch_all(self.db) + .await?; + secret_keys.extend( + var_keys + .into_iter() + .filter(|(_, p)| secret_paths.contains(p)) + .map(|(k, _)| k), + ); + } + let entries: HashMap> = secret_keys + .into_iter() + .map(|k| (k.clone(), raw[&k].clone())) + .collect(); + let crypt = if entries.is_empty() { + None + } else { + Some( + build_crypt_with_key_suffix( + self.db, + &self.workspace_id, + &self.root_job_id.to_string(), + ) + .await?, + ) + }; + Ok(FlowEnvSecrets { entries, crypt }) + } +} + +impl FlowEnvSecrets { + // Decided from the expression's text, by a literal `flow_env.KEY` / `flow_env["KEY"]` + // access: a dynamic key (`flow_env[k]`) or a destructured `flow_env` is not detected. + fn reads_secret(&self, expr: &str) -> bool { + let ident = |c: char| c.is_alphanumeric() || c == '_' || c == '$'; + self.entries.keys().any(|k| { + let dotted = [format!("flow_env.{k}"), format!("flow_env?.{k}")]; + let bracketed = ["\"", "'", "`"].map(|q| format!("[{q}{k}{q}]")); + dotted.iter().any(|p| { + expr.match_indices(p.as_str()).any(|(i, _)| { + !expr[..i].chars().next_back().is_some_and(ident) + && !expr[i + p.len()..].chars().next().is_some_and(ident) + }) + }) || bracketed.iter().any(|b| { + ["flow_env", "flow_env?."].iter().any(|o| { + expr.match_indices(&format!("{o}{b}")) + .any(|(i, _)| !expr[..i].chars().next_back().is_some_and(ident)) + }) + }) + }) + } +} + /// resumes should be in order of timestamp ascending, so that more recent are at the end #[instrument(level = "trace", skip_all)] async fn transform_input( flow_args: Marc>>, flow_env: Option<&HashMap>>, + env_refs: Option<&FlowEnvRefs<'_>>, + into_subflow: bool, last_result: Arc>, input_transforms: &HashMap, resumes: Arc>, @@ -2930,6 +3052,22 @@ async fn transform_input( mapped.insert(key.to_string(), to_raw_value(&value)); } InputTransform::Javascript { expr } => { + let env_refs = env_refs.filter(|_| expr.contains("flow_env")); + if let Some(r) = env_refs { + let exact_env = if into_subflow { + &r.secrets().await?.entries + } else { + r.raw + }; + if let Some(raw) = windmill_jseval::try_exact_property_access( + expr.trim(), + None, + Some(exact_env), + ) { + mapped.insert(key.to_string(), raw); + continue; + } + } let v = eval_timeout( expr.to_string(), env.clone(), @@ -2945,6 +3083,16 @@ async fn transform_input( "Error during isolated evaluation of expression `{expr}`:\n{e:#}" )) })?; + let secrets = match env_refs { + Some(r) => Some(r.secrets().await?), + None => None, + }; + let v = match secrets { + Some(s @ FlowEnvSecrets { crypt: Some(crypt), .. }) if s.reads_secret(expr) => { + to_raw_value(&format!("$encrypted:{}", encrypt(crypt, v.get()))) + } + _ => v, + }; mapped.insert(key.to_string(), v); } InputTransform::Ai => (), @@ -3043,6 +3191,8 @@ pub async fn handle_flow( } } + let env_refs = env_source.map(|raw| FlowEnvRefs::new(db, &flow_job, raw)); + let schedule_path = flow_job.schedule_path(); if !flow_job.is_flow_step() && status.retry.fail_count == 0 @@ -3186,6 +3336,7 @@ pub async fn handle_flow( status, flow, flow_env, + env_refs.as_ref(), no_flow_env, db, client, @@ -3475,6 +3626,7 @@ async fn push_next_flow_job( mut status: FlowStatus, flow: &FlowValue, flow_env: Option<&HashMap>>, + env_refs: Option<&FlowEnvRefs<'_>>, // Neither this flow nor any ancestor defines `flow_env`. no_flow_env: bool, db: &sqlx::Pool, @@ -4296,6 +4448,8 @@ async fn push_next_flow_job( transform_input( arc_flow_job_args.clone(), flow_env, + env_refs, + module.is_flow(), arc_last_job_result.clone(), input_transforms, resumes.clone(), @@ -4539,6 +4693,9 @@ async fn push_next_flow_job( let ti = transform_input( args, flow_env, + env_refs, + // A `flow` module is never a simple loop body. + false, arc_last_job_result.clone(), input_transforms, resumes.clone(), @@ -4594,6 +4751,8 @@ async fn push_next_flow_job( let ti = transform_input( Marc::new(hm), flow_env, + env_refs, + false, arc_last_job_result.clone(), input_transforms, resumes.clone(), @@ -6713,7 +6872,40 @@ pub async fn get_previous_job_result( mod tests { use super::{ effective_flow_step_timeout, extract_chat_message_from_flow_result, is_simple_modules, + FlowEnvSecrets, }; + + // An input computed from a secret is stored encrypted, which an agent worker cannot + // decrypt, so a key that merely shares a secret entry's name must not count as reading it. + #[test] + fn reads_secret_only_through_a_flow_env_access() { + let refs = FlowEnvSecrets { + entries: [( + "token".to_string(), + to_raw_value(&json!("$var:u/x/t")).unwrap(), + )] + .into(), + crypt: None, + }; + for expr in [ + "flow_env.token", + "\"Bearer \" + flow_env.token", + "`${flow_env?.token}`", + "flow_env[\"token\"] + 'x'", + "flow_env['token']", + ] { + assert!(refs.reads_secret(expr), "{expr}"); + } + for expr in [ + "flow_env.BASE + results.login.token", + "flow_env.tokens", + "flow_input.token", + "my_flow_env.token", + "flow_env[\"tokens\"]", + ] { + assert!(!refs.reads_secret(expr), "{expr}"); + } + } use serde_json::{json, value::to_raw_value}; use windmill_common::flows::FlowModule; From 068f95907f264208d711c1049e2459fc59b7907b Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 30 Oct 2026 18:17:57 +0100 Subject: [PATCH 02/19] fix: report a failed flow unless its failure module succeeded (#12127) * [ee] fix: send a flow whose failure module failed to the workspace error handler Co-Authored-By: Claude Opus 5.5 * [ee] fix: report a flow whose failure module status cannot be read Co-Authored-By: Claude Opus 5.5 * [ee] fix: report a failed flow unless its failure module succeeded Co-Authored-By: Claude Opus 5.5 * chore: update ee-repo-ref to 222df41fce30afc4c3fdd9560cb71b077fdd49ff This commit updates the EE repository reference after PR #937 was merged in windmill-ee-private. Previous ee-repo-ref: b26245c7835606001f23ae7f90da4df07e3fda85 New ee-repo-ref: 222df41fce30afc4c3fdd9560cb71b077fdd49ff Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: windmill-internal-app[bot] --- ...b834d412ea7806eb9bc217c7c3cd98b828b5e.json | 22 +++++++++++++++++++ backend/ee-repo-ref.txt | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 backend/.sqlx/query-9926d9e05560e41aae3a1a8036db834d412ea7806eb9bc217c7c3cd98b828b5e.json diff --git a/backend/.sqlx/query-9926d9e05560e41aae3a1a8036db834d412ea7806eb9bc217c7c3cd98b828b5e.json b/backend/.sqlx/query-9926d9e05560e41aae3a1a8036db834d412ea7806eb9bc217c7c3cd98b828b5e.json new file mode 100644 index 0000000000..89b46c6361 --- /dev/null +++ b/backend/.sqlx/query-9926d9e05560e41aae3a1a8036db834d412ea7806eb9bc217c7c3cd98b828b5e.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT flow_status->'failure_module'->>'type' FROM v2_job_completed WHERE id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "?column?", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + null + ] + }, + "hash": "9926d9e05560e41aae3a1a8036db834d412ea7806eb9bc217c7c3cd98b828b5e" +} diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 17bdde30cb..2ccd51782f 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -26663361632280a25b964e6f3944e503dca2a366 +222df41fce30afc4c3fdd9560cb71b077fdd49ff From 0f699d834ea395f7b72c897699c2aa6b7c2a629d Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 30 Oct 2026 18:18:17 +0100 Subject: [PATCH 03/19] test: guard overlapping and multi-byte secret masking (#12121) * test: cover secret masking rules in sensitive_log_masks Co-Authored-By: Claude Opus 5.5 * test: pin the 20-char format boundary and tighten unregister assertions Co-Authored-By: Claude Opus 5.5 * test: keep only the overlapping and multi-byte masking guard Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- .../windmill-common/src/sensitive_log_masks.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backend/windmill-common/src/sensitive_log_masks.rs b/backend/windmill-common/src/sensitive_log_masks.rs index f01ca2427e..d9a10e764a 100644 --- a/backend/windmill-common/src/sensitive_log_masks.rs +++ b/backend/windmill-common/src/sensitive_log_masks.rs @@ -341,4 +341,22 @@ mod tests { unregister_running_job(job_id); } + + /// A secret containing another must be masked whole (`LeftmostLongest`), or its + /// tail leaks; the kept prefix/suffix must be cut by char, or multi-byte secrets panic. + #[test] + fn overlapping_and_multibyte_secrets_are_masked_whole() { + let job_id = Uuid::new_v4(); + register_running_job(job_id); + register_secret_for_job(job_id, "password"); + register_secret_for_job(job_id, "password-and-more"); + register_secret_for_job(job_id, "πŸ”‘Γ©Γ ΓΌ-secret-value-Γ±β‚¬πŸ˜€"); + + let masked = snapshot(&job_id) + .expect("secrets registered") + .mask("password-and-more πŸ”‘Γ©Γ ΓΌ-secret-value-Γ±β‚¬πŸ˜€"); + assert_eq!(masked, format!("p*****e πŸ”‘Γ©Γ *****Γ±β‚¬πŸ˜€\n{MASKED_NOTICE}")); + + unregister_running_job(job_id); + } } From df70cd14c527117847916bee7f2bdab64542f756 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 30 Oct 2026 18:27:43 +0100 Subject: [PATCH 04/19] fix: list hand-edited session items in the session changes bar (#12131) * fix: list hand-edited session items in the session changes bar * fix: keep hand-edit mask entries consistent across tabs of one session * refactor: keep session hand edits in their own store, not the chat record * fix: store each session hand edit under its own key --- .../sessions/SessionChangesBar.svelte | 30 ++++- .../sessions/SessionEditorTarget.svelte | 5 +- .../sessions/sessionHandEdits.svelte.ts | 108 ++++++++++++++++++ .../sessions/sessionHandEdits.test.ts | 27 +++++ .../sessions/sessionState.svelte.ts | 3 + .../sessions/useUserDraftSync.svelte.ts | 3 + 6 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 frontend/src/lib/components/sessions/sessionHandEdits.svelte.ts create mode 100644 frontend/src/lib/components/sessions/sessionHandEdits.test.ts diff --git a/frontend/src/lib/components/sessions/SessionChangesBar.svelte b/frontend/src/lib/components/sessions/SessionChangesBar.svelte index 53e2dedb71..42ff500e13 100644 --- a/frontend/src/lib/components/sessions/SessionChangesBar.svelte +++ b/frontend/src/lib/components/sessions/SessionChangesBar.svelte @@ -26,6 +26,9 @@ import SessionDiffDrawer from './SessionDiffDrawer.svelte' import { TOKEN_TRIGGER_CLASS } from './SessionStatusToken.svelte' import { useWorkspaceDrafts } from '$lib/workspaceDrafts.svelte' + import { UserDraftDbSyncer } from '$lib/userDraftDbSyncer.svelte' + import { maskKey } from './modifiedItemsMask' + import { removeHandEdit, renameHandEdit, sessionHandEdits } from './sessionHandEdits.svelte' import { badgeCounts, badgeOf, buildDeployItems, type DeployItem } from './sessionDeployModel' import { useExistingMaskKeys } from './sessionDeployModel.svelte' import { previewTargetForDeployKind } from './sessionPreviewTabs.svelte' @@ -87,7 +90,13 @@ // The chat's modified-items mask (`${UserDraftItemKind}:${storagePath}`). // undefined = legacy/untracked chat β†’ fall back to showing every draft. // A Set (even empty) β†’ filter to just this chat's items. - const mask = $derived(runtime?.manager.modifiedItems) + // Plus the items the user edited by hand in the session's tabs, which are as much its + // changes as the chat's are. + const mask = $derived.by(() => { + const chatMask = runtime?.manager.modifiedItems + if (!chatMask) return undefined + return new Set([...chatMask, ...sessionHandEdits(session.id)]) + }) // Workspace Drafts (fetches on mount and on every Server-Draft invalidation); // scoped to the chat's mask inside the deploy model below. @@ -139,6 +148,18 @@ } }) + // A hand edit in a session tab creates its draft outside any turn, so the turn-end refresh + // above never sees it: re-read the list once a masked item's first draft lands. + $effect(() => { + if (!committedId) return + const ws = committedId + return UserDraftDbSyncer.onAnySaved((e) => { + if (e.workspace !== ws || !mask?.has(maskKey(e.itemKind, e.path))) return + if (drafts.items.some((d) => d.kind === e.itemKind && d.path === e.path)) return + drafts.refresh() + }) + }) + let diffDrawer: SessionDiffDrawer | undefined = $state(undefined) // Opening the drawer re-fetches its own data, so it can show fresher state @@ -426,10 +447,13 @@ keys={mask} agentPaths={agentPaths.current} onDataChanged={refreshDock} - onItemDeployed={(item) => - void runtime?.manager.renameModifiedItem(item.draftKind, item.path, item.displayPath)} + onItemDeployed={(item) => { + void runtime?.manager.renameModifiedItem(item.draftKind, item.path, item.displayPath) + renameHandEdit(session.id, item.draftKind, item.path, item.displayPath) + }} onItemDiscarded={(item) => { void runtime?.manager.removeModifiedItem(item.draftKind, item.path) + removeHandEdit(session.id, item.draftKind, item.path) const folder = pipelineFolderFromBundlePath(item.path) if (item.draftKind === PIPELINE_DRAFT_KIND && folder) void runtime?.forgetPipelineDrafts(folder) diff --git a/frontend/src/lib/components/sessions/SessionEditorTarget.svelte b/frontend/src/lib/components/sessions/SessionEditorTarget.svelte index 49e0c433d4..671932d991 100644 --- a/frontend/src/lib/components/sessions/SessionEditorTarget.svelte +++ b/frontend/src/lib/components/sessions/SessionEditorTarget.svelte @@ -5,6 +5,7 @@ import { UserDraft } from '$lib/userDraft.svelte' import type { SessionRuntime, SessionTargetKind } from './sessionRuntime.svelte' import { useUserDraftSync, type DraftSyncCodec } from './useUserDraftSync.svelte' + import { recordHandEdit } from './sessionHandEdits.svelte' import { makeFlowCodec, makeScriptCodec, makeRawAppCodec } from './sessionDraftCodecs' import { itemDisplayName } from './previewRouter' import SessionItemNotFound from './SessionItemNotFound.svelte' @@ -136,7 +137,9 @@ path: () => path, workspace: () => workspaceId, ready: () => slot.loadedPath === path, - codec: () => codec + codec: () => codec, + // A hand edit is the session's change as much as a chat edit is, so its changes bar lists it. + onSaved: (itemKind, p) => recordHandEdit(runtime.sessionId, itemKind, p) }) // Stamp the tab's friendly label once this editor's cell knows how to name the diff --git a/frontend/src/lib/components/sessions/sessionHandEdits.svelte.ts b/frontend/src/lib/components/sessions/sessionHandEdits.svelte.ts new file mode 100644 index 0000000000..89d02c6d12 --- /dev/null +++ b/frontend/src/lib/components/sessions/sessionHandEdits.svelte.ts @@ -0,0 +1,108 @@ +import { BROWSER } from 'esm-env' +import { createSubscriber } from 'svelte/reactivity' +import type { UserDraftItemKind } from '$lib/gen' +import { scopedKey } from '$lib/userScopedStorage' +import { maskKey } from './modifiedItemsMask' + +// Items the user edited by hand in a session's editor tabs, as mask keys +// (`${UserDraftItemKind}:${storagePath}`). Kept out of the chat record: turns and +// other tabs rewrite that record whole, so an entry written there outside a turn +// is lost to the next writer. For the same reason each entry is a localStorage key +// of its own: adding or removing one is a single setItem/removeItem, which no +// other tab's write can undo, as a read-modify-write of a shared list could. + +const KEY_BASE = 'windmill-session-hand-edit' + +function sessionPrefix(sessionId: string): string | undefined { + const base = scopedKey(KEY_BASE) + return base ? `${base}:${sessionId}:` : undefined +} + +function storedKeys(prefix: string): string[] { + const keys: string[] = [] + for (let i = 0; i < localStorage.length; i++) { + const k = localStorage.key(i) + if (k?.startsWith(prefix)) keys.push(k) + } + return keys +} + +const localWriters = new Set<() => void>() + +// Local writes and other tabs' writes (the `storage` event) both re-run readers. +const subscribe = createSubscriber((update) => { + const onStorage = (e: StorageEvent) => { + if (e.key === null || e.key.startsWith(KEY_BASE)) update() + } + window.addEventListener('storage', onStorage) + localWriters.add(update) + return () => { + window.removeEventListener('storage', onStorage) + localWriters.delete(update) + } +}) + +function write(sessionId: string, change: (prefix: string) => void): void { + const prefix = sessionPrefix(sessionId) + if (!BROWSER || !prefix) return + try { + change(prefix) + } catch (e) { + console.error('Could not store the session hand edits', e) + } + for (const update of localWriters) update() +} + +/** The session's hand-edited items. Reactive. */ +export function sessionHandEdits(sessionId: string): ReadonlySet { + const prefix = sessionPrefix(sessionId) + if (!BROWSER || !prefix) return new Set() + subscribe() + try { + return new Set(storedKeys(prefix).map((k) => k.slice(prefix.length))) + } catch { + return new Set() + } +} + +export function recordHandEdit( + sessionId: string, + itemKind: UserDraftItemKind, + storagePath: string +): void { + const prefix = sessionPrefix(sessionId) + const k = prefix && prefix + maskKey(itemKind, storagePath) + if (!BROWSER || !k || localStorage.getItem(k) !== null) return + write(sessionId, () => localStorage.setItem(k, '1')) +} + +/** For a discarded item, which would otherwise keep reading as this session's "Deployed" edit. */ +export function removeHandEdit( + sessionId: string, + itemKind: UserDraftItemKind, + storagePath: string +): void { + write(sessionId, (prefix) => localStorage.removeItem(prefix + maskKey(itemKind, storagePath))) +} + +/** For a draft-only item that deployed from its `draft_{uuid}` storage path to its chosen one. */ +export function renameHandEdit( + sessionId: string, + itemKind: UserDraftItemKind, + fromPath: string, + toPath: string +): void { + if (fromPath === toPath) return + write(sessionId, (prefix) => { + const from = prefix + maskKey(itemKind, fromPath) + if (localStorage.getItem(from) === null) return + localStorage.setItem(prefix + maskKey(itemKind, toPath), '1') + localStorage.removeItem(from) + }) +} + +export function deleteSessionHandEdits(sessionId: string): void { + write(sessionId, (prefix) => { + for (const k of storedKeys(prefix)) localStorage.removeItem(k) + }) +} diff --git a/frontend/src/lib/components/sessions/sessionHandEdits.test.ts b/frontend/src/lib/components/sessions/sessionHandEdits.test.ts new file mode 100644 index 0000000000..de70b2210d --- /dev/null +++ b/frontend/src/lib/components/sessions/sessionHandEdits.test.ts @@ -0,0 +1,27 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +vi.mock('esm-env', async (importOriginal) => ({ + ...(await importOriginal()), + BROWSER: true +})) +vi.mock('$lib/userScopedStorage', () => ({ scopedKey: (base: string) => `${base}::u` })) + +const { recordHandEdit, removeHandEdit, sessionHandEdits } = await import( + './sessionHandEdits.svelte' +) + +beforeEach(() => localStorage.clear()) + +describe('session hand edits', () => { + it("leaves another tab's entries alone when writing its own", () => { + recordHandEdit('s1', 'script', 'u/a/one') + // Another tab records its own entry directly in the shared store. + localStorage.setItem('windmill-session-hand-edit::u:s1:flow:u/a/two', '1') + + recordHandEdit('s1', 'raw_app', 'u/a/three') + removeHandEdit('s1', 'script', 'u/a/one') + + expect([...sessionHandEdits('s1')].sort()).toEqual(['flow:u/a/two', 'raw_app:u/a/three']) + expect(sessionHandEdits('s2').size).toBe(0) + }) +}) diff --git a/frontend/src/lib/components/sessions/sessionState.svelte.ts b/frontend/src/lib/components/sessions/sessionState.svelte.ts index 5007e3d4bc..6cfc98810b 100644 --- a/frontend/src/lib/components/sessions/sessionState.svelte.ts +++ b/frontend/src/lib/components/sessions/sessionState.svelte.ts @@ -21,6 +21,7 @@ import { userScopedDb } from '$lib/userScopedDb' import { emailOfScopedKey, scopedKeyFor } from '$lib/userScopedStorage' import { deleteItemsForSession } from '../copilot/chat/files/attachedFilesDB' import { deleteArtifactsForSession } from '../copilot/chat/artifacts/artifactsDB' +import { deleteSessionHandEdits } from './sessionHandEdits.svelte' import { deleteSessionChats } from '../copilot/chat/HistoryManager.svelte' import type { DraftAttachments } from '../copilot/chat/messageDraft.svelte' import type { AppDomSelectorElement } from '../copilot/chat/context' @@ -683,6 +684,7 @@ export async function reconcileSessionsLifecycle(): Promise { // here would orphan the session's attached-file blobs/handles. void deleteItemsForSession(s.id) void deleteArtifactsForSession(s.id) + deleteSessionHandEdits(s.id) deletedIds.add(s.id) continue } @@ -1601,6 +1603,7 @@ export function deleteSession(id: string) { // GC any linked files and artifacts persisted for this session. void deleteItemsForSession(id) void deleteArtifactsForSession(id) + deleteSessionHandEdits(id) // Only a delete the user asked for takes the backup with it: the workspace-lifecycle // removals above keep theirs, so a session dropped by a wrong reconcile can be restored. markSessionRemoved(id, s.workspace_id) diff --git a/frontend/src/lib/components/sessions/useUserDraftSync.svelte.ts b/frontend/src/lib/components/sessions/useUserDraftSync.svelte.ts index 64f7f7e6c2..5714ec3276 100644 --- a/frontend/src/lib/components/sessions/useUserDraftSync.svelte.ts +++ b/frontend/src/lib/components/sessions/useUserDraftSync.svelte.ts @@ -44,6 +44,8 @@ export interface UserDraftSyncOptions { * once, or the sync would read/write the previously-targeted cell. */ codec: () => DraftSyncCodec + /** Called after an editor edit is saved: never for a draft that came in. */ + onSaved?: (itemKind: UserDraftItemKind, path: string) => void } /** @@ -132,6 +134,7 @@ export function useUserDraftSync(opts: UserDraftSyncOptions): void // Our own write comes back through the handle; the inbound side must skip it. lastInboundSig = codec.sig(toSave) UserDraft.save(codec.itemKind, path, toSave, { workspace }) + opts.onSaved?.(codec.itemKind, path) }) } pendingFlush = save From 90833c780c1e656ad20127e244c0b197ab3266d3 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 30 Oct 2026 18:31:13 +0100 Subject: [PATCH 05/19] chore(main): release 1.855.0 (#12118) * chore(main): release 1.855.0 * Apply automatic changes --------- Co-authored-by: rubenfiszel <275584+rubenfiszel@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 20 ++ backend/Cargo.lock | 200 +++++++++--------- backend/Cargo.toml | 4 +- .../parsers/windmill-parser-wasm/Cargo.lock | 48 ++--- .../parsers/windmill-parser-wasm/Cargo.toml | 2 +- backend/windmill-api/openapi.yaml | 2 +- benchmarks/lib.ts | 2 +- chat-sdk/package-lock.json | 4 +- chat-sdk/package.json | 2 +- cli/src/core/constants.ts | 2 +- frontend/package-lock.json | 4 +- frontend/package.json | 2 +- lsp/Pipfile | 2 +- openflow.openapi.yaml | 2 +- .../WindmillClient/WindmillClient.psd1 | 2 +- python-client/wmill/pyproject.toml | 2 +- typescript-client/jsr.json | 2 +- typescript-client/package.json | 2 +- version.txt | 2 +- windmill-yaml-validator/package-lock.json | 4 +- windmill-yaml-validator/package.json | 2 +- 22 files changed, 166 insertions(+), 148 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 129af2ee98..f952bfd88a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.854.2" + ".": "1.855.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bb48df9c0..40bb5df772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [1.855.0](https://github.com/windmill-labs/windmill/compare/v1.854.2...v1.855.0) (2026-10-30) + + +### Features + +* link to the groups page wherever a group can be picked ([#12125](https://github.com/windmill-labs/windmill/issues/12125)) ([efcffb5](https://github.com/windmill-labs/windmill/commit/efcffb511798442b69b027ccef1e53dffa7d895a)) +* one home and ai sessions in the sidebar ([#12126](https://github.com/windmill-labs/windmill/issues/12126)) ([af836f1](https://github.com/windmill-labs/windmill/commit/af836f1ca61c663fffdb87cfada6a0399f720733)) + + +### Bug Fixes + +* **debugger:** require coding capability to sign debug sessions ([#12119](https://github.com/windmill-labs/windmill/issues/12119)) ([384295b](https://github.com/windmill-labs/windmill/commit/384295b6bc2c4089ed6356b9b512d2054524189e)) +* hide empty folder chevrons and size tree skeleton to item count ([#12128](https://github.com/windmill-labs/windmill/issues/12128)) ([2f9a493](https://github.com/windmill-labs/windmill/commit/2f9a49320be3a8490f92540658d774457adc4208)) +* keep secret values out of stored step inputs from flow_env ([#12130](https://github.com/windmill-labs/windmill/issues/12130)) ([37b1ea2](https://github.com/windmill-labs/windmill/commit/37b1ea23f93dcf052351b7cdb2fb52ace5bf6469)) +* list hand-edited session items in the session changes bar ([#12131](https://github.com/windmill-labs/windmill/issues/12131)) ([df70cd1](https://github.com/windmill-labs/windmill/commit/df70cd14c527117847916bee7f2bdab64542f756)) +* merge auto-add and instance groups into one popover ([#12100](https://github.com/windmill-labs/windmill/issues/12100)) ([633d176](https://github.com/windmill-labs/windmill/commit/633d176a3eb5a801ce76ab27d37635010aae8ac6)) +* move a session's return route only for a deploy in its workspace ([#12117](https://github.com/windmill-labs/windmill/issues/12117)) ([ac795bc](https://github.com/windmill-labs/windmill/commit/ac795bcd2564a9a14bd06a5c92aad6ef5ae517a8)) +* move leave workspace out of the settings menu ([#12123](https://github.com/windmill-labs/windmill/issues/12123)) ([1c8d60d](https://github.com/windmill-labs/windmill/commit/1c8d60dd4397e25e778cca56bab2e0cbdad8783b)) +* report a failed flow unless its failure module succeeded ([#12127](https://github.com/windmill-labs/windmill/issues/12127)) ([068f959](https://github.com/windmill-labs/windmill/commit/068f95907f264208d711c1049e2459fc59b7907b)) + ## [1.854.2](https://github.com/windmill-labs/windmill/compare/v1.854.1...v1.854.2) (2026-10-30) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 0bfa440344..0ec2a4e79b 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -7343,9 +7343,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.106" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" dependencies = [ "cfg-if", "futures-util", @@ -15200,12 +15200,11 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" dependencies = [ "cfg-if", - "once_cell", "rustversion", "serde", "wasm-bindgen-macro", @@ -15214,9 +15213,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.79" +version = "0.4.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" dependencies = [ "js-sys", "tokio", @@ -15225,9 +15224,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -15235,9 +15234,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" dependencies = [ "bumpalo", "proc-macro2", @@ -15248,20 +15247,19 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" dependencies = [ "unicode-ident", ] [[package]] name = "wasm-bindgen-test" -version = "0.3.79" +version = "0.3.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7499dfd45780a0a91d7ee6bb9ac51970a4479a41a89da443fdda5a39547d42" +checksum = "5b4913c0ade07e01ab574b20d2741538f070efa12cb7a1a1e2d5df6ea41cf522" dependencies = [ - "async-trait", "cast", "js-sys", "libm", @@ -15279,9 +15277,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.79" +version = "0.3.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b84b5ac638bfb168196a1a461fcc8f46a294a18b1b6be52133b4e0db122cc9f" +checksum = "238071aa4c5b268e57d21018621a2e2403c29dd11c55dbdf790ed47fdb9241c0" dependencies = [ "proc-macro2", "quote", @@ -15290,9 +15288,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-shared" -version = "0.2.129" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f692aa943ccd88363733b77063f32cfed5bc6cbea8e6e8b251b302f881606fe" +checksum = "9ab365ce29ba0232367502b2894556ae77a9c214d33dbf453fdba7f586905918" [[package]] name = "wasm-streams" @@ -15346,9 +15344,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.106" +version = "0.3.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" dependencies = [ "js-sys", "wasm-bindgen", @@ -15496,7 +15494,7 @@ dependencies = [ [[package]] name = "windmill" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-nats", @@ -15586,7 +15584,7 @@ dependencies = [ [[package]] name = "windmill-ai" -version = "1.854.2" +version = "1.855.0" dependencies = [ "async-stream", "async-trait", @@ -15621,7 +15619,7 @@ dependencies = [ [[package]] name = "windmill-alerting" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15634,7 +15632,7 @@ dependencies = [ [[package]] name = "windmill-api" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "argon2", @@ -15777,7 +15775,7 @@ dependencies = [ [[package]] name = "windmill-api-agent-workers" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15801,7 +15799,7 @@ dependencies = [ [[package]] name = "windmill-api-assets" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15818,7 +15816,7 @@ dependencies = [ [[package]] name = "windmill-api-auth" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -15844,7 +15842,7 @@ dependencies = [ [[package]] name = "windmill-api-client" -version = "1.854.2" +version = "1.855.0" dependencies = [ "reqwest 0.12.28", "serde", @@ -15854,7 +15852,7 @@ dependencies = [ [[package]] name = "windmill-api-configs" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15871,7 +15869,7 @@ dependencies = [ [[package]] name = "windmill-api-debug" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "base64 0.22.1", @@ -15893,7 +15891,7 @@ dependencies = [ [[package]] name = "windmill-api-embeddings" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -15916,7 +15914,7 @@ dependencies = [ [[package]] name = "windmill-api-flow-conversations" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15932,7 +15930,7 @@ dependencies = [ [[package]] name = "windmill-api-flows" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15954,7 +15952,7 @@ dependencies = [ [[package]] name = "windmill-api-groups" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15976,7 +15974,7 @@ dependencies = [ [[package]] name = "windmill-api-inputs" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -15990,7 +15988,7 @@ dependencies = [ [[package]] name = "windmill-api-integration-tests" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-nats", @@ -16026,7 +16024,7 @@ dependencies = [ [[package]] name = "windmill-api-jobs" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -16052,7 +16050,7 @@ dependencies = [ [[package]] name = "windmill-api-npm-proxy" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -16080,7 +16078,7 @@ dependencies = [ [[package]] name = "windmill-api-openapi" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -16102,7 +16100,7 @@ dependencies = [ [[package]] name = "windmill-api-schedule" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -16122,7 +16120,7 @@ dependencies = [ [[package]] name = "windmill-api-scripts" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -16164,7 +16162,7 @@ dependencies = [ [[package]] name = "windmill-api-settings" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -16194,7 +16192,7 @@ dependencies = [ [[package]] name = "windmill-api-sse" -version = "1.854.2" +version = "1.855.0" dependencies = [ "lazy_static", "serde", @@ -16206,7 +16204,7 @@ dependencies = [ [[package]] name = "windmill-api-users" -version = "1.854.2" +version = "1.855.0" dependencies = [ "argon2", "axum", @@ -16230,7 +16228,7 @@ dependencies = [ [[package]] name = "windmill-api-workers" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -16245,7 +16243,7 @@ dependencies = [ [[package]] name = "windmill-api-workspaces" -version = "1.854.2" +version = "1.855.0" dependencies = [ "axum", "chrono", @@ -16284,7 +16282,7 @@ dependencies = [ [[package]] name = "windmill-audit" -version = "1.854.2" +version = "1.855.0" dependencies = [ "chrono", "lazy_static", @@ -16299,7 +16297,7 @@ dependencies = [ [[package]] name = "windmill-autoscaling" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "axum", @@ -16318,7 +16316,7 @@ dependencies = [ [[package]] name = "windmill-common" -version = "1.854.2" +version = "1.855.0" dependencies = [ "aes-gcm", "aho-corasick", @@ -16436,7 +16434,7 @@ dependencies = [ [[package]] name = "windmill-dep-map" -version = "1.854.2" +version = "1.855.0" dependencies = [ "chrono", "futures", @@ -16456,7 +16454,7 @@ dependencies = [ [[package]] name = "windmill-git-sync" -version = "1.854.2" +version = "1.855.0" dependencies = [ "regex", "serde", @@ -16473,7 +16471,7 @@ dependencies = [ [[package]] name = "windmill-indexer" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "astral-tokio-tar", @@ -16500,7 +16498,7 @@ dependencies = [ [[package]] name = "windmill-jseval" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "futures", @@ -16517,7 +16515,7 @@ dependencies = [ [[package]] name = "windmill-macros" -version = "1.854.2" +version = "1.855.0" dependencies = [ "itertools 0.14.0", "lazy_static", @@ -16533,7 +16531,7 @@ dependencies = [ [[package]] name = "windmill-mcp" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -16555,7 +16553,7 @@ dependencies = [ [[package]] name = "windmill-native-triggers" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -16586,7 +16584,7 @@ dependencies = [ [[package]] name = "windmill-oauth" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "arc-swap", @@ -16611,7 +16609,7 @@ dependencies = [ [[package]] name = "windmill-object-store" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-stream", @@ -16647,7 +16645,7 @@ dependencies = [ [[package]] name = "windmill-operator" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "futures", @@ -16666,7 +16664,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.854.2" +version = "1.855.0" dependencies = [ "convert_case 0.6.0", "serde", @@ -16675,7 +16673,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -16687,7 +16685,7 @@ dependencies = [ [[package]] name = "windmill-parser-csharp" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde_json", @@ -16699,7 +16697,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "gosyn", @@ -16711,7 +16709,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -16723,7 +16721,7 @@ dependencies = [ [[package]] name = "windmill-parser-java" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde_json", @@ -16735,7 +16733,7 @@ dependencies = [ [[package]] name = "windmill-parser-nu" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "nu-parser", @@ -16746,7 +16744,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -16757,7 +16755,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -16769,7 +16767,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-asset" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "ruff_python_ast", @@ -16780,7 +16778,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-recursion", @@ -16803,7 +16801,7 @@ dependencies = [ [[package]] name = "windmill-parser-r" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde_json", @@ -16815,7 +16813,7 @@ dependencies = [ [[package]] name = "windmill-parser-ruby" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -16829,7 +16827,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -16846,7 +16844,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -16859,7 +16857,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql-asset" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde", @@ -16871,7 +16869,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -16889,7 +16887,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts-asset" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde-wasm-bindgen", @@ -16905,7 +16903,7 @@ dependencies = [ [[package]] name = "windmill-parser-wac" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "ruff_python_ast", @@ -16922,7 +16920,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -16936,7 +16934,7 @@ dependencies = [ [[package]] name = "windmill-queue" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-recursion", @@ -16975,7 +16973,7 @@ dependencies = [ [[package]] name = "windmill-runtime-nativets" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "const_format", @@ -17013,7 +17011,7 @@ dependencies = [ [[package]] name = "windmill-sql-datatype-parser-wasm" -version = "1.854.2" +version = "1.855.0" dependencies = [ "getrandom 0.3.4", "wasm-bindgen", @@ -17024,7 +17022,7 @@ dependencies = [ [[package]] name = "windmill-store" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-recursion", @@ -17059,7 +17057,7 @@ dependencies = [ [[package]] name = "windmill-test-utils" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17083,7 +17081,7 @@ dependencies = [ [[package]] name = "windmill-trigger" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17116,7 +17114,7 @@ dependencies = [ [[package]] name = "windmill-trigger-amqp" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17143,7 +17141,7 @@ dependencies = [ [[package]] name = "windmill-trigger-azure" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17176,7 +17174,7 @@ dependencies = [ [[package]] name = "windmill-trigger-email" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17196,7 +17194,7 @@ dependencies = [ [[package]] name = "windmill-trigger-gcp" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17230,7 +17228,7 @@ dependencies = [ [[package]] name = "windmill-trigger-http" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17267,7 +17265,7 @@ dependencies = [ [[package]] name = "windmill-trigger-kafka" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17290,7 +17288,7 @@ dependencies = [ [[package]] name = "windmill-trigger-mqtt" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17314,7 +17312,7 @@ dependencies = [ [[package]] name = "windmill-trigger-nats" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-nats", @@ -17338,7 +17336,7 @@ dependencies = [ [[package]] name = "windmill-trigger-postgres" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17373,7 +17371,7 @@ dependencies = [ [[package]] name = "windmill-trigger-sqs" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17401,7 +17399,7 @@ dependencies = [ [[package]] name = "windmill-trigger-websocket" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-trait", @@ -17427,7 +17425,7 @@ dependencies = [ [[package]] name = "windmill-types" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "bitflags 2.13.2", @@ -17446,7 +17444,7 @@ dependencies = [ [[package]] name = "windmill-worker" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-once-cell", @@ -17564,7 +17562,7 @@ dependencies = [ [[package]] name = "windmill-worker-volumes" -version = "1.854.2" +version = "1.855.0" dependencies = [ "bytes", "futures", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 90d078cd20..dfb430d516 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windmill" -version = "1.854.2" +version = "1.855.0" authors.workspace = true edition.workspace = true @@ -88,7 +88,7 @@ members = [ exclude = ["./windmill-duckdb-ffi-internal", "./parsers/windmill-parser-wasm"] [workspace.package] -version = "1.854.2" +version = "1.855.0" authors = ["Ruben Fiszel "] edition = "2021" diff --git a/backend/parsers/windmill-parser-wasm/Cargo.lock b/backend/parsers/windmill-parser-wasm/Cargo.lock index 62042c5a6b..1df6674bf8 100644 --- a/backend/parsers/windmill-parser-wasm/Cargo.lock +++ b/backend/parsers/windmill-parser-wasm/Cargo.lock @@ -6340,7 +6340,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windmill-common" -version = "1.854.2" +version = "1.855.0" dependencies = [ "aes-gcm", "aho-corasick", @@ -6430,7 +6430,7 @@ dependencies = [ [[package]] name = "windmill-macros" -version = "1.854.2" +version = "1.855.0" dependencies = [ "proc-macro2", "quote", @@ -6442,7 +6442,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.854.2" +version = "1.855.0" dependencies = [ "convert_case", "serde", @@ -6451,7 +6451,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -6463,7 +6463,7 @@ dependencies = [ [[package]] name = "windmill-parser-csharp" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde_json", @@ -6475,7 +6475,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "gosyn", @@ -6487,7 +6487,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -6499,7 +6499,7 @@ dependencies = [ [[package]] name = "windmill-parser-java" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde_json", @@ -6511,7 +6511,7 @@ dependencies = [ [[package]] name = "windmill-parser-nu" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "nu-parser", @@ -6522,7 +6522,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -6533,7 +6533,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -6545,7 +6545,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-asset" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "ruff_python_ast", @@ -6556,7 +6556,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "async-recursion", @@ -6579,7 +6579,7 @@ dependencies = [ [[package]] name = "windmill-parser-r" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde_json", @@ -6591,7 +6591,7 @@ dependencies = [ [[package]] name = "windmill-parser-ruby" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -6605,7 +6605,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "convert_case", @@ -6622,7 +6622,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -6635,7 +6635,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql-asset" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde", @@ -6647,7 +6647,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -6665,7 +6665,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts-asset" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "serde-wasm-bindgen", @@ -6681,7 +6681,7 @@ dependencies = [ [[package]] name = "windmill-parser-wac" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "ruff_python_ast", @@ -6698,7 +6698,7 @@ dependencies = [ [[package]] name = "windmill-parser-wasm" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "getrandom 0.2.17", @@ -6730,7 +6730,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "lazy_static", @@ -6744,7 +6744,7 @@ dependencies = [ [[package]] name = "windmill-types" -version = "1.854.2" +version = "1.855.0" dependencies = [ "anyhow", "bitflags", diff --git a/backend/parsers/windmill-parser-wasm/Cargo.toml b/backend/parsers/windmill-parser-wasm/Cargo.toml index faaf0264ef..780cb15fe2 100644 --- a/backend/parsers/windmill-parser-wasm/Cargo.toml +++ b/backend/parsers/windmill-parser-wasm/Cargo.toml @@ -12,7 +12,7 @@ resolver = "2" members = ["."] [workspace.package] -version = "1.854.2" +version = "1.855.0" edition = "2021" authors = ["Ruben Fiszel "] diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index bb5167adb1..a735870e8a 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.3" info: - version: 1.854.2 + version: 1.855.0 title: Windmill API contact: diff --git a/benchmarks/lib.ts b/benchmarks/lib.ts index 62b739336e..e286410cf9 100644 --- a/benchmarks/lib.ts +++ b/benchmarks/lib.ts @@ -2,7 +2,7 @@ import { sleep } from "https://deno.land/x/sleep@v1.2.1/mod.ts"; import * as windmill from "https://deno.land/x/windmill@v1.174.0/mod.ts"; import * as api from "https://deno.land/x/windmill@v1.174.0/windmill-api/index.ts"; -export const VERSION = "v1.854.2"; +export const VERSION = "v1.855.0"; export async function login(email: string, password: string): Promise { return await windmill.UserService.login({ diff --git a/chat-sdk/package-lock.json b/chat-sdk/package-lock.json index a7426f35a5..6a5b1fe7fb 100644 --- a/chat-sdk/package-lock.json +++ b/chat-sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@windmill-labs/chat-sdk", - "version": "1.854.2", + "version": "1.855.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@windmill-labs/chat-sdk", - "version": "1.854.2", + "version": "1.855.0", "license": "Apache-2.0", "devDependencies": { "@ai-sdk/react": "^4.0.102", diff --git a/chat-sdk/package.json b/chat-sdk/package.json index 5cde3b92a5..c818d47cd7 100644 --- a/chat-sdk/package.json +++ b/chat-sdk/package.json @@ -1,7 +1,7 @@ { "name": "@windmill-labs/chat-sdk", "description": "Build chat interfaces on Windmill flows deployed in chat mode, from any frontend or raw app", - "version": "1.854.2", + "version": "1.855.0", "author": "Ruben Fiszel", "license": "Apache-2.0", "homepage": "https://github.com/windmill-labs/windmill/tree/main/chat-sdk#readme", diff --git a/cli/src/core/constants.ts b/cli/src/core/constants.ts index 380ab7633d..4780724d84 100644 --- a/cli/src/core/constants.ts +++ b/cli/src/core/constants.ts @@ -10,4 +10,4 @@ export const WM_FORK_PREFIX = "wm-fork"; // (e.g. utils.ts) can read it without importing main.ts and creating a circular // dependency (main β†’ workspace β†’ utils β†’ main) that triggers a TDZ. // Re-exported from main.ts for backwards compatibility. -export const VERSION = "1.854.2"; +export const VERSION = "1.855.0"; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0adbcef7d0..d3149bd169 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "@windmill-labs/components", - "version": "1.854.2", + "version": "1.855.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@windmill-labs/components", - "version": "1.854.2", + "version": "1.855.0", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/frontend/package.json b/frontend/package.json index 3f8c3378dc..d4ca0eebe5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@windmill-labs/components", - "version": "1.854.2", + "version": "1.855.0", "scripts": { "dev": "vite dev", "dev:ui-builder": "mv static/ui_builder static/ui_builder.dev-disabled 2>/dev/null || true ; trap 'mv static/ui_builder.dev-disabled static/ui_builder 2>/dev/null || true' EXIT ; vite dev", diff --git a/lsp/Pipfile b/lsp/Pipfile index 9f0b276ffb..a38cc4c8b2 100644 --- a/lsp/Pipfile +++ b/lsp/Pipfile @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] -wmill = ">=1.854.2" +wmill = ">=1.855.0" sendgrid = "*" mysql-connector-python = "*" pymongo = "*" diff --git a/openflow.openapi.yaml b/openflow.openapi.yaml index 777c575754..d9c0576896 100644 --- a/openflow.openapi.yaml +++ b/openflow.openapi.yaml @@ -1,7 +1,7 @@ openapi: '3.0.3' info: - version: 1.854.2 + version: 1.855.0 title: OpenFlow Spec contact: name: Ruben Fiszel diff --git a/powershell-client/WindmillClient/WindmillClient.psd1 b/powershell-client/WindmillClient/WindmillClient.psd1 index 707fcc563a..ebcd3c02f8 100644 --- a/powershell-client/WindmillClient/WindmillClient.psd1 +++ b/powershell-client/WindmillClient/WindmillClient.psd1 @@ -12,7 +12,7 @@ RootModule = 'WindmillClient.psm1' # Version number of this module. - ModuleVersion = '1.854.2' + ModuleVersion = '1.855.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/python-client/wmill/pyproject.toml b/python-client/wmill/pyproject.toml index bd278b4562..88f69a298c 100644 --- a/python-client/wmill/pyproject.toml +++ b/python-client/wmill/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "wmill" -version = "1.854.2" +version = "1.855.0" description = "A client library for accessing Windmill server wrapping the Windmill client API" license = "Apache-2.0" homepage = "https://windmill.dev" diff --git a/typescript-client/jsr.json b/typescript-client/jsr.json index bd55bab351..34332c8820 100644 --- a/typescript-client/jsr.json +++ b/typescript-client/jsr.json @@ -1,6 +1,6 @@ { "name": "@windmill/windmill", - "version": "1.854.2", + "version": "1.855.0", "exports": "./src/index.ts", "publish": { "exclude": ["!src", "./s3Types.ts", "./sqlUtils.ts", "./client.ts", "./wacError.ts"] diff --git a/typescript-client/package.json b/typescript-client/package.json index 784fc7d59b..0f6dc7e5a8 100644 --- a/typescript-client/package.json +++ b/typescript-client/package.json @@ -1,7 +1,7 @@ { "name": "windmill-client", "description": "Windmill SDK client for browsers and Node.js", - "version": "1.854.2", + "version": "1.855.0", "author": "Ruben Fiszel", "license": "Apache 2.0", "homepage": "https://github.com/windmill-labs/windmill/tree/main/typescript-client#readme", diff --git a/version.txt b/version.txt index ff06152e03..e88b5a76af 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.854.2 +1.855.0 diff --git a/windmill-yaml-validator/package-lock.json b/windmill-yaml-validator/package-lock.json index 880b63973f..a2355af290 100644 --- a/windmill-yaml-validator/package-lock.json +++ b/windmill-yaml-validator/package-lock.json @@ -1,12 +1,12 @@ { "name": "windmill-yaml-validator", - "version": "1.854.2", + "version": "1.855.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "windmill-yaml-validator", - "version": "1.854.2", + "version": "1.855.0", "license": "Apache 2.0", "dependencies": { "@stoplight/yaml": "^4.3.0", diff --git a/windmill-yaml-validator/package.json b/windmill-yaml-validator/package.json index aa38278be4..b6dc1a62d9 100644 --- a/windmill-yaml-validator/package.json +++ b/windmill-yaml-validator/package.json @@ -1,6 +1,6 @@ { "name": "windmill-yaml-validator", - "version": "1.854.2", + "version": "1.855.0", "description": "YAML validator for Windmill flow, schedule, and trigger files", "main": "dist/index.js", "types": "dist/index.d.ts", From a8b84fc21149a49304bd41af583c1cf9d2205c9c Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 30 Oct 2026 19:56:21 +0100 Subject: [PATCH 06/19] fix: list only the reader's own ai chats in the sidebar (#12134) Co-authored-by: Claude Opus 5.5 --- backend/windmill-api-flow-conversations/src/lib.rs | 6 ++++++ backend/windmill-api/openapi.yaml | 5 +++++ frontend/src/lib/components/sidebar/AiChatsSection.svelte | 5 +++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/windmill-api-flow-conversations/src/lib.rs b/backend/windmill-api-flow-conversations/src/lib.rs index 2ed3531cca..69eda7d2d8 100644 --- a/backend/windmill-api-flow-conversations/src/lib.rs +++ b/backend/windmill-api-flow-conversations/src/lib.rs @@ -68,6 +68,8 @@ pub enum ConversationKind { pub struct ListConversationsQuery { pub flow_path: Option, pub kind: Option, + /// Only the caller's own chats: an admin otherwise lists every user's. + pub mine: Option, } #[derive(Deserialize)] @@ -103,6 +105,10 @@ async fn list_conversations( sqlb.and_where_eq("flow_path", "?".bind(flow_path)); } + if query.mine.unwrap_or(false) { + sqlb.and_where_eq("created_by", "?".bind(&authed.username)); + } + match query.kind.unwrap_or_default() { ConversationKind::Test => { sqlb.and_where_eq("is_test", "true"); diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index a735870e8a..698b3d54f5 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -13732,6 +13732,11 @@ paths: - test - deployed - all + - name: mine + description: only list the caller's own conversations (an admin otherwise lists every user's) + in: query + schema: + type: boolean responses: "200": description: flow conversations list diff --git a/frontend/src/lib/components/sidebar/AiChatsSection.svelte b/frontend/src/lib/components/sidebar/AiChatsSection.svelte index 22df9d1d89..d29c1ffda7 100644 --- a/frontend/src/lib/components/sidebar/AiChatsSection.svelte +++ b/frontend/src/lib/components/sidebar/AiChatsSection.svelte @@ -13,7 +13,7 @@ import { agentOfChatPath } from '$lib/components/flows/conversations/agentEditorChat' import { sidebarClasses } from './MenuButton.svelte' - // The workspace's flow and agent chats, the ones a flow's or an agent's own page shows: the + // The reader's own flow and agent chats, the ones a flow's or an agent's own page shows: the // editors' test chats stay with the editors. let { isCollapsed = false }: { isCollapsed?: boolean } = $props() @@ -32,7 +32,8 @@ const rows = await FlowConversationsService.listFlowConversations({ workspace: ws, perPage: 30, - kind: 'deployed' + kind: 'deployed', + mine: true }) return { ws, rows } } From 506999e4e1cce480e917081a64e62b4c70251525 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 30 Oct 2026 20:02:34 +0100 Subject: [PATCH 07/19] chore(main): release 1.855.1 (#12135) * chore(main): release 1.855.1 * Apply automatic changes --------- Co-authored-by: rubenfiszel <275584+rubenfiszel@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 + backend/Cargo.lock | 158 +++++++++--------- backend/Cargo.toml | 4 +- .../parsers/windmill-parser-wasm/Cargo.lock | 48 +++--- .../parsers/windmill-parser-wasm/Cargo.toml | 2 +- backend/windmill-api/openapi.yaml | 2 +- benchmarks/lib.ts | 2 +- chat-sdk/package-lock.json | 4 +- chat-sdk/package.json | 2 +- cli/src/core/constants.ts | 2 +- frontend/package-lock.json | 4 +- frontend/package.json | 2 +- lsp/Pipfile | 2 +- openflow.openapi.yaml | 2 +- .../WindmillClient/WindmillClient.psd1 | 2 +- python-client/wmill/pyproject.toml | 2 +- typescript-client/jsr.json | 2 +- typescript-client/package.json | 2 +- version.txt | 2 +- windmill-yaml-validator/package-lock.json | 4 +- windmill-yaml-validator/package.json | 2 +- 22 files changed, 133 insertions(+), 126 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f952bfd88a..68ad81d130 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.855.0" + ".": "1.855.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 40bb5df772..ef15c62319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.855.1](https://github.com/windmill-labs/windmill/compare/v1.855.0...v1.855.1) (2026-10-30) + + +### Bug Fixes + +* list only the reader's own ai chats in the sidebar ([#12134](https://github.com/windmill-labs/windmill/issues/12134)) ([a8b84fc](https://github.com/windmill-labs/windmill/commit/a8b84fc21149a49304bd41af583c1cf9d2205c9c)) + ## [1.855.0](https://github.com/windmill-labs/windmill/compare/v1.854.2...v1.855.0) (2026-10-30) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 0ec2a4e79b..d82c0e6f3b 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -15494,7 +15494,7 @@ dependencies = [ [[package]] name = "windmill" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-nats", @@ -15584,7 +15584,7 @@ dependencies = [ [[package]] name = "windmill-ai" -version = "1.855.0" +version = "1.855.1" dependencies = [ "async-stream", "async-trait", @@ -15619,7 +15619,7 @@ dependencies = [ [[package]] name = "windmill-alerting" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15632,7 +15632,7 @@ dependencies = [ [[package]] name = "windmill-api" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "argon2", @@ -15775,7 +15775,7 @@ dependencies = [ [[package]] name = "windmill-api-agent-workers" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15799,7 +15799,7 @@ dependencies = [ [[package]] name = "windmill-api-assets" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15816,7 +15816,7 @@ dependencies = [ [[package]] name = "windmill-api-auth" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -15842,7 +15842,7 @@ dependencies = [ [[package]] name = "windmill-api-client" -version = "1.855.0" +version = "1.855.1" dependencies = [ "reqwest 0.12.28", "serde", @@ -15852,7 +15852,7 @@ dependencies = [ [[package]] name = "windmill-api-configs" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15869,7 +15869,7 @@ dependencies = [ [[package]] name = "windmill-api-debug" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "base64 0.22.1", @@ -15891,7 +15891,7 @@ dependencies = [ [[package]] name = "windmill-api-embeddings" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -15914,7 +15914,7 @@ dependencies = [ [[package]] name = "windmill-api-flow-conversations" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15930,7 +15930,7 @@ dependencies = [ [[package]] name = "windmill-api-flows" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15952,7 +15952,7 @@ dependencies = [ [[package]] name = "windmill-api-groups" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15974,7 +15974,7 @@ dependencies = [ [[package]] name = "windmill-api-inputs" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -15988,7 +15988,7 @@ dependencies = [ [[package]] name = "windmill-api-integration-tests" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-nats", @@ -16024,7 +16024,7 @@ dependencies = [ [[package]] name = "windmill-api-jobs" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -16050,7 +16050,7 @@ dependencies = [ [[package]] name = "windmill-api-npm-proxy" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -16078,7 +16078,7 @@ dependencies = [ [[package]] name = "windmill-api-openapi" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -16100,7 +16100,7 @@ dependencies = [ [[package]] name = "windmill-api-schedule" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -16120,7 +16120,7 @@ dependencies = [ [[package]] name = "windmill-api-scripts" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -16162,7 +16162,7 @@ dependencies = [ [[package]] name = "windmill-api-settings" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -16192,7 +16192,7 @@ dependencies = [ [[package]] name = "windmill-api-sse" -version = "1.855.0" +version = "1.855.1" dependencies = [ "lazy_static", "serde", @@ -16204,7 +16204,7 @@ dependencies = [ [[package]] name = "windmill-api-users" -version = "1.855.0" +version = "1.855.1" dependencies = [ "argon2", "axum", @@ -16228,7 +16228,7 @@ dependencies = [ [[package]] name = "windmill-api-workers" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -16243,7 +16243,7 @@ dependencies = [ [[package]] name = "windmill-api-workspaces" -version = "1.855.0" +version = "1.855.1" dependencies = [ "axum", "chrono", @@ -16282,7 +16282,7 @@ dependencies = [ [[package]] name = "windmill-audit" -version = "1.855.0" +version = "1.855.1" dependencies = [ "chrono", "lazy_static", @@ -16297,7 +16297,7 @@ dependencies = [ [[package]] name = "windmill-autoscaling" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "axum", @@ -16316,7 +16316,7 @@ dependencies = [ [[package]] name = "windmill-common" -version = "1.855.0" +version = "1.855.1" dependencies = [ "aes-gcm", "aho-corasick", @@ -16434,7 +16434,7 @@ dependencies = [ [[package]] name = "windmill-dep-map" -version = "1.855.0" +version = "1.855.1" dependencies = [ "chrono", "futures", @@ -16454,7 +16454,7 @@ dependencies = [ [[package]] name = "windmill-git-sync" -version = "1.855.0" +version = "1.855.1" dependencies = [ "regex", "serde", @@ -16471,7 +16471,7 @@ dependencies = [ [[package]] name = "windmill-indexer" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "astral-tokio-tar", @@ -16498,7 +16498,7 @@ dependencies = [ [[package]] name = "windmill-jseval" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "futures", @@ -16515,7 +16515,7 @@ dependencies = [ [[package]] name = "windmill-macros" -version = "1.855.0" +version = "1.855.1" dependencies = [ "itertools 0.14.0", "lazy_static", @@ -16531,7 +16531,7 @@ dependencies = [ [[package]] name = "windmill-mcp" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -16553,7 +16553,7 @@ dependencies = [ [[package]] name = "windmill-native-triggers" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -16584,7 +16584,7 @@ dependencies = [ [[package]] name = "windmill-oauth" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "arc-swap", @@ -16609,7 +16609,7 @@ dependencies = [ [[package]] name = "windmill-object-store" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-stream", @@ -16645,7 +16645,7 @@ dependencies = [ [[package]] name = "windmill-operator" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "futures", @@ -16664,7 +16664,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.855.0" +version = "1.855.1" dependencies = [ "convert_case 0.6.0", "serde", @@ -16673,7 +16673,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -16685,7 +16685,7 @@ dependencies = [ [[package]] name = "windmill-parser-csharp" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde_json", @@ -16697,7 +16697,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "gosyn", @@ -16709,7 +16709,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -16721,7 +16721,7 @@ dependencies = [ [[package]] name = "windmill-parser-java" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde_json", @@ -16733,7 +16733,7 @@ dependencies = [ [[package]] name = "windmill-parser-nu" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "nu-parser", @@ -16744,7 +16744,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "itertools 0.14.0", @@ -16755,7 +16755,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "itertools 0.14.0", @@ -16767,7 +16767,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-asset" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "ruff_python_ast", @@ -16778,7 +16778,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-recursion", @@ -16801,7 +16801,7 @@ dependencies = [ [[package]] name = "windmill-parser-r" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde_json", @@ -16813,7 +16813,7 @@ dependencies = [ [[package]] name = "windmill-parser-ruby" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -16827,7 +16827,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -16844,7 +16844,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -16857,7 +16857,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql-asset" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde", @@ -16869,7 +16869,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -16887,7 +16887,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts-asset" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde-wasm-bindgen", @@ -16903,7 +16903,7 @@ dependencies = [ [[package]] name = "windmill-parser-wac" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "ruff_python_ast", @@ -16920,7 +16920,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -16934,7 +16934,7 @@ dependencies = [ [[package]] name = "windmill-queue" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-recursion", @@ -16973,7 +16973,7 @@ dependencies = [ [[package]] name = "windmill-runtime-nativets" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "const_format", @@ -17011,7 +17011,7 @@ dependencies = [ [[package]] name = "windmill-sql-datatype-parser-wasm" -version = "1.855.0" +version = "1.855.1" dependencies = [ "getrandom 0.3.4", "wasm-bindgen", @@ -17022,7 +17022,7 @@ dependencies = [ [[package]] name = "windmill-store" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-recursion", @@ -17057,7 +17057,7 @@ dependencies = [ [[package]] name = "windmill-test-utils" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17081,7 +17081,7 @@ dependencies = [ [[package]] name = "windmill-trigger" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17114,7 +17114,7 @@ dependencies = [ [[package]] name = "windmill-trigger-amqp" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17141,7 +17141,7 @@ dependencies = [ [[package]] name = "windmill-trigger-azure" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17174,7 +17174,7 @@ dependencies = [ [[package]] name = "windmill-trigger-email" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17194,7 +17194,7 @@ dependencies = [ [[package]] name = "windmill-trigger-gcp" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17228,7 +17228,7 @@ dependencies = [ [[package]] name = "windmill-trigger-http" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17265,7 +17265,7 @@ dependencies = [ [[package]] name = "windmill-trigger-kafka" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17288,7 +17288,7 @@ dependencies = [ [[package]] name = "windmill-trigger-mqtt" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17312,7 +17312,7 @@ dependencies = [ [[package]] name = "windmill-trigger-nats" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-nats", @@ -17336,7 +17336,7 @@ dependencies = [ [[package]] name = "windmill-trigger-postgres" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17371,7 +17371,7 @@ dependencies = [ [[package]] name = "windmill-trigger-sqs" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17399,7 +17399,7 @@ dependencies = [ [[package]] name = "windmill-trigger-websocket" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-trait", @@ -17425,7 +17425,7 @@ dependencies = [ [[package]] name = "windmill-types" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "bitflags 2.13.2", @@ -17444,7 +17444,7 @@ dependencies = [ [[package]] name = "windmill-worker" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-once-cell", @@ -17562,7 +17562,7 @@ dependencies = [ [[package]] name = "windmill-worker-volumes" -version = "1.855.0" +version = "1.855.1" dependencies = [ "bytes", "futures", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index dfb430d516..a07dad88fa 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windmill" -version = "1.855.0" +version = "1.855.1" authors.workspace = true edition.workspace = true @@ -88,7 +88,7 @@ members = [ exclude = ["./windmill-duckdb-ffi-internal", "./parsers/windmill-parser-wasm"] [workspace.package] -version = "1.855.0" +version = "1.855.1" authors = ["Ruben Fiszel "] edition = "2021" diff --git a/backend/parsers/windmill-parser-wasm/Cargo.lock b/backend/parsers/windmill-parser-wasm/Cargo.lock index 1df6674bf8..ebce4393d4 100644 --- a/backend/parsers/windmill-parser-wasm/Cargo.lock +++ b/backend/parsers/windmill-parser-wasm/Cargo.lock @@ -6340,7 +6340,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windmill-common" -version = "1.855.0" +version = "1.855.1" dependencies = [ "aes-gcm", "aho-corasick", @@ -6430,7 +6430,7 @@ dependencies = [ [[package]] name = "windmill-macros" -version = "1.855.0" +version = "1.855.1" dependencies = [ "proc-macro2", "quote", @@ -6442,7 +6442,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.855.0" +version = "1.855.1" dependencies = [ "convert_case", "serde", @@ -6451,7 +6451,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -6463,7 +6463,7 @@ dependencies = [ [[package]] name = "windmill-parser-csharp" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde_json", @@ -6475,7 +6475,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "gosyn", @@ -6487,7 +6487,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -6499,7 +6499,7 @@ dependencies = [ [[package]] name = "windmill-parser-java" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde_json", @@ -6511,7 +6511,7 @@ dependencies = [ [[package]] name = "windmill-parser-nu" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "nu-parser", @@ -6522,7 +6522,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "itertools 0.14.0", @@ -6533,7 +6533,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "itertools 0.14.0", @@ -6545,7 +6545,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-asset" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "ruff_python_ast", @@ -6556,7 +6556,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "async-recursion", @@ -6579,7 +6579,7 @@ dependencies = [ [[package]] name = "windmill-parser-r" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde_json", @@ -6591,7 +6591,7 @@ dependencies = [ [[package]] name = "windmill-parser-ruby" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -6605,7 +6605,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "convert_case", @@ -6622,7 +6622,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -6635,7 +6635,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql-asset" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde", @@ -6647,7 +6647,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -6665,7 +6665,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts-asset" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "serde-wasm-bindgen", @@ -6681,7 +6681,7 @@ dependencies = [ [[package]] name = "windmill-parser-wac" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "ruff_python_ast", @@ -6698,7 +6698,7 @@ dependencies = [ [[package]] name = "windmill-parser-wasm" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "getrandom 0.2.17", @@ -6730,7 +6730,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "lazy_static", @@ -6744,7 +6744,7 @@ dependencies = [ [[package]] name = "windmill-types" -version = "1.855.0" +version = "1.855.1" dependencies = [ "anyhow", "bitflags", diff --git a/backend/parsers/windmill-parser-wasm/Cargo.toml b/backend/parsers/windmill-parser-wasm/Cargo.toml index 780cb15fe2..2b29a2370f 100644 --- a/backend/parsers/windmill-parser-wasm/Cargo.toml +++ b/backend/parsers/windmill-parser-wasm/Cargo.toml @@ -12,7 +12,7 @@ resolver = "2" members = ["."] [workspace.package] -version = "1.855.0" +version = "1.855.1" edition = "2021" authors = ["Ruben Fiszel "] diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 698b3d54f5..ccc73a8acc 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.3" info: - version: 1.855.0 + version: 1.855.1 title: Windmill API contact: diff --git a/benchmarks/lib.ts b/benchmarks/lib.ts index e286410cf9..292d7671bd 100644 --- a/benchmarks/lib.ts +++ b/benchmarks/lib.ts @@ -2,7 +2,7 @@ import { sleep } from "https://deno.land/x/sleep@v1.2.1/mod.ts"; import * as windmill from "https://deno.land/x/windmill@v1.174.0/mod.ts"; import * as api from "https://deno.land/x/windmill@v1.174.0/windmill-api/index.ts"; -export const VERSION = "v1.855.0"; +export const VERSION = "v1.855.1"; export async function login(email: string, password: string): Promise { return await windmill.UserService.login({ diff --git a/chat-sdk/package-lock.json b/chat-sdk/package-lock.json index 6a5b1fe7fb..9e6f802313 100644 --- a/chat-sdk/package-lock.json +++ b/chat-sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@windmill-labs/chat-sdk", - "version": "1.855.0", + "version": "1.855.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@windmill-labs/chat-sdk", - "version": "1.855.0", + "version": "1.855.1", "license": "Apache-2.0", "devDependencies": { "@ai-sdk/react": "^4.0.102", diff --git a/chat-sdk/package.json b/chat-sdk/package.json index c818d47cd7..79330a317b 100644 --- a/chat-sdk/package.json +++ b/chat-sdk/package.json @@ -1,7 +1,7 @@ { "name": "@windmill-labs/chat-sdk", "description": "Build chat interfaces on Windmill flows deployed in chat mode, from any frontend or raw app", - "version": "1.855.0", + "version": "1.855.1", "author": "Ruben Fiszel", "license": "Apache-2.0", "homepage": "https://github.com/windmill-labs/windmill/tree/main/chat-sdk#readme", diff --git a/cli/src/core/constants.ts b/cli/src/core/constants.ts index 4780724d84..a0f0a5955f 100644 --- a/cli/src/core/constants.ts +++ b/cli/src/core/constants.ts @@ -10,4 +10,4 @@ export const WM_FORK_PREFIX = "wm-fork"; // (e.g. utils.ts) can read it without importing main.ts and creating a circular // dependency (main β†’ workspace β†’ utils β†’ main) that triggers a TDZ. // Re-exported from main.ts for backwards compatibility. -export const VERSION = "1.855.0"; +export const VERSION = "1.855.1"; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d3149bd169..1dc9a09242 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "@windmill-labs/components", - "version": "1.855.0", + "version": "1.855.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@windmill-labs/components", - "version": "1.855.0", + "version": "1.855.1", "hasInstallScript": true, "license": "AGPL-3.0", "dependencies": { diff --git a/frontend/package.json b/frontend/package.json index d4ca0eebe5..18de2b127f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@windmill-labs/components", - "version": "1.855.0", + "version": "1.855.1", "scripts": { "dev": "vite dev", "dev:ui-builder": "mv static/ui_builder static/ui_builder.dev-disabled 2>/dev/null || true ; trap 'mv static/ui_builder.dev-disabled static/ui_builder 2>/dev/null || true' EXIT ; vite dev", diff --git a/lsp/Pipfile b/lsp/Pipfile index a38cc4c8b2..7003ad17f6 100644 --- a/lsp/Pipfile +++ b/lsp/Pipfile @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] -wmill = ">=1.855.0" +wmill = ">=1.855.1" sendgrid = "*" mysql-connector-python = "*" pymongo = "*" diff --git a/openflow.openapi.yaml b/openflow.openapi.yaml index d9c0576896..2cb3788933 100644 --- a/openflow.openapi.yaml +++ b/openflow.openapi.yaml @@ -1,7 +1,7 @@ openapi: '3.0.3' info: - version: 1.855.0 + version: 1.855.1 title: OpenFlow Spec contact: name: Ruben Fiszel diff --git a/powershell-client/WindmillClient/WindmillClient.psd1 b/powershell-client/WindmillClient/WindmillClient.psd1 index ebcd3c02f8..4b7bea9a71 100644 --- a/powershell-client/WindmillClient/WindmillClient.psd1 +++ b/powershell-client/WindmillClient/WindmillClient.psd1 @@ -12,7 +12,7 @@ RootModule = 'WindmillClient.psm1' # Version number of this module. - ModuleVersion = '1.855.0' + ModuleVersion = '1.855.1' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/python-client/wmill/pyproject.toml b/python-client/wmill/pyproject.toml index 88f69a298c..64378084af 100644 --- a/python-client/wmill/pyproject.toml +++ b/python-client/wmill/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "wmill" -version = "1.855.0" +version = "1.855.1" description = "A client library for accessing Windmill server wrapping the Windmill client API" license = "Apache-2.0" homepage = "https://windmill.dev" diff --git a/typescript-client/jsr.json b/typescript-client/jsr.json index 34332c8820..ee36964b1e 100644 --- a/typescript-client/jsr.json +++ b/typescript-client/jsr.json @@ -1,6 +1,6 @@ { "name": "@windmill/windmill", - "version": "1.855.0", + "version": "1.855.1", "exports": "./src/index.ts", "publish": { "exclude": ["!src", "./s3Types.ts", "./sqlUtils.ts", "./client.ts", "./wacError.ts"] diff --git a/typescript-client/package.json b/typescript-client/package.json index 0f6dc7e5a8..e698e886b4 100644 --- a/typescript-client/package.json +++ b/typescript-client/package.json @@ -1,7 +1,7 @@ { "name": "windmill-client", "description": "Windmill SDK client for browsers and Node.js", - "version": "1.855.0", + "version": "1.855.1", "author": "Ruben Fiszel", "license": "Apache 2.0", "homepage": "https://github.com/windmill-labs/windmill/tree/main/typescript-client#readme", diff --git a/version.txt b/version.txt index e88b5a76af..8304afaeef 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.855.0 +1.855.1 diff --git a/windmill-yaml-validator/package-lock.json b/windmill-yaml-validator/package-lock.json index a2355af290..1bbfc930d5 100644 --- a/windmill-yaml-validator/package-lock.json +++ b/windmill-yaml-validator/package-lock.json @@ -1,12 +1,12 @@ { "name": "windmill-yaml-validator", - "version": "1.855.0", + "version": "1.855.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "windmill-yaml-validator", - "version": "1.855.0", + "version": "1.855.1", "license": "Apache 2.0", "dependencies": { "@stoplight/yaml": "^4.3.0", diff --git a/windmill-yaml-validator/package.json b/windmill-yaml-validator/package.json index b6dc1a62d9..99df3f7963 100644 --- a/windmill-yaml-validator/package.json +++ b/windmill-yaml-validator/package.json @@ -1,6 +1,6 @@ { "name": "windmill-yaml-validator", - "version": "1.855.0", + "version": "1.855.1", "description": "YAML validator for Windmill flow, schedule, and trigger files", "main": "dist/index.js", "types": "dist/index.d.ts", From 45f256a5a1046b80833dda217e5884f9eeb6a3a4 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 30 Oct 2026 20:09:09 +0100 Subject: [PATCH 08/19] feat: accept MCP access tokens from an external OIDC issuer (#12085) * feat: accept MCP access tokens from an external OIDC issuer With the mcp_external_idp instance setting, every MCP URL also accepts an access token of an external OIDC issuer, told apart from Windmill's own by its iss. The token's OAuth client is mapped to a workspace and a selection of tools; the request acts as the existing Windmill user with the token's email, under that selection. Runs record the client in mcp_client and give it to steps as WM_MCP_CLIENT; tool calls and refusals are audited with both identities. Co-Authored-By: Claude Opus 5.5 * fix: harden external MCP token verification Refuse ID tokens, tokens before their nbf, and emails the issuer marks unverified; let a cached signing key expire so a withdrawn key stops verifying; fall back to the token's asymmetric alg for keys published without one; reject clients configured without an issuer or with an id longer than the column recording it. Co-Authored-By: Claude Opus 5.5 * fix: refuse deactivated accounts and untyped tokens on external MCP auth Read password.disabled, since instance deactivation has no Windmill token to revoke on this path. Without a configured audience, take only tokens typed as access tokens (at+jwt header or a Bearer typ claim), so an ID token cannot stand in for one. Require https for the issuer except on localhost. Co-Authored-By: Claude Opus 5.5 * fix: refuse ID tokens with an audience set, parse the issuer host Co-Authored-By: Claude Opus 5.5 * feat: take an external MCP token's groups for the request instead of storing them When sso_groups_claim is set, the IdP-managed instance groups of an external MCP request come from the token's claim alone, mapped through their external_id with nested paths counting for their ancestors. Nothing is written, and an absent claim means no IdP groups, so removing a user from every group revokes at the next token. Entra's overage pointer is refused rather than read as no groups. Co-Authored-By: Claude Opus 5.5 * feat: give external MCP clients the token access levels, one card per client A client takes the same access as a Windmill token: read, read and run, build and run (the session toolset, bound to the client's workspace), or scripts and flows as tools. The settings editor reuses McpAccessPicker, one collapsible card per client. The caller's JWT carries mcp_client so runs the session toolset starts record the client too. With token groups in use, admin rights a managed group grants follow the token, and workspace groups are kept by source rather than by name. Co-Authored-By: Claude Opus 5.5 * fix: keep a client's tool selection across reopening its card Co-Authored-By: Claude Opus 5.5 * fix: tidy the MCP external identity provider form Show it under SSO only, shorten its description with details in a tooltip, and give its fields form labels, hints and tooltips. Co-Authored-By: Claude Opus 5.5 * fix: leave default claim names empty, shorten auth setting descriptions Co-Authored-By: Claude Opus 5.5 * fix: report an external MCP token's groups in whoami Requests and jobs started through an external MCP token act with the token's groups; whoami returned the stored memberships instead. Co-Authored-By: Claude Opus 5.5 * fix: keep stored roles for external MCP requests Only group memberships follow the token. Admin and superadmin roles stay as stored, kept current by SCIM and SSO login: their source is not recorded, so a group-derived demotion also stripped directly granted admins and left operator restrictions unapplied. Co-Authored-By: Claude Opus 5.5 * fix: record the MCP client on on-behalf-of runs and AI agent tool steps On-behalf-of runs now hand push the MCP caller, which push uses only to record the client while it fetches the run's own permissions. AI agent tool jobs read the client from job_perms, so their steps see WM_MCP_CLIENT. Co-Authored-By: Claude Opus 5.5 * fix: keep the MCP client off v2_job The client is needed only while a job is queued, which job_perms covers; a finished run's client is in its audit entry. This leaves the job history table unaltered. Co-Authored-By: Claude Opus 5.5 * chore: update ee-repo-ref to e9e94030cebd5afb0c8156ee46af2025bbe8778a This commit updates the EE repository reference after PR #934 was merged in windmill-ee-private. Previous ee-repo-ref: 7bdd6e8067a72e847ed0372ddc79a84f288946cf New ee-repo-ref: e9e94030cebd5afb0c8156ee46af2025bbe8778a Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: windmill-internal-app[bot] Co-authored-by: Ruben Fiszel --- AGENTS.md | 2 +- ...e7c4035f9f1b5dfe257358a5a47077d528fd.json} | 18 +- ...d6608f48bea5b2a81e086cfd3e144378aa71.json} | 10 +- ...20d7f2d589d294fb1beeeba6b47a99210f241.json | 23 + ...83c6826279e1f35dbc3b389f7e3a274ec50f.json} | 12 +- ...a44c7939bc7b97c4e1104fae6d9b57b7c960.json} | 7 +- backend/ee-repo-ref.txt | 2 +- ...20261028160214_mcp_client_on_jobs.down.sql | 1 + .../20261028160214_mcp_client_on_jobs.up.sql | 1 + backend/src/main.rs | 3 + backend/src/monitor.rs | 30 + backend/tests/end_user_email.rs | 1 + backend/tests/inline_preview_auth.rs | 1 + backend/tests/postgres_trigger_scope.rs | 1 + backend/tests/reserved_control_args.rs | 1 + backend/tests/trigger_listener_queries.rs | 1 + backend/tests/wm_token_confinement.rs | 2 + .../tests/dbt_pinned_graph.rs | 1 + backend/windmill-api-auth/src/auth.rs | 10 + backend/windmill-api-auth/src/lib.rs | 6 + .../tests/native_triggers.rs | 1 + .../tests/preview_on_behalf_of.rs | 1 + backend/windmill-api-jobs/src/execution.rs | 4 +- backend/windmill-api-settings/src/lib.rs | 4 + backend/windmill-api-users/src/users.rs | 24 +- .../windmill-api-workspaces/src/workspaces.rs | 2 + backend/windmill-api/src/agent_runs.rs | 2 +- backend/windmill-api/src/jobs.rs | 13 +- backend/windmill-api/src/lib.rs | 6 + backend/windmill-api/src/mcp/core.rs | 17 +- backend/windmill-api/src/mcp/external_idp.rs | 540 ++++++++++++++++++ backend/windmill-api/src/mcp/mod.rs | 1 + backend/windmill-api/src/mcp/oauth_server.rs | 16 +- backend/windmill-api/src/mcp/utils.rs | 1 + backend/windmill-common/src/auth.rs | 15 +- backend/windmill-common/src/db.rs | 2 + .../windmill-common/src/global_settings.rs | 170 ++++++ .../windmill-common/src/instance_config.rs | 4 + backend/windmill-common/src/worker.rs | 2 +- backend/windmill-mcp/src/server/backend.rs | 11 + backend/windmill-mcp/src/server/runner.rs | 58 +- backend/windmill-mcp/src/server/session.rs | 9 +- backend/windmill-queue/src/jobs.rs | 25 +- backend/windmill-queue/tests/debounce_test.rs | 2 + backend/windmill-queue/tests/schedule_push.rs | 1 + backend/windmill-worker/src/common.rs | 12 + backend/windmill-worker/src/worker_flow.rs | 3 +- docs/auth-surface.md | 18 + .../src/lib/components/InstanceSetting.svelte | 3 + .../lib/components/InstanceSettings.svelte | 2 +- .../src/lib/components/instanceSettings.ts | 22 +- .../instanceSettings/McpExternalIdp.svelte | 265 +++++++++ 52 files changed, 1328 insertions(+), 61 deletions(-) rename backend/.sqlx/{query-6445041033c95fcf52c79c33f34cf6c41fb443f8bd91f12bce0e53f6e91bfb16.json => query-7a24557a10d6fced22c3180827ffe7c4035f9f1b5dfe257358a5a47077d528fd.json} (95%) rename backend/.sqlx/{query-9ec675bd675c9915ed56f6cb91ca848b094b61475409156489319cb9d36ef096.json => query-c8d4d9816fd6a5bd466fc249ca47d6608f48bea5b2a81e086cfd3e144378aa71.json} (93%) create mode 100644 backend/.sqlx/query-da49cdc6f47685c719cb07fc3b120d7f2d589d294fb1beeeba6b47a99210f241.json rename backend/.sqlx/{query-fd04f65015069792f23edbfce320af6e69ee32b27a8f0a020e251eb2c79e43cd.json => query-dd548c53f2498d0554584d4fb94183c6826279e1f35dbc3b389f7e3a274ec50f.json} (81%) rename backend/.sqlx/{query-095fa75c60724664f0355cd6e3a64f84a0f1a31cd6732c0ab994a2d6ac3c3eec.json => query-f470d4475ebd131af74be49434dea44c7939bc7b97c4e1104fae6d9b57b7c960.json} (85%) create mode 100644 backend/migrations/20261028160214_mcp_client_on_jobs.down.sql create mode 100644 backend/migrations/20261028160214_mcp_client_on_jobs.up.sql create mode 100644 backend/windmill-api/src/mcp/external_idp.rs create mode 100644 frontend/src/lib/components/instanceSettings/McpExternalIdp.svelte diff --git a/AGENTS.md b/AGENTS.md index 1d564d346a..4c99482d43 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -69,7 +69,7 @@ Open-source platform for internal tools, workflows, API integrations, background - **Domain vocabulary**: `CONTEXT.md` β€” the words this codebase uses for its own concepts (step, step setting, trigger step, …). Name things the way it does. - **CLI commands**: when adding/modifying/removing a command, subcommand, option, or description in `cli/src/commands/`, run `python system_prompts/generate.py` to refresh `system_prompts/auto-generated/` and `cli/src/guidance/skills.gen.ts`. The CLI docs the agents use to operate `wmill` are derived from the source β€” stale generated files give agents the wrong flags. - **AI guidance** (chat prompts and CLI skills): what the AI knows about Windmill itself β€” how flows, scripts, apps, pipelines and resources work β€” is written once, in `system_prompts/base/` and `system_prompts/languages/`, and `system_prompts/generate.py` builds both the chat's `$system_prompts` exports and the CLI's skills from it. Add or change such guidance there, never inline in one consumer: a sentence only one side should see goes in a `` / `` block, and a new file reaches both through the `TOPICS` table. The chat prompt builders under `frontend/src/lib/components/copilot/chat/` add only tool plumbing and runtime values, and shared markdown names no chat tool, since it reaches every chat mode. Rerun `generate.py` after editing; `system_prompts/README.md` has the details. -- **Windmill MCP server**: `/api/mcp` gives a token with `mcp:all` the AI session's GLOBAL toolset (`backend/windmill-api/src/mcp/session/`), and a token scoped to a selection of scripts and flows the tools server's per-runnable tools, without endpoint tools. The tools server's own URLs, `/api/mcp/w/{workspace}/mcp` and `/api/mcp/gateway`, keep serving existing tokens, endpoint scopes included, except that they give the session toolset to an `mcp:all` token carrying `mcp:session` (added by the OAuth approve, kept across scope edits) or `mcp:read_only`/`mcp:read_run`. Every tool takes a `workspace_id`; the token bounds which (its bound workspace, the `mcp:workspaces:` list, or all of its owner's). What a model reads there (tool names, descriptions, input schemas, instructions, `get_instructions` texts) is generated from the session's TypeScript into `session/gen/`: after changing a GLOBAL tool definition, the global system prompt or `system_prompts/`, run `npm run gen:mcp-session` from `frontend/` (`mcpSessionGen.test.ts` fails otherwise). What a tool *does* is written twice, in `chat/global/core.ts` and in a Rust handler: a behaviour change on one side must be mirrored on the other, and a new session tool is either implemented in Rust or added to `EDITOR_ONLY` (a `cargo test` in `session/mod.rs` fails otherwise). For MCP Apps clients the server adds tools of its own, defined in Rust (`session/views.rs`) rather than generated: `show_run`, `show_runs`, `show_deploy_review` and `show_item` draw a card in the `ui://windmill/card-v` view (`session/card.html`; bump `CARD_URI` when the `_meta` it reads changes shape, since hosts cache a view by URI) from their result's `_meta` (`windmill/run`, `windmill/runs`, `windmill/review`, `windmill/item`), which the model never reads. A host draws a card for every call of a tool that declares one, so only these show tools do: the tools the model reads and runs with draw nothing, and `get_run` builds no card data. The card acts only by calling the session's tools (`show_run` to refresh, `cancel_job`, `show_deploy_review` to re-read a draft, `deploy_workspace_item` from the review card's Deploy button, which the user presses), so it sees nothing the model could not. Every `DESTRUCTIVE` tool but those in `CARD_ACTIONS` is hidden from it. Every session tool carries a `title` and explicit read-only, destructive and open-world hints, which the Claude and ChatGPT directories require (`DESTRUCTIVE`, `OPEN_WORLD`). A client that declares capabilities without the MCP Apps extension is not offered the show tools. It exists only on the MCP side, so `core.ts` has nothing to mirror. +- **Windmill MCP server**: `/api/mcp` gives a token with `mcp:all` the AI session's GLOBAL toolset (`backend/windmill-api/src/mcp/session/`), and a token scoped to a selection of scripts and flows the tools server's per-runnable tools, without endpoint tools. The tools server's own URLs, `/api/mcp/w/{workspace}/mcp` and `/api/mcp/gateway`, keep serving existing tokens, endpoint scopes included, except that they give the session toolset to an `mcp:all` token carrying `mcp:session` (added by the OAuth approve, kept across scope edits) or `mcp:read_only`/`mcp:read_run`. Every tool takes a `workspace_id`; the token bounds which (its bound workspace, the `mcp:workspaces:` list, or all of its owner's). With the `mcp_external_idp` instance setting, every MCP URL also accepts an access token of an external OIDC issuer (`mcp/external_idp.rs`), told apart from Windmill's own by its `iss`: the token's client is mapped to a workspace and to the same access a Windmill token takes (an access level, served the session toolset as `mcp:session`, or a selection of scripts and flows), and the request acts as the existing Windmill user with the token's email, under that access, as a workspace-bound token does. The protected-resource metadata then names that issuer. What a model reads there (tool names, descriptions, input schemas, instructions, `get_instructions` texts) is generated from the session's TypeScript into `session/gen/`: after changing a GLOBAL tool definition, the global system prompt or `system_prompts/`, run `npm run gen:mcp-session` from `frontend/` (`mcpSessionGen.test.ts` fails otherwise). What a tool *does* is written twice, in `chat/global/core.ts` and in a Rust handler: a behaviour change on one side must be mirrored on the other, and a new session tool is either implemented in Rust or added to `EDITOR_ONLY` (a `cargo test` in `session/mod.rs` fails otherwise). For MCP Apps clients the server adds tools of its own, defined in Rust (`session/views.rs`) rather than generated: `show_run`, `show_runs`, `show_deploy_review` and `show_item` draw a card in the `ui://windmill/card-v` view (`session/card.html`; bump `CARD_URI` when the `_meta` it reads changes shape, since hosts cache a view by URI) from their result's `_meta` (`windmill/run`, `windmill/runs`, `windmill/review`, `windmill/item`), which the model never reads. A host draws a card for every call of a tool that declares one, so only these show tools do: the tools the model reads and runs with draw nothing, and `get_run` builds no card data. The card acts only by calling the session's tools (`show_run` to refresh, `cancel_job`, `show_deploy_review` to re-read a draft, `deploy_workspace_item` from the review card's Deploy button, which the user presses), so it sees nothing the model could not. Every `DESTRUCTIVE` tool but those in `CARD_ACTIONS` is hidden from it. Every session tool carries a `title` and explicit read-only, destructive and open-world hints, which the Claude and ChatGPT directories require (`DESTRUCTIVE`, `OPEN_WORLD`). A client that declares capabilities without the MCP Apps extension is not offered the show tools. It exists only on the MCP side, so `core.ts` has nothing to mirror. - **Session recorder**: `frontend/src/lib/components/recording/` is also the recorder `wmill app dev --recording` serves, vendored into the CLI as `cli/src/commands/app/devRecorderBundle.gen.ts`. After changing `rawAppSnapshot.ts` or `rawAppRecording.svelte.ts`, run `bun run gen:dev-recorder` from `cli/` (`cli/test/dev_recorder_bundle_unit.test.ts` fails otherwise). - **Raw-app policy**: `frontend/src/lib/components/raw_apps/rawAppPolicy.ts` also derives the policy the server's raw-app deploy stores, vendored into the bundle job as `backend/windmill-api/src/apps_raw_policy.gen.js`. After changing it or anything it imports, run `bun run gen:app-policy` from `cli/` (`cli/test/app_policy_bundle_unit.test.ts` fails otherwise). It rides in the job rather than being read from the CLI the job runs because the images install `windmill-cli` unpinned, so an image can carry one older than its server. diff --git a/backend/.sqlx/query-6445041033c95fcf52c79c33f34cf6c41fb443f8bd91f12bce0e53f6e91bfb16.json b/backend/.sqlx/query-7a24557a10d6fced22c3180827ffe7c4035f9f1b5dfe257358a5a47077d528fd.json similarity index 95% rename from backend/.sqlx/query-6445041033c95fcf52c79c33f34cf6c41fb443f8bd91f12bce0e53f6e91bfb16.json rename to backend/.sqlx/query-7a24557a10d6fced22c3180827ffe7c4035f9f1b5dfe257358a5a47077d528fd.json index abcdf7baab..89a905e2d3 100644 --- a/backend/.sqlx/query-6445041033c95fcf52c79c33f34cf6c41fb443f8bd91f12bce0e53f6e91bfb16.json +++ b/backend/.sqlx/query-7a24557a10d6fced22c3180827ffe7c4035f9f1b5dfe257358a5a47077d528fd.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "UPDATE v2_job_status SET\n flow_status = JSONB_SET(\n JSONB_SET(v2_job_status.flow_status, $2::TEXT[], $3),\n $4::TEXT[], $5\n ) - $6::TEXT[],\n flow_leaf_jobs = CASE\n WHEN $7::TEXT IS NULL\n OR COALESCE(v2_job.flow_innermost_root_job, v2_job_status.id) <> v2_job_status.id\n THEN v2_job_status.flow_leaf_jobs\n ELSE JSONB_SET(COALESCE(v2_job_status.flow_leaf_jobs, '{}'::JSONB), ARRAY[$7::TEXT], $8) END\n FROM v2_job_queue INNER JOIN v2_job ON v2_job.id = v2_job_queue.id\n LEFT JOIN job_perms ON job_perms.job_id = v2_job_queue.id\n WHERE v2_job_status.id = $1 AND v2_job_queue.id = $1\n RETURNING\n v2_job_queue.workspace_id,\n v2_job_queue.id,\n v2_job.args as \"args: sqlx::types::Json>>\",\n v2_job.parent_job,\n v2_job.created_by,\n v2_job_queue.started_at,\n v2_job_queue.runnable_settings_handle,\n v2_job_queue.scheduled_for,\n v2_job.runnable_path,\n v2_job.kind as \"kind: JobKind\",\n v2_job.runnable_id as \"runnable_id: ScriptHash\",\n v2_job_queue.canceled_reason,\n v2_job_queue.canceled_by,\n v2_job.permissioned_as,\n v2_job.permissioned_as_email,\n v2_job_status.flow_status as \"flow_status: sqlx::types::Json>\",\n v2_job.tag,\n v2_job.script_lang as \"script_lang: ScriptLang\",\n v2_job.same_worker,\n v2_job.pre_run_error,\n v2_job.concurrent_limit,\n v2_job.concurrency_time_window_s,\n v2_job.flow_innermost_root_job,\n v2_job.root_job,\n v2_job.timeout,\n v2_job.flow_step_id,\n v2_job.cache_ttl,\n v2_job_queue.cache_ignore_s3_path,\n v2_job_queue.priority,\n v2_job.preprocessed,\n v2_job.script_entrypoint_override,\n v2_job.trigger,\n v2_job.trigger_kind as \"trigger_kind: TriggerKindLabel\",\n v2_job.visible_to_owner,\n NULL as permissioned_as_end_user_email,\n job_perms.job_token_scopes", + "query": "UPDATE v2_job_status SET\n flow_status = JSONB_SET(\n JSONB_SET(v2_job_status.flow_status, $2::TEXT[], $3),\n $4::TEXT[], $5\n ) - $6::TEXT[],\n flow_leaf_jobs = CASE\n WHEN $7::TEXT IS NULL\n OR COALESCE(v2_job.flow_innermost_root_job, v2_job_status.id) <> v2_job_status.id\n THEN v2_job_status.flow_leaf_jobs\n ELSE JSONB_SET(COALESCE(v2_job_status.flow_leaf_jobs, '{}'::JSONB), ARRAY[$7::TEXT], $8) END\n FROM v2_job_queue INNER JOIN v2_job ON v2_job.id = v2_job_queue.id\n LEFT JOIN job_perms ON job_perms.job_id = v2_job_queue.id\n WHERE v2_job_status.id = $1 AND v2_job_queue.id = $1\n RETURNING\n v2_job_queue.workspace_id,\n v2_job_queue.id,\n v2_job.args as \"args: sqlx::types::Json>>\",\n v2_job.parent_job,\n v2_job.created_by,\n v2_job_queue.started_at,\n v2_job_queue.runnable_settings_handle,\n v2_job_queue.scheduled_for,\n v2_job.runnable_path,\n v2_job.kind as \"kind: JobKind\",\n v2_job.runnable_id as \"runnable_id: ScriptHash\",\n v2_job_queue.canceled_reason,\n v2_job_queue.canceled_by,\n v2_job.permissioned_as,\n v2_job.permissioned_as_email,\n v2_job_status.flow_status as \"flow_status: sqlx::types::Json>\",\n v2_job.tag,\n v2_job.script_lang as \"script_lang: ScriptLang\",\n v2_job.same_worker,\n v2_job.pre_run_error,\n v2_job.concurrent_limit,\n v2_job.concurrency_time_window_s,\n v2_job.flow_innermost_root_job,\n v2_job.root_job,\n v2_job.timeout,\n v2_job.flow_step_id,\n v2_job.cache_ttl,\n v2_job_queue.cache_ignore_s3_path,\n v2_job_queue.priority,\n v2_job.preprocessed,\n v2_job.script_entrypoint_override,\n v2_job.trigger,\n v2_job.trigger_kind as \"trigger_kind: TriggerKindLabel\",\n v2_job.visible_to_owner,\n NULL as permissioned_as_end_user_email,\n NULL::boolean as viewer_data_access,\n job_perms.job_token_scopes,\n NULL::varchar as mcp_client", "describe": { "columns": [ { @@ -272,8 +272,18 @@ }, { "ordinal": 35, + "name": "viewer_data_access", + "type_info": "Bool" + }, + { + "ordinal": 36, "name": "job_token_scopes", "type_info": "TextArray" + }, + { + "ordinal": 37, + "name": "mcp_client", + "type_info": "Varchar" } ], "parameters": { @@ -324,8 +334,10 @@ true, false, null, - true + null, + true, + null ] }, - "hash": "6445041033c95fcf52c79c33f34cf6c41fb443f8bd91f12bce0e53f6e91bfb16" + "hash": "7a24557a10d6fced22c3180827ffe7c4035f9f1b5dfe257358a5a47077d528fd" } diff --git a/backend/.sqlx/query-9ec675bd675c9915ed56f6cb91ca848b094b61475409156489319cb9d36ef096.json b/backend/.sqlx/query-c8d4d9816fd6a5bd466fc249ca47d6608f48bea5b2a81e086cfd3e144378aa71.json similarity index 93% rename from backend/.sqlx/query-9ec675bd675c9915ed56f6cb91ca848b094b61475409156489319cb9d36ef096.json rename to backend/.sqlx/query-c8d4d9816fd6a5bd466fc249ca47d6608f48bea5b2a81e086cfd3e144378aa71.json index bd3f00aa7d..a86053391d 100644 --- a/backend/.sqlx/query-9ec675bd675c9915ed56f6cb91ca848b094b61475409156489319cb9d36ef096.json +++ b/backend/.sqlx/query-c8d4d9816fd6a5bd466fc249ca47d6608f48bea5b2a81e086cfd3e144378aa71.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT\n v2_job_queue.workspace_id,\n v2_job_queue.id,\n v2_job.args as \"args: sqlx::types::Json>>\",\n v2_job.parent_job,\n v2_job.created_by,\n v2_job_queue.started_at,\n v2_job_queue.runnable_settings_handle,\n scheduled_for,\n runnable_path,\n kind as \"kind: JobKind\",\n runnable_id as \"runnable_id: ScriptHash\",\n canceled_reason,\n canceled_by,\n permissioned_as,\n permissioned_as_email,\n flow_status as \"flow_status: sqlx::types::Json>\",\n v2_job.tag,\n script_lang as \"script_lang: ScriptLang\",\n same_worker,\n pre_run_error,\n concurrent_limit,\n concurrency_time_window_s,\n flow_innermost_root_job,\n root_job,\n timeout,\n flow_step_id,\n cache_ttl,\n cache_ignore_s3_path,\n v2_job_queue.priority,\n preprocessed,\n script_entrypoint_override,\n trigger,\n trigger_kind as \"trigger_kind: TriggerKindLabel\",\n visible_to_owner,\n NULL as permissioned_as_end_user_email,\n NULL::boolean as viewer_data_access,\n job_perms.job_token_scopes\n FROM v2_job_queue INNER JOIN v2_job ON v2_job.id = v2_job_queue.id LEFT JOIN v2_job_status ON v2_job_status.id = v2_job_queue.id\n LEFT JOIN job_perms ON job_perms.job_id = v2_job_queue.id WHERE v2_job_queue.id = $1", + "query": "SELECT\n v2_job_queue.workspace_id,\n v2_job_queue.id,\n v2_job.args as \"args: sqlx::types::Json>>\",\n v2_job.parent_job,\n v2_job.created_by,\n v2_job_queue.started_at,\n v2_job_queue.runnable_settings_handle,\n scheduled_for,\n runnable_path,\n kind as \"kind: JobKind\",\n runnable_id as \"runnable_id: ScriptHash\",\n canceled_reason,\n canceled_by,\n permissioned_as,\n permissioned_as_email,\n flow_status as \"flow_status: sqlx::types::Json>\",\n v2_job.tag,\n script_lang as \"script_lang: ScriptLang\",\n same_worker,\n pre_run_error,\n concurrent_limit,\n concurrency_time_window_s,\n flow_innermost_root_job,\n root_job,\n timeout,\n flow_step_id,\n cache_ttl,\n cache_ignore_s3_path,\n v2_job_queue.priority,\n preprocessed,\n script_entrypoint_override,\n trigger,\n trigger_kind as \"trigger_kind: TriggerKindLabel\",\n visible_to_owner,\n NULL as permissioned_as_end_user_email,\n NULL::boolean as viewer_data_access,\n job_perms.job_token_scopes,\n job_perms.mcp_client\n FROM v2_job_queue INNER JOIN v2_job ON v2_job.id = v2_job_queue.id LEFT JOIN v2_job_status ON v2_job_status.id = v2_job_queue.id\n LEFT JOIN job_perms ON job_perms.job_id = v2_job_queue.id WHERE v2_job_queue.id = $1", "describe": { "columns": [ { @@ -279,6 +279,11 @@ "ordinal": 36, "name": "job_token_scopes", "type_info": "TextArray" + }, + { + "ordinal": 37, + "name": "mcp_client", + "type_info": "Varchar" } ], "parameters": { @@ -323,8 +328,9 @@ false, null, null, + true, true ] }, - "hash": "9ec675bd675c9915ed56f6cb91ca848b094b61475409156489319cb9d36ef096" + "hash": "c8d4d9816fd6a5bd466fc249ca47d6608f48bea5b2a81e086cfd3e144378aa71" } diff --git a/backend/.sqlx/query-da49cdc6f47685c719cb07fc3b120d7f2d589d294fb1beeeba6b47a99210f241.json b/backend/.sqlx/query-da49cdc6f47685c719cb07fc3b120d7f2d589d294fb1beeeba6b47a99210f241.json new file mode 100644 index 0000000000..7022df5899 --- /dev/null +++ b/backend/.sqlx/query-da49cdc6f47685c719cb07fc3b120d7f2d589d294fb1beeeba6b47a99210f241.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT username FROM usr WHERE workspace_id = $1 AND email = $2 AND NOT disabled", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "username", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "da49cdc6f47685c719cb07fc3b120d7f2d589d294fb1beeeba6b47a99210f241" +} diff --git a/backend/.sqlx/query-fd04f65015069792f23edbfce320af6e69ee32b27a8f0a020e251eb2c79e43cd.json b/backend/.sqlx/query-dd548c53f2498d0554584d4fb94183c6826279e1f35dbc3b389f7e3a274ec50f.json similarity index 81% rename from backend/.sqlx/query-fd04f65015069792f23edbfce320af6e69ee32b27a8f0a020e251eb2c79e43cd.json rename to backend/.sqlx/query-dd548c53f2498d0554584d4fb94183c6826279e1f35dbc3b389f7e3a274ec50f.json index 4801a9b5da..0d53a1d0fc 100644 --- a/backend/.sqlx/query-fd04f65015069792f23edbfce320af6e69ee32b27a8f0a020e251eb2c79e43cd.json +++ b/backend/.sqlx/query-dd548c53f2498d0554584d4fb94183c6826279e1f35dbc3b389f7e3a274ec50f.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT email, username, is_admin, is_operator, groups, folders, end_user_email,\n job_token_scopes, viewer_data_access\n FROM job_perms WHERE job_id = $1 AND workspace_id = $2", + "query": "SELECT email, username, is_admin, is_operator, groups, folders, end_user_email,\n job_token_scopes, viewer_data_access, mcp_client\n FROM job_perms WHERE job_id = $1 AND workspace_id = $2", "describe": { "columns": [ { @@ -47,6 +47,11 @@ "ordinal": 8, "name": "viewer_data_access", "type_info": "Bool" + }, + { + "ordinal": 9, + "name": "mcp_client", + "type_info": "Varchar" } ], "parameters": { @@ -64,8 +69,9 @@ false, true, true, - false + false, + true ] }, - "hash": "fd04f65015069792f23edbfce320af6e69ee32b27a8f0a020e251eb2c79e43cd" + "hash": "dd548c53f2498d0554584d4fb94183c6826279e1f35dbc3b389f7e3a274ec50f" } diff --git a/backend/.sqlx/query-095fa75c60724664f0355cd6e3a64f84a0f1a31cd6732c0ab994a2d6ac3c3eec.json b/backend/.sqlx/query-f470d4475ebd131af74be49434dea44c7939bc7b97c4e1104fae6d9b57b7c960.json similarity index 85% rename from backend/.sqlx/query-095fa75c60724664f0355cd6e3a64f84a0f1a31cd6732c0ab994a2d6ac3c3eec.json rename to backend/.sqlx/query-f470d4475ebd131af74be49434dea44c7939bc7b97c4e1104fae6d9b57b7c960.json index 852ce508ff..c52bf8fd56 100644 --- a/backend/.sqlx/query-095fa75c60724664f0355cd6e3a64f84a0f1a31cd6732c0ab994a2d6ac3c3eec.json +++ b/backend/.sqlx/query-f470d4475ebd131af74be49434dea44c7939bc7b97c4e1104fae6d9b57b7c960.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "WITH inserted_job AS (\n INSERT INTO v2_job (\n id, -- 1\n workspace_id, -- 2\n raw_code, -- 3\n raw_lock, -- 4\n raw_flow, -- 5\n tag, -- 6\n parent_job, -- 7\n created_by, -- 8\n permissioned_as, -- 9\n runnable_id, -- 10\n runnable_path, -- 11\n args, -- 12\n kind, -- 13\n trigger, -- 14\n script_lang, -- 15\n same_worker, -- 16\n pre_run_error, -- 17\n permissioned_as_email, -- 18\n visible_to_owner, -- 19\n flow_innermost_root_job, -- 20\n root_job, -- 38\n concurrent_limit, -- 21\n concurrency_time_window_s, -- 22\n timeout, -- 23\n flow_step_id, -- 24\n cache_ttl, -- 25\n priority, -- 26\n trigger_kind, -- 39\n script_entrypoint_override, -- 12\n preprocessed, -- 27,\n labels -- 44\n ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18,\n $19, $20, $38, $21, $22, $23, $24, $25, $26, $39::job_trigger_kind,\n ($12::JSONB)->>'_ENTRYPOINT_OVERRIDE', $27,\n -- $44 (payload labels) merged with the labels of the runnable's folder, if any\n -- ($45/$46 are runnable_path/workspace_id again, kept separate to avoid parameter type conflicts)\n (SELECT CASE WHEN fl.labels IS NULL THEN $44\n ELSE (SELECT array_agg(DISTINCT lbl) FROM unnest(COALESCE($44, ARRAY[]::TEXT[]) || fl.labels) lbl)\n END\n FROM folder_labels($46, $45) AS fl(labels)))\n ),\n inserted_runtime AS (\n INSERT INTO v2_job_runtime (id, ping) VALUES ($1, null)\n ),\n inserted_job_perms AS (\n INSERT INTO job_perms (job_id, email, username, is_admin, is_operator, folders, groups, workspace_id, end_user_email, job_token_scopes)\n values ($1, $32, $33, $34, $35, $36, $37, $2, $41, $47)\n ON CONFLICT (job_id) DO UPDATE SET email = EXCLUDED.email, username = EXCLUDED.username, is_admin = EXCLUDED.is_admin, is_operator = EXCLUDED.is_operator, folders = EXCLUDED.folders, groups = EXCLUDED.groups, workspace_id = EXCLUDED.workspace_id, end_user_email = EXCLUDED.end_user_email, job_token_scopes = EXCLUDED.job_token_scopes\n )\n INSERT INTO v2_job_queue\n (workspace_id, id, running, scheduled_for, started_at, tag, priority, cache_ignore_s3_path, runnable_settings_handle)\n VALUES ($2, $1, $28, COALESCE($29, now()), CASE WHEN $27 OR $40 THEN now() END, $30, $31, $42, $43)", + "query": "WITH inserted_job AS (\n INSERT INTO v2_job (\n id, -- 1\n workspace_id, -- 2\n raw_code, -- 3\n raw_lock, -- 4\n raw_flow, -- 5\n tag, -- 6\n parent_job, -- 7\n created_by, -- 8\n permissioned_as, -- 9\n runnable_id, -- 10\n runnable_path, -- 11\n args, -- 12\n kind, -- 13\n trigger, -- 14\n script_lang, -- 15\n same_worker, -- 16\n pre_run_error, -- 17\n permissioned_as_email, -- 18\n visible_to_owner, -- 19\n flow_innermost_root_job, -- 20\n root_job, -- 38\n concurrent_limit, -- 21\n concurrency_time_window_s, -- 22\n timeout, -- 23\n flow_step_id, -- 24\n cache_ttl, -- 25\n priority, -- 26\n trigger_kind, -- 39\n script_entrypoint_override, -- 12\n preprocessed, -- 27,\n labels -- 44\n ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18,\n $19, $20, $38, $21, $22, $23, $24, $25, $26, $39::job_trigger_kind,\n ($12::JSONB)->>'_ENTRYPOINT_OVERRIDE', $27,\n -- $44 (payload labels) merged with the labels of the runnable's folder, if any\n -- ($45/$46 are runnable_path/workspace_id again, kept separate to avoid parameter type conflicts)\n (SELECT CASE WHEN fl.labels IS NULL THEN $44\n ELSE (SELECT array_agg(DISTINCT lbl) FROM unnest(COALESCE($44, ARRAY[]::TEXT[]) || fl.labels) lbl)\n END\n FROM folder_labels($46, $45) AS fl(labels)))\n ),\n inserted_runtime AS (\n INSERT INTO v2_job_runtime (id, ping) VALUES ($1, null)\n ),\n inserted_job_perms AS (\n INSERT INTO job_perms (job_id, email, username, is_admin, is_operator, folders, groups, workspace_id, end_user_email, job_token_scopes, mcp_client)\n values ($1, $32, $33, $34, $35, $36, $37, $2, $41, $47, $48)\n ON CONFLICT (job_id) DO UPDATE SET email = EXCLUDED.email, username = EXCLUDED.username, is_admin = EXCLUDED.is_admin, is_operator = EXCLUDED.is_operator, folders = EXCLUDED.folders, groups = EXCLUDED.groups, workspace_id = EXCLUDED.workspace_id, end_user_email = EXCLUDED.end_user_email, job_token_scopes = EXCLUDED.job_token_scopes, mcp_client = EXCLUDED.mcp_client\n )\n INSERT INTO v2_job_queue\n (workspace_id, id, running, scheduled_for, started_at, tag, priority, cache_ignore_s3_path, runnable_settings_handle)\n VALUES ($2, $1, $28, COALESCE($29, now()), CASE WHEN $27 OR $40 THEN now() END, $30, $31, $42, $43)", "describe": { "columns": [], "parameters": { @@ -143,10 +143,11 @@ "TextArray", "Text", "Text", - "TextArray" + "TextArray", + "Varchar" ] }, "nullable": [] }, - "hash": "095fa75c60724664f0355cd6e3a64f84a0f1a31cd6732c0ab994a2d6ac3c3eec" + "hash": "f470d4475ebd131af74be49434dea44c7939bc7b97c4e1104fae6d9b57b7c960" } diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 2ccd51782f..7915f079b9 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -222df41fce30afc4c3fdd9560cb71b077fdd49ff +e9e94030cebd5afb0c8156ee46af2025bbe8778a diff --git a/backend/migrations/20261028160214_mcp_client_on_jobs.down.sql b/backend/migrations/20261028160214_mcp_client_on_jobs.down.sql new file mode 100644 index 0000000000..0b943547c0 --- /dev/null +++ b/backend/migrations/20261028160214_mcp_client_on_jobs.down.sql @@ -0,0 +1 @@ +ALTER TABLE job_perms DROP COLUMN IF EXISTS mcp_client; diff --git a/backend/migrations/20261028160214_mcp_client_on_jobs.up.sql b/backend/migrations/20261028160214_mcp_client_on_jobs.up.sql new file mode 100644 index 0000000000..a69c935baf --- /dev/null +++ b/backend/migrations/20261028160214_mcp_client_on_jobs.up.sql @@ -0,0 +1 @@ +ALTER TABLE job_perms ADD COLUMN IF NOT EXISTS mcp_client VARCHAR(255); diff --git a/backend/src/main.rs b/backend/src/main.rs index 4ffc55aff5..0b3a06a15d 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -2053,6 +2053,9 @@ async fn process_notify_event( MCP_DISABLE_TOKEN_QUERY_PARAM_SETTING => { load_mcp_disable_token_query_param(db).await; } + windmill_common::global_settings::MCP_EXTERNAL_IDP_SETTING => { + crate::monitor::load_mcp_external_idp(db).await; + } API_BASE_URL_SETTING => { load_api_base_url(db).await; } diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs index 8ec3c33bb0..9ee707113a 100644 --- a/backend/src/monitor.rs +++ b/backend/src/monitor.rs @@ -311,6 +311,11 @@ pub async fn initial_load( false, |v| async move { apply_mcp_disable_token_query_param(v) }, ); + pass.setting( + windmill_common::global_settings::MCP_EXTERNAL_IDP_SETTING, + false, + |v| async move { apply_mcp_external_idp(v) }, + ); pass.setting(API_BASE_URL_SETTING, false, |v| async move { apply_api_base_url(v) }); @@ -1746,6 +1751,31 @@ pub fn apply_mcp_disable_token_query_param(value: Option) { }; } +pub async fn load_mcp_external_idp(db: &DB) { + match load_value_from_global_settings( + db, + windmill_common::global_settings::MCP_EXTERNAL_IDP_SETTING, + ) + .await + { + Ok(v) => apply_mcp_external_idp(v), + Err(e) => tracing::error!("Error loading mcp_external_idp setting: {e:#}"), + }; +} + +pub fn apply_mcp_external_idp(value: Option) { + use windmill_common::global_settings::{parse_mcp_external_idp, MCP_EXTERNAL_IDP}; + match parse_mcp_external_idp(value.as_ref()) { + Ok(idp) => MCP_EXTERNAL_IDP.store(idp.map(std::sync::Arc::new)), + // Refused at write time, so only a hand-written row lands here: keep no issuer + // rather than one half-read. + Err(e) => { + tracing::error!("Invalid mcp_external_idp setting, external MCP tokens disabled: {e}"); + MCP_EXTERNAL_IDP.store(None); + } + } +} + pub async fn load_api_base_url(db: &DB) { match load_value_from_global_settings(db, API_BASE_URL_SETTING).await { Ok(v) => apply_api_base_url(v), diff --git a/backend/tests/end_user_email.rs b/backend/tests/end_user_email.rs index 7fad5ab5ef..bde142ef69 100644 --- a/backend/tests/end_user_email.rs +++ b/backend/tests/end_user_email.rs @@ -359,6 +359,7 @@ async fn test_job_token_run_keeps_end_user_email(db: Pool) -> anyhow:: folders: vec![], scopes: None, token_prefix: None, + mcp_client: None, }, "test-workspace", 3600, diff --git a/backend/tests/inline_preview_auth.rs b/backend/tests/inline_preview_auth.rs index 231e71e92a..ec7042a4af 100644 --- a/backend/tests/inline_preview_auth.rs +++ b/backend/tests/inline_preview_auth.rs @@ -77,6 +77,7 @@ async fn operator_job_token(job_id: uuid::Uuid) -> String { folders: vec![], scopes: None, token_prefix: None, + mcp_client: None, }; create_jwt_token( authed, diff --git a/backend/tests/postgres_trigger_scope.rs b/backend/tests/postgres_trigger_scope.rs index 1080138eb0..7171812fa9 100644 --- a/backend/tests/postgres_trigger_scope.rs +++ b/backend/tests/postgres_trigger_scope.rs @@ -26,6 +26,7 @@ fn scoped_authed(scopes: Vec<&str>) -> ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/tests/reserved_control_args.rs b/backend/tests/reserved_control_args.rs index a733546e51..6e019cd591 100644 --- a/backend/tests/reserved_control_args.rs +++ b/backend/tests/reserved_control_args.rs @@ -90,6 +90,7 @@ fn trigger_authed() -> windmill_api_auth::ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/tests/trigger_listener_queries.rs b/backend/tests/trigger_listener_queries.rs index 0af99136e7..88dcab82ac 100644 --- a/backend/tests/trigger_listener_queries.rs +++ b/backend/tests/trigger_listener_queries.rs @@ -179,6 +179,7 @@ fn make_authed() -> windmill_api_auth::ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/tests/wm_token_confinement.rs b/backend/tests/wm_token_confinement.rs index e15d33354e..af5974f85a 100644 --- a/backend/tests/wm_token_confinement.rs +++ b/backend/tests/wm_token_confinement.rs @@ -51,6 +51,7 @@ async fn wm_token(email: &str, is_admin: bool) -> String { folders: vec![], scopes: None, token_prefix: None, + mcp_client: None, }; create_jwt_token( authed, @@ -1127,6 +1128,7 @@ async fn test_privilege_gates_reject_a_job_token_directly( read_only: false, job_id, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/windmill-api-assets/tests/dbt_pinned_graph.rs b/backend/windmill-api-assets/tests/dbt_pinned_graph.rs index ebeee49ecc..ac9b5b740c 100644 --- a/backend/windmill-api-assets/tests/dbt_pinned_graph.rs +++ b/backend/windmill-api-assets/tests/dbt_pinned_graph.rs @@ -36,6 +36,7 @@ fn outsider() -> ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/windmill-api-auth/src/auth.rs b/backend/windmill-api-auth/src/auth.rs index a4a9d41a50..9a9ef691fb 100644 --- a/backend/windmill-api-auth/src/auth.rs +++ b/backend/windmill-api-auth/src/auth.rs @@ -347,6 +347,7 @@ impl AuthCache { read_only: false, job_id: None, credential_expiry: Some(credential_expiry), + mcp_client: None, }; AUTH_CACHE.insert( key, @@ -392,6 +393,7 @@ impl AuthCache { read_only: false, job_id: None, credential_expiry: None, + mcp_client: claims.mcp_client, }; // Fail closed: a `job_id` claim that does not parse must reject // the token rather than resolve to `None`, which would clear the @@ -523,6 +525,7 @@ impl AuthCache { read_only, job_id: None, credential_expiry: None, + mcp_client: None, }) } else { tracing::warn!( @@ -577,6 +580,7 @@ impl AuthCache { read_only, job_id: None, credential_expiry: None, + mcp_client: None, }) } else { tracing::warn!( @@ -676,6 +680,7 @@ impl AuthCache { read_only, job_id: None, credential_expiry: None, + mcp_client: None, }) } None if super_admin => { @@ -701,6 +706,7 @@ impl AuthCache { read_only, job_id: None, credential_expiry: None, + mcp_client: None, }), Err(e) => { tracing::error!( @@ -739,6 +745,7 @@ impl AuthCache { read_only, job_id: None, credential_expiry: None, + mcp_client: None, }) } None => None, @@ -759,6 +766,7 @@ impl AuthCache { read_only, job_id: None, credential_expiry: None, + mcp_client: None, }) } } @@ -798,6 +806,7 @@ impl AuthCache { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, }; Some(OptJobAuthed { authed, job_id: None }) } else { @@ -1172,6 +1181,7 @@ fn no_auth_admin_authed() -> ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/windmill-api-auth/src/lib.rs b/backend/windmill-api-auth/src/lib.rs index 6a09710b5e..e3f4b8f6d9 100644 --- a/backend/windmill-api-auth/src/lib.rs +++ b/backend/windmill-api-auth/src/lib.rs @@ -90,6 +90,9 @@ pub struct ApiAuthed { /// this, since the JWT's expiry is a guest's only revocation and there is no row to /// look the limit up in. `None` for every credential whose limit lives in `token`. pub credential_expiry: Option>, + /// The OAuth client of an external issuer acting for this user (`mcp_external_idp`). + /// Recorded on the runs it starts and handed to their steps as `WM_MCP_CLIENT`. + pub mcp_client: Option, } impl ApiAuthed { @@ -157,6 +160,7 @@ impl From for Authed { folders: value.folders, scopes: value.scopes, token_prefix: value.token_prefix, + mcp_client: value.mcp_client, } } } @@ -178,6 +182,7 @@ impl From for ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: value.mcp_client, } } } @@ -1099,6 +1104,7 @@ pub async fn fetch_api_authed_from_permissioned_as( read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, }; API_AUTHED_CACHE.insert( diff --git a/backend/windmill-api-integration-tests/tests/native_triggers.rs b/backend/windmill-api-integration-tests/tests/native_triggers.rs index 285d560588..df4efea019 100644 --- a/backend/windmill-api-integration-tests/tests/native_triggers.rs +++ b/backend/windmill-api-integration-tests/tests/native_triggers.rs @@ -67,6 +67,7 @@ fn test_authed() -> ApiAuthed { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/windmill-api-integration-tests/tests/preview_on_behalf_of.rs b/backend/windmill-api-integration-tests/tests/preview_on_behalf_of.rs index a1bb7876c6..43342907d6 100644 --- a/backend/windmill-api-integration-tests/tests/preview_on_behalf_of.rs +++ b/backend/windmill-api-integration-tests/tests/preview_on_behalf_of.rs @@ -105,6 +105,7 @@ async fn test_preview_on_behalf_of(db: Pool) -> anyhow::Result<()> { folders: vec![], scopes: None, token_prefix: None, + mcp_client: None, }, "test-workspace", 3600, diff --git a/backend/windmill-api-jobs/src/execution.rs b/backend/windmill-api-jobs/src/execution.rs index 9a63e392d0..22af9b641b 100644 --- a/backend/windmill-api-jobs/src/execution.rs +++ b/backend/windmill-api-jobs/src/execution.rs @@ -1054,7 +1054,7 @@ pub async fn run_flow<'c>( ( &obo.email, obo.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { @@ -1286,7 +1286,7 @@ pub async fn push_script_job_by_path_into_queue<'c>( ( on_behalf_of.email.as_str(), on_behalf_of.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { diff --git a/backend/windmill-api-settings/src/lib.rs b/backend/windmill-api-settings/src/lib.rs index 7efb0c75da..6ed4e5ae48 100644 --- a/backend/windmill-api-settings/src/lib.rs +++ b/backend/windmill-api-settings/src/lib.rs @@ -1286,6 +1286,10 @@ async fn run_setting_pre_write_hook( windmill_common::global_settings::validate_api_base_url_applies_to(value) .map_err(|e| error::Error::BadRequest(format!("{key}: {e}")))?; } + windmill_common::global_settings::MCP_EXTERNAL_IDP_SETTING => { + windmill_common::global_settings::parse_mcp_external_idp(Some(value)) + .map_err(|e| error::Error::BadRequest(format!("{key}: {e}")))?; + } MAX_TOKEN_EXPIRATION_DAYS_SETTING => { windmill_common::global_settings::parse_max_token_expiration_days(Some(value)) .map_err(|e| { diff --git a/backend/windmill-api-users/src/users.rs b/backend/windmill-api-users/src/users.rs index df59d80ba1..2b1e88292e 100644 --- a/backend/windmill-api-users/src/users.rs +++ b/backend/windmill-api-users/src/users.rs @@ -772,7 +772,8 @@ async fn whoami( authed: ApiAuthed, ) -> JsonResult { let is_guest = windmill_api_auth::scopes::has_guest_sentinel(authed.scopes.as_deref()); - let ApiAuthed { username, email, is_admin, is_operator, groups, folders, .. } = authed; + let ApiAuthed { username, email, is_admin, is_operator, groups, folders, mcp_client, .. } = + authed; // A guest would otherwise fall through to the non-member branch below and be // handed a `superadmin` role. Answer it here, as the operator-shaped identity it is. if is_guest { @@ -804,10 +805,23 @@ async fn whoami( // The frontend gates pages on `operator`, so it reports what `caller_capabilities` // decides rather than the raw column: an admin (or superadmin) whose row still carries // `operator` holds everything. - Ok(Json(UserInfo { - operator: is_operator && !is_admin, - ..user - })) + let user = UserInfo { operator: is_operator && !is_admin, ..user }; + // An external MCP token brings its own groups, which the request and the jobs it starts + // act with, so report those rather than the stored memberships. + if mcp_client.is_some() { + return Ok(Json(UserInfo { + groups, + folders_read: folders.iter().map(|x| x.0.clone()).collect(), + folders_owners: folders + .iter() + .filter(|x| x.2) + .map(|x| x.0.clone()) + .collect(), + folders: folders.into_iter().filter(|x| x.1).map(|x| x.0).collect(), + ..user + })); + } + Ok(Json(user)) } else { Ok(Json(UserInfo { workspace_id: w_id, diff --git a/backend/windmill-api-workspaces/src/workspaces.rs b/backend/windmill-api-workspaces/src/workspaces.rs index 1691e19982..73477f6306 100644 --- a/backend/windmill-api-workspaces/src/workspaces.rs +++ b/backend/windmill-api-workspaces/src/workspaces.rs @@ -14297,6 +14297,7 @@ async fn load_workspace_authed( read_only: base_authed.read_only, job_id: base_authed.job_id, credential_expiry: base_authed.credential_expiry, + mcp_client: base_authed.mcp_client.clone(), }); }; @@ -14337,6 +14338,7 @@ async fn load_workspace_authed( read_only: base_authed.read_only, job_id: base_authed.job_id, credential_expiry: base_authed.credential_expiry, + mcp_client: base_authed.mcp_client.clone(), }) } diff --git a/backend/windmill-api/src/agent_runs.rs b/backend/windmill-api/src/agent_runs.rs index 74f910a5b2..2258a2acd7 100644 --- a/backend/windmill-api/src/agent_runs.rs +++ b/backend/windmill-api/src/agent_runs.rs @@ -81,7 +81,7 @@ pub(crate) async fn run_agent_as( ( &obo.email, obo.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { diff --git a/backend/windmill-api/src/jobs.rs b/backend/windmill-api/src/jobs.rs index 4f1d75c2f7..9e9fdcfaa3 100644 --- a/backend/windmill-api/src/jobs.rs +++ b/backend/windmill-api/src/jobs.rs @@ -7902,7 +7902,7 @@ pub async fn run_workflow_as_code( ( on_behalf_of.email.as_str(), on_behalf_of.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { @@ -8218,7 +8218,7 @@ pub async fn run_wait_result_job_by_path_get( ( on_behalf_of.email.as_str(), on_behalf_of.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { @@ -8369,7 +8369,7 @@ pub async fn run_wait_result_script_by_path_internal( ( on_behalf_of.email.as_str(), on_behalf_of.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { @@ -8488,7 +8488,7 @@ pub async fn run_wait_result_script_by_hash( ( &obo.email, obo.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { @@ -9126,7 +9126,7 @@ fn preview_push_identity( Some(obo) => ( obo.email.clone(), obo.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ), None => ( @@ -10824,7 +10824,7 @@ pub async fn run_job_by_hash_inner( ( &obo.email, obo.permissioned_as.clone(), - None, + authed.mcp_client.is_some().then(|| authed.clone().into()), PushIsolationLevel::IsolatedRoot(db.clone()), ) } else { @@ -12856,6 +12856,7 @@ mod approval_view_gate_tests { read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index 446a585d35..9ebae40228 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -395,6 +395,7 @@ async fn inject_agent_authed( read_only: false, job_id: None, credential_expiry: None, + mcp_client: None, }, job_id: None, }); @@ -585,15 +586,19 @@ pub async fn run_server( ) .await?; // Workspace-scoped MCP router + let external_idp_auth = + || axum::middleware::from_fn(mcp::external_idp::external_idp_auth); let workspaced_mcp_router = mcp_router .clone() .route_layer(from_extractor::()) + .layer(external_idp_auth()) .layer(axum::middleware::from_fn(reject_token_query_param)) .layer(axum::middleware::from_fn(add_www_authenticate_header)) .layer(axum::middleware::from_fn(extract_and_store_workspace_id)); // Gateway MCP router β€” resolves workspace from token let gateway_mcp_router = mcp_router .route_layer(from_extractor::()) + .layer(external_idp_auth()) .layer(axum::middleware::from_fn(extract_workspace_from_token)) .layer(axum::middleware::from_fn(reject_token_query_param)) .layer(axum::middleware::from_fn( @@ -602,6 +607,7 @@ pub async fn run_server( // The workspace server. Its tools name their workspace; the token bounds which. let gateway_session_router = session_router .route_layer(from_extractor::()) + .layer(external_idp_auth()) .layer(axum::middleware::from_fn(extract_workspace_from_token)) .layer(axum::middleware::from_fn(reject_token_query_param)) .layer(axum::middleware::from_fn( diff --git a/backend/windmill-api/src/mcp/core.rs b/backend/windmill-api/src/mcp/core.rs index 8124b6d2bb..32bfe1d26a 100644 --- a/backend/windmill-api/src/mcp/core.rs +++ b/backend/windmill-api/src/mcp/core.rs @@ -108,6 +108,16 @@ impl WindmillBackend { impl McpBackend for WindmillBackend { type Auth = ApiAuthed; + async fn after_tool_call( + &self, + auth: &ApiAuthed, + workspace_id: &str, + tool: &str, + refusal: Option<&str>, + ) { + super::external_idp::audit_tool_call(&self.db, auth, workspace_id, tool, refusal).await; + } + async fn list_scripts( &self, auth: &ApiAuthed, @@ -540,9 +550,14 @@ pub async fn extract_and_store_workspace_id( /// a client requests: without it, Claude requests every scope the metadata lists, read-only /// included, and the consent page would then default to read-only access. fn www_authenticate_value(base_url: &str, endpoint: &str) -> String { + let scope = if super::external_idp::configured().is_some() { + super::external_idp::REQUESTED_SCOPES + } else { + "mcp:all" + }; format!( "Bearer resource_metadata=\"{base_url}/.well-known/oauth-protected-resource{endpoint}\", \ - scope=\"mcp:all\"" + scope=\"{scope}\"" ) } diff --git a/backend/windmill-api/src/mcp/external_idp.rs b/backend/windmill-api/src/mcp/external_idp.rs new file mode 100644 index 0000000000..4381e452a2 --- /dev/null +++ b/backend/windmill-api/src/mcp/external_idp.rs @@ -0,0 +1,540 @@ +//! MCP access with an access token issued by an external OIDC provider (`mcp_external_idp`). +//! +//! The token names an OAuth client of that provider and the user who signed in through it. +//! The client is mapped to a workspace and a selection of tools; the request then runs as the +//! user's own Windmill account limited to that selection, so a tool is offered only when the +//! client has it and the user can see it. Windmill-issued tokens never reach this path: it is +//! taken only for a JWT whose `iss` is the configured issuer. + +use std::{ + collections::HashMap, + sync::Arc, + time::{Duration, Instant}, +}; + +use axum::{ + extract::Request, + middleware::Next, + response::{IntoResponse, Response}, + Extension, +}; +use base64::Engine; +use http::StatusCode; +use jsonwebtoken::{jwk::JwkSet, DecodingKey, Validation}; +use serde_json::Value; +use windmill_api_auth::{ApiAuthed, OptJobAuthed}; +use windmill_audit::{audit_oss::audit_log, ActionKind}; +use windmill_common::{ + audit::AuditAuthor, + db::{GatewayWorkspaceId, DB}, + global_settings::{client_access, McpExternalIdp}, + utils::HTTP_CLIENT, +}; +use windmill_mcp::server::NoEndpointTools; +use windmill_mcp::WorkspaceId; + +use super::core::McpSelection; + +/// What an MCP client is told to request from the external issuer: standard OIDC scopes, +/// which every provider knows, and which carry the user's email. +pub const REQUESTED_SCOPES: &str = "openid profile email"; + +/// The issuer configuration when external tokens are on: EE only. +pub fn configured() -> Option> { + #[cfg(feature = "enterprise")] + { + windmill_common::global_settings::MCP_EXTERNAL_IDP.load_full() + } + #[cfg(not(feature = "enterprise"))] + { + None + } +} + +struct Jwks { + issuer: String, + keys: JwkSet, + fetched_at: Instant, +} + +/// A token resolved to its Windmill identity, kept until it expires or for a minute at most, +/// so a user's group changes and a removed client still take effect without a new sign-in. +#[derive(Clone)] +struct Resolved { + authed: ApiAuthed, + workspace_id: String, + until: Instant, +} + +const RESOLVED_TTL: Duration = Duration::from_secs(60); +/// Keys are fetched again for an unknown `kid` (a rotation), but not more often than this. +const JWKS_REFRESH_MIN_INTERVAL: Duration = Duration::from_secs(30); +/// A key the issuer withdrew stops verifying tokens at most this long after. +const JWKS_MAX_AGE: Duration = Duration::from_secs(600); + +lazy_static::lazy_static! { + static ref JWKS: tokio::sync::RwLock> = tokio::sync::RwLock::new(None); + static ref RESOLVED: quick_cache::sync::Cache = + quick_cache::sync::Cache::new(1000); +} + +/// The `iss` of a JWT, read without verifying it: only used to pick the verification path. +fn unverified_issuer(token: &str) -> Option { + let payload = token.split('.').nth(1)?; + let bytes = base64::engine::general_purpose::URL_SAFE_NO_PAD + .decode(payload.trim_end_matches('=')) + .ok()?; + serde_json::from_slice::(&bytes) + .ok()? + .get("iss")? + .as_str() + .map(str::to_string) +} + +async fn fetch_jwks(issuer: &str) -> anyhow::Result { + let discovery: Value = HTTP_CLIENT + .get(format!( + "{}/.well-known/openid-configuration", + issuer.trim_end_matches('/') + )) + .send() + .await? + .error_for_status()? + .json() + .await?; + let jwks_uri = discovery + .get("jwks_uri") + .and_then(Value::as_str) + .ok_or_else(|| anyhow::anyhow!("discovery document of {issuer} has no jwks_uri"))?; + Ok(HTTP_CLIENT + .get(jwks_uri) + .send() + .await? + .error_for_status()? + .json() + .await?) +} + +async fn decoding_key( + issuer: &str, + kid: &str, + header_alg: jsonwebtoken::Algorithm, +) -> anyhow::Result<(DecodingKey, jsonwebtoken::Algorithm)> { + let find = |jwks: &Option| { + jwks.as_ref() + .filter(|j| j.issuer == issuer && j.fetched_at.elapsed() < JWKS_MAX_AGE) + .and_then(|j| j.keys.find(kid).cloned()) + }; + let mut jwk = find(&*JWKS.read().await); + if jwk.is_none() { + let mut guard = JWKS.write().await; + jwk = find(&*guard); + let stale = guard.as_ref().is_none_or(|j| { + j.issuer != issuer || j.fetched_at.elapsed() > JWKS_REFRESH_MIN_INTERVAL + }); + if jwk.is_none() && stale { + *guard = Some(Jwks { + issuer: issuer.to_string(), + keys: fetch_jwks(issuer).await?, + fetched_at: Instant::now(), + }); + jwk = find(&*guard); + } + } + let jwk = jwk.ok_or_else(|| anyhow::anyhow!("no key {kid} at {issuer}"))?; + // Some issuers (Entra) publish keys without `alg`: the token's own header then names it, + // but never an HMAC one, whose "key" would be the public JWK itself. + use jsonwebtoken::Algorithm::{HS256, HS384, HS512}; + let alg = windmill_common::jwt::jwk_algorithm(&jwk) + .or(Some(header_alg).filter(|a| !matches!(a, HS256 | HS384 | HS512))) + .ok_or_else(|| anyhow::anyhow!("key {kid} names no signing algorithm"))?; + Ok((DecodingKey::from_jwk(&jwk)?, alg)) +} + +async fn verify(idp: &McpExternalIdp, token: &str) -> anyhow::Result<(Value, u64)> { + let header = jsonwebtoken::decode_header(token)?; + let kid = header + .kid + .clone() + .ok_or_else(|| anyhow::anyhow!("token has no kid"))?; + let (key, alg) = decoding_key(&idp.issuer, &kid, header.alg).await?; + let mut validation = Validation::new(alg); + validation.set_issuer(&[&idp.issuer]); + validation.validate_nbf = true; + match &idp.audience { + Some(aud) => validation.set_audience(&[aud]), + None => validation.validate_aud = false, + } + let claims = jsonwebtoken::decode::(token, &key, &validation)?.claims; + // Without an audience to check, an ID token of the same client would pass for an access + // token: the token must then name itself one (RFC 9068 `at+jwt`, or Keycloak's `Bearer`). + if claims.get("typ").and_then(Value::as_str) == Some("ID") { + anyhow::bail!("an ID token is not an access token"); + } + if idp.audience.is_none() { + let header_typ = header.typ.as_deref().unwrap_or_default(); + let claim_typ = claims + .get("typ") + .and_then(Value::as_str) + .unwrap_or_default(); + if !header_typ.eq_ignore_ascii_case("at+jwt") && !claim_typ.eq_ignore_ascii_case("Bearer") { + anyhow::bail!("not marked as an access token; configure an audience to accept it"); + } + } + let exp = claims.get("exp").and_then(Value::as_u64).unwrap_or(0); + Ok((claims, exp)) +} + +/// Why a verified token was not served. Answered with 403, not 401: signing in again with +/// the same client and account would not change the answer. +struct Refusal { + client: Option, + email: Option, + workspace_id: Option, + reason: String, +} + +fn claim_str(claims: &Value, name: &str) -> Option { + claims + .get(name) + .and_then(Value::as_str) + .map(str::trim) + .filter(|s| !s.is_empty()) + .map(str::to_string) +} + +async fn resolve( + db: &DB, + idp: &McpExternalIdp, + claims: &Value, + url_workspace: Option<&str>, +) -> Result<(ApiAuthed, String), Refusal> { + let client_id = claim_str(claims, &idp.client_claim); + let email = claim_str(claims, &idp.email_claim) + .map(|e| windmill_common::oauth2::normalize_external_email(&e)); + let refuse = |workspace_id: Option<&str>, reason: String| Refusal { + client: client_id.clone(), + email: email.clone(), + workspace_id: workspace_id.map(str::to_string), + reason, + }; + + let client = client_id + .as_deref() + .and_then(|id| idp.client(id)) + .ok_or_else(|| { + refuse( + url_workspace, + format!( + "OAuth client {} is not configured for MCP access", + client_id.as_deref().unwrap_or("(none)") + ), + ) + })?; + let w_id = client.workspace_id.as_str(); + if url_workspace.is_some_and(|w| w != w_id) { + return Err(refuse( + url_workspace, + format!( + "OAuth client {} serves workspace {w_id} only", + client.client_id + ), + )); + } + // A client-credentials token carries the client alone. A client acts only for a user, + // within that user's own rights. + let email = email.clone().ok_or_else(|| { + refuse( + Some(w_id), + format!( + "the token carries no `{}` claim: a client can only act for a signed-in user", + idp.email_claim + ), + ) + })?; + // Some issuers send the flag as a string. + let unverified = match claims.get("email_verified") { + Some(Value::Bool(b)) => !b, + Some(Value::String(s)) => s.eq_ignore_ascii_case("false"), + _ => false, + }; + if unverified { + return Err(refuse( + Some(w_id), + format!("{email} is not verified at the issuer"), + )); + } + + // Instance deactivation sets `password.disabled` and revokes Windmill's own tokens; this + // path has none to revoke, so it reads the flag itself. + let deactivated: Option = + sqlx::query_scalar("SELECT disabled FROM password WHERE email = $1") + .bind(&email) + .fetch_optional(db) + .await + .map_err(|e| refuse(Some(w_id), e.to_string()))?; + if deactivated == Some(true) { + return Err(refuse(Some(w_id), format!("{email} is deactivated"))); + } + + let username = sqlx::query_scalar!( + "SELECT username FROM usr WHERE workspace_id = $1 AND email = $2 AND NOT disabled", + w_id, + &email + ) + .fetch_optional(db) + .await + .map_err(|e| refuse(Some(w_id), e.to_string()))? + .ok_or_else(|| { + refuse( + Some(w_id), + format!( + "{email} is not a member of workspace {w_id}. Users must sign in to Windmill once \ + before using an MCP client" + ), + ) + })?; + + let mut authed: ApiAuthed = windmill_common::auth::fetch_authed_from_permissioned_as( + &format!("u/{username}"), + &email, + w_id, + db, + ) + .await + .map_err(|e| refuse(Some(w_id), e.to_string()))? + .into(); + // The groups the IdP manages come from the token alone, for this request only: one the + // token no longer lists, or an absent claim, stops granting at once, and nothing is stored. + if let Some(idp_groups) = token_groups(db, claims) + .await + .map_err(|e| refuse(Some(w_id), e))? + { + let err = |e: sqlx::Error| refuse(Some(w_id), e.to_string()); + // Workspace groups and unmanaged instance groups as stored, by source rather than by + // name: a workspace group may share its name with a managed instance group. + let mut groups: Vec = sqlx::query_scalar( + "SELECT group_ FROM usr_to_group WHERE usr = $1 AND workspace_id = $2 \ + UNION ALL SELECT igroup FROM email_to_igroup JOIN instance_group ON name = igroup \ + WHERE email = $3 AND external_id IS NULL", + ) + .bind(&authed.username) + .bind(w_id) + .bind(&email) + .fetch_all(db) + .await + .map_err(err)?; + groups.extend(idp_groups); + authed.folders = + windmill_common::auth::get_folders_for_user(w_id, &authed.username, &groups, db) + .await + .map_err(|e| refuse(Some(w_id), e.to_string()))?; + authed.groups = groups; + } + let mut scopes = client.scopes.clone(); + // Every MCP URL then serves the session's toolset, as for a Windmill token approved with + // an access level, rather than the tools server with its endpoint tools. + if client_access(&scopes) == Ok(true) && !scopes.iter().any(|s| s == "mcp:session") { + scopes.push("mcp:session".to_string()); + } + authed.scopes = Some(scopes); + authed.mcp_client = Some(client.client_id.clone()); + Ok((authed, w_id.to_string())) +} + +/// The instance groups the token's groups claim maps to through their `external_id`, or +/// `None` when `sso_groups_claim` is unset and the stored memberships apply alone. +#[cfg(all(feature = "enterprise", feature = "private", feature = "oauth2"))] +async fn token_groups(db: &DB, claims: &Value) -> Result>, String> { + let Some(claim) = crate::oauth2_ee::sso_groups_claim(db) + .await + .map_err(|e| e.to_string())? + else { + return Ok(None); + }; + let values: Vec = match claims.get(&claim) { + Some(Value::Array(v)) => v + .iter() + .filter_map(|x| x.as_str().map(str::to_string)) + .collect(), + Some(Value::String(s)) => vec![s.clone()], + // Entra leaves out a list too long for the token and points to it here: reading that + // as "no groups" would silently strip the user's rights. + None if claims + .get("_claim_names") + .and_then(|c| c.get(&claim)) + .is_some() => + { + return Err(format!( + "the token's `{claim}` claim was left out for listing too many groups: \ + limit it to the groups assigned to the client" + )); + } + _ => vec![], + }; + let values = crate::scim_ee::with_ancestor_paths(crate::scim_ee::usable_claim_values(&values)); + sqlx::query_scalar("SELECT name FROM instance_group WHERE external_id = ANY($1)") + .bind(&values) + .fetch_all(db) + .await + .map(Some) + .map_err(|e| e.to_string()) +} + +#[cfg(not(all(feature = "enterprise", feature = "private", feature = "oauth2")))] +async fn token_groups(_db: &DB, _claims: &Value) -> Result>, String> { + Ok(None) +} + +async fn audit_refusal(db: &DB, refusal: &Refusal) { + let email = refusal.email.clone().unwrap_or_default(); + let author = + AuditAuthor { username: email.clone(), email, username_override: None, token_prefix: None }; + let client = refusal.client.clone().unwrap_or_default(); + let params = HashMap::from([ + ("mcp_client", client.as_str()), + ("outcome", "refused"), + ("reason", refusal.reason.as_str()), + ]); + if let Err(e) = audit_log( + db, + &author, + "mcp.external_token", + ActionKind::Execute, + refusal.workspace_id.as_deref().unwrap_or("global"), + Some(&client), + Some(params), + ) + .await + { + tracing::error!("Could not audit a refused MCP token: {e:#}"); + } +} + +/// Records a tool call made through an external client, allowed or refused, with both +/// identities: the user as author, the client in the parameters. +pub async fn audit_tool_call( + db: &DB, + authed: &ApiAuthed, + w_id: &str, + tool: &str, + refusal: Option<&str>, +) { + let Some(client) = authed.mcp_client.as_deref() else { + return; + }; + let outcome = if refusal.is_some() { "refused" } else { "ok" }; + windmill_common::feature_usage::log_feature_usage("mcp_external_client", "tool_call", outcome); + let mut params = HashMap::from([("mcp_client", client), ("outcome", outcome)]); + if let Some(reason) = refusal { + params.insert("reason", reason); + } + if let Err(e) = audit_log( + db, + authed, + "mcp.tool_call", + ActionKind::Execute, + w_id, + Some(tool), + Some(params), + ) + .await + { + tracing::error!("Could not audit an MCP tool call: {e:#}"); + } +} + +fn bearer(request: &Request) -> Option<&str> { + request + .headers() + .get(http::header::AUTHORIZATION)? + .to_str() + .ok()? + .strip_prefix("Bearer ") +} + +/// Authenticates a request carrying a token of the configured issuer, ahead of the usual +/// token lookup, and binds it to its client's workspace as a workspace-bound selection token +/// is. Every other request passes through untouched. +pub async fn external_idp_auth( + Extension(db): Extension, + mut request: Request, + next: Next, +) -> Response { + let Some(idp) = configured() else { + return next.run(request).await; + }; + let Some(token) = bearer(&request).map(str::to_string) else { + return next.run(request).await; + }; + if unverified_issuer(&token).as_deref() != Some(idp.issuer.as_str()) { + return next.run(request).await; + } + let url_workspace = request + .extensions() + .get::() + .map(|w| w.0.clone()); + + let cache_key = windmill_common::auth::hash_token(&token); + let resolved = match RESOLVED + .get(&cache_key) + .filter(|r| r.until > Instant::now()) + { + Some(r) => r, + None => { + let (claims, exp) = match verify(&idp, &token).await { + Ok(v) => v, + Err(e) => { + tracing::debug!("External MCP token refused: {e:#}"); + return (StatusCode::UNAUTHORIZED, "Invalid or expired access token") + .into_response(); + } + }; + match resolve(&db, &idp, &claims, url_workspace.as_deref()).await { + Ok((authed, workspace_id)) => { + let exp = std::time::UNIX_EPOCH + Duration::from_secs(exp); + let left = exp + .duration_since(std::time::SystemTime::now()) + .unwrap_or_default(); + let r = Resolved { + authed, + workspace_id, + until: Instant::now() + left.min(RESOLVED_TTL), + }; + RESOLVED.insert(cache_key, r.clone()); + r + } + Err(refusal) => { + audit_refusal(&db, &refusal).await; + return (StatusCode::FORBIDDEN, refusal.reason).into_response(); + } + } + } + }; + if url_workspace + .as_deref() + .is_some_and(|w| w != resolved.workspace_id) + { + return ( + StatusCode::FORBIDDEN, + format!( + "This OAuth client serves workspace {} only", + resolved.workspace_id + ), + ) + .into_response(); + } + + let extensions = request.extensions_mut(); + let selection = + client_access(resolved.authed.scopes.as_deref().unwrap_or_default()) != Ok(true); + extensions.insert(OptJobAuthed { job_id: None, authed: resolved.authed.clone() }); + extensions.insert(resolved.authed); + extensions.insert(GatewayWorkspaceId(resolved.workspace_id.clone())); + extensions.insert(WorkspaceId(resolved.workspace_id)); + if selection { + extensions.insert(McpSelection); + extensions.insert(NoEndpointTools); + } + next.run(request).await +} diff --git a/backend/windmill-api/src/mcp/mod.rs b/backend/windmill-api/src/mcp/mod.rs index 20c5532b29..05449d1b93 100644 --- a/backend/windmill-api/src/mcp/mod.rs +++ b/backend/windmill-api/src/mcp/mod.rs @@ -5,6 +5,7 @@ mod auto_generated_endpoints; mod core; +pub mod external_idp; mod session; mod utils; diff --git a/backend/windmill-api/src/mcp/oauth_server.rs b/backend/windmill-api/src/mcp/oauth_server.rs index 9598ca907b..b7a7a06a47 100644 --- a/backend/windmill-api/src/mcp/oauth_server.rs +++ b/backend/windmill-api/src/mcp/oauth_server.rs @@ -276,10 +276,22 @@ fn build_protected_resource_metadata( oauth_prefix: &str, base_url: &str, ) -> ProtectedResourceMetadata { + // With an external issuer configured, clients sign in there: Windmill's own server keeps + // honouring the tokens it issued, but no longer hands out new ones to MCP clients. + let (authorization_server, scopes) = match super::external_idp::configured() { + Some(idp) => ( + idp.issuer.clone(), + super::external_idp::REQUESTED_SCOPES + .split(' ') + .map(str::to_string) + .collect(), + ), + None => (format!("{}{}", base_url, oauth_prefix), granting_scopes()), + }; ProtectedResourceMetadata { resource: format!("{}{}", base_url, resource_path), - authorization_servers: vec![format!("{}{}", base_url, oauth_prefix)], - scopes_supported: Some(granting_scopes()), + authorization_servers: vec![authorization_server], + scopes_supported: Some(scopes), bearer_methods_supported: Some(vec!["header".to_string()]), } } diff --git a/backend/windmill-api/src/mcp/utils.rs b/backend/windmill-api/src/mcp/utils.rs index 6e125eefc6..9decf6993b 100644 --- a/backend/windmill-api/src/mcp/utils.rs +++ b/backend/windmill-api/src/mcp/utils.rs @@ -1489,6 +1489,7 @@ mod tests { read_only: false, job_id, credential_expiry: None, + mcp_client: None, } } diff --git a/backend/windmill-common/src/auth.rs b/backend/windmill-common/src/auth.rs index 78d3b98c48..d2641b5e78 100644 --- a/backend/windmill-common/src/auth.rs +++ b/backend/windmill-common/src/auth.rs @@ -324,6 +324,10 @@ pub struct JWTAuthClaims { pub job_id: Option, pub scopes: Option>, pub audit_span: Option, + /// [`Authed::mcp_client`], so a request the caller's tools make on its behalf still + /// records the client on the runs it starts. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mcp_client: Option, } impl JWTAuthClaims { @@ -370,6 +374,9 @@ pub struct JobPerms { /// role, and the object storage advanced permission rules it is checked against. #[serde(default)] pub viewer_data_access: bool, + /// The OAuth client of an external issuer the root run was started through. + #[serde(default)] + pub mcp_client: Option, } impl From for Authed { @@ -387,6 +394,7 @@ impl From for Authed { .collect(), scopes: None, token_prefix: None, + mcp_client: value.mcp_client, } } } @@ -579,6 +587,7 @@ async fn fetch_authed_from_permissioned_as_inner( folders, scopes: None, token_prefix: None, + mcp_client: None, }) } else { let groups = vec![name.to_string()]; @@ -592,6 +601,7 @@ async fn fetch_authed_from_permissioned_as_inner( folders, scopes: None, token_prefix: None, + mcp_client: None, }) } } else { @@ -613,6 +623,7 @@ async fn fetch_authed_from_permissioned_as_inner( folders: vec![], scopes: None, token_prefix: None, + mcp_client: None, }) } } @@ -670,7 +681,7 @@ pub async fn get_job_perms<'a, E: sqlx::PgExecutor<'a>>( sqlx::query_as!( JobPerms, "SELECT email, username, is_admin, is_operator, groups, folders, end_user_email, - job_token_scopes, viewer_data_access + job_token_scopes, viewer_data_access, mcp_client FROM job_perms WHERE job_id = $1 AND workspace_id = $2", job_id, w_id @@ -824,6 +835,7 @@ pub async fn create_jwt_token( job_id: job_id.map(|id| id.to_string()), scopes, audit_span, + mcp_client: authed.mcp_client.clone(), }; let token = jwt::encode_with_internal_secret(&payload) @@ -962,6 +974,7 @@ mod tests { job_id: None, scopes: None, audit_span: None, + mcp_client: None, }; // Signature is irrelevant β€” the gate decodes without verifying β€” so any key works. let token = jsonwebtoken::encode( diff --git a/backend/windmill-common/src/db.rs b/backend/windmill-common/src/db.rs index dc22b37157..edda7fca07 100644 --- a/backend/windmill-common/src/db.rs +++ b/backend/windmill-common/src/db.rs @@ -20,6 +20,8 @@ pub struct Authed { pub folders: Vec<(String, bool, bool)>, pub scopes: Option>, pub token_prefix: Option, + /// See `ApiAuthed::mcp_client`. + pub mcp_client: Option, } impl Authed { diff --git a/backend/windmill-common/src/global_settings.rs b/backend/windmill-common/src/global_settings.rs index 371eff43dd..2e4e3788ab 100644 --- a/backend/windmill-common/src/global_settings.rs +++ b/backend/windmill-common/src/global_settings.rs @@ -113,6 +113,9 @@ pub const DISABLE_PASSWORD_LOGIN_SETTING: &str = "disable_password_login"; /// in. A URL-borne credential ends up in browser history, proxy logs and referrers, so an /// instance that cares sends MCP clients through the OAuth flow instead. pub const MCP_DISABLE_TOKEN_QUERY_PARAM_SETTING: &str = "mcp_disable_token_query_param"; +/// An external OIDC issuer whose access tokens the MCP endpoints accept, and the OAuth clients +/// of that issuer they serve. Read and validated by [`parse_mcp_external_idp`]. +pub const MCP_EXTERNAL_IDP_SETTING: &str = "mcp_external_idp"; /// Ceiling, in days, on how far ahead a token minted through `POST /users/tokens/create` or /// `POST /users/tokens/impersonate` may expire; a request asking for more, or for no /// expiration at all, is shortened to it rather than refused. On those routes only: server-side @@ -546,6 +549,9 @@ lazy_static::lazy_static! { pub static ref HTTP_ROUTE_WORKSPACED_ROUTE: AtomicBool = AtomicBool::new(false); pub static ref DISABLE_PASSWORD_LOGIN: AtomicBool = AtomicBool::new(false); pub static ref MCP_DISABLE_TOKEN_QUERY_PARAM: AtomicBool = AtomicBool::new(false); + /// `None` when [`MCP_EXTERNAL_IDP_SETTING`] is unset or has no issuer. + pub static ref MCP_EXTERNAL_IDP: arc_swap::ArcSwapOption = + arc_swap::ArcSwapOption::empty(); /// Empty means unset. See [`API_BASE_URL_SETTING`]. pub static ref API_BASE_URL: arc_swap::ArcSwap = arc_swap::ArcSwap::from_pointee(String::new()); @@ -557,6 +563,129 @@ lazy_static::lazy_static! { arc_swap::ArcSwap::from_pointee(vec![]); } +/// [`MCP_EXTERNAL_IDP_SETTING`]: the MCP endpoints accept an access token signed by `issuer` +/// when its `client_claim` names one of `clients`, acting as the Windmill user whose email is +/// in `email_claim`, limited to that client's selection in that client's workspace. +#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct McpExternalIdp { + pub issuer: String, + /// Checked against the token's `aud` when set. Many issuers stamp an audience the + /// resource server cannot choose, so it is optional. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub audience: Option, + #[serde(default = "default_mcp_client_claim")] + pub client_claim: String, + #[serde(default = "default_mcp_email_claim")] + pub email_claim: String, + #[serde(default)] + pub clients: Vec, +} + +#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)] +pub struct McpExternalClient { + pub client_id: String, + pub workspace_id: String, + /// Selection scopes, as a token scoped to runnables-as-tools carries them. + pub scopes: Vec, +} + +fn default_mcp_client_claim() -> String { + "azp".to_string() +} + +fn default_mcp_email_claim() -> String { + "email".to_string() +} + +impl McpExternalIdp { + pub fn client(&self, client_id: &str) -> Option<&McpExternalClient> { + self.clients.iter().find(|c| c.client_id == client_id) + } +} + +/// Reads [`MCP_EXTERNAL_IDP_SETTING`]; `None` when unset. A client may only be given +/// individual tools: `mcp:all` would hand it the whole session toolset and endpoint scopes +/// the raw API, neither of which the user's own grant to the client is meant to cover. +pub fn parse_mcp_external_idp( + value: Option<&serde_json::Value>, +) -> Result, String> { + let value = match value { + None | Some(serde_json::Value::Null) => return Ok(None), + Some(v) => v, + }; + let idp: McpExternalIdp = serde_json::from_value(value.clone()).map_err(|e| e.to_string())?; + if idp.issuer.trim().is_empty() { + return if idp.clients.is_empty() { + Ok(None) + } else { + Err("clients need an issuer".to_string()) + }; + } + // Its keys are fetched from it: over plain http anyone on the path could forge tokens. + let url = url::Url::parse(&idp.issuer).map_err(|e| format!("issuer: {e}"))?; + let local = matches!(url.host_str(), Some("localhost" | "127.0.0.1")); + if !(url.scheme() == "https" || url.scheme() == "http" && local) { + return Err("issuer must be an https URL".to_string()); + } + if idp.client_claim.trim().is_empty() || idp.email_claim.trim().is_empty() { + return Err("claim names must not be empty".to_string()); + } + for (i, client) in idp.clients.iter().enumerate() { + if client.client_id.trim().is_empty() || client.workspace_id.trim().is_empty() { + return Err("every client needs a client id and a workspace".to_string()); + } + // Recorded on every run it starts, in a VARCHAR(255) column. + if client.client_id.len() > 255 { + return Err(format!("client id {} is too long", client.client_id)); + } + if idp.clients[..i] + .iter() + .any(|c| c.client_id == client.client_id) + { + return Err(format!("client {} is listed twice", client.client_id)); + } + client_access(&client.scopes).map_err(|e| format!("client {}: {e}", client.client_id))?; + } + Ok(Some(idp)) +} + +/// Whether an external MCP client's scopes give the AI session's toolset (`mcp:all`, alone or +/// narrowed by `mcp:read_only` / `mcp:read_run`) rather than a selection of scripts, flows and +/// hub scripts. Endpoint scopes, path-narrowed `mcp:all` and `mcp:workspaces:` are refused: +/// a client reaches its one workspace, and only through these two shapes. +pub fn client_access(scopes: &[String]) -> Result { + // Markers the token form adds; they grant nothing. + let scopes: Vec<&str> = scopes + .iter() + .map(String::as_str) + .filter(|s| !["mcp:runnables_as_tools", "mcp:session"].contains(s)) + .collect(); + if scopes.contains(&"mcp:all") { + let narrowed: Vec<&str> = scopes.iter().copied().filter(|s| *s != "mcp:all").collect(); + return match narrowed.as_slice() { + [] | ["mcp:read_only"] | ["mcp:read_run"] => Ok(true), + other => Err(format!( + "mcp:all takes at most one of mcp:read_only and mcp:read_run, not {}", + other.join(" ") + )), + }; + } + if scopes.is_empty() { + return Err("selects no tools".to_string()); + } + if let Some(scope) = scopes.iter().find(|s| { + !(**s == "mcp:favorites" + || ["mcp:scripts:", "mcp:flows:", "mcp:hub:"] + .iter() + .any(|p| s.strip_prefix(p).is_some_and(|rest| !rest.is_empty()))) + }) { + return Err(format!( + "{scope} is not an access level nor a selection of scripts, flows or hub scripts" + )); + } + Ok(false) +} + /// [`API_BASE_URL_SETTING`] when it applies to MCP, else `base_url`. The MCP gateway builds every URL it hands a /// client to call from it: its resource identifier, the authorization server it names, and /// that server's issuer, token and registration endpoints. Not the authorization endpoint: @@ -1026,6 +1155,47 @@ mod tests { assert!(validate_api_base_url_applies_to(&json!("mcp")).is_err()); } + #[test] + fn mcp_external_clients_get_an_access_level_or_a_selection() { + let with_scopes = |scopes: &[&str]| { + parse_mcp_external_idp(Some(&serde_json::json!({ + "issuer": "https://idp.example.com/realms/main", + "clients": [{ "client_id": "a", "workspace_id": "w", "scopes": scopes }] + }))) + }; + let idp = with_scopes(&["mcp:flows:f/x/run", "mcp:scripts:f/x/*", "mcp:favorites"]) + .unwrap() + .unwrap(); + assert_eq!( + (idp.client_claim.as_str(), idp.email_claim.as_str()), + ("azp", "email") + ); + for (scopes, session) in [ + (&["mcp:all"][..], true), + (&["mcp:all", "mcp:read_run", "mcp:session"], true), + (&["mcp:favorites", "mcp:runnables_as_tools"], false), + ] { + let scopes: Vec = scopes.iter().map(|s| s.to_string()).collect(); + assert_eq!(client_access(&scopes), Ok(session), "{scopes:?}"); + } + for refused in [ + &["mcp:all", "mcp:read_only", "mcp:read_run"][..], + &["mcp:all", "mcp:scripts:f/x/run"], + &["mcp:all", "mcp:workspaces:a,b"], + &["mcp:all:f/x/*"], + &["mcp:endpoints:listJobs"], + &["mcp:scripts:"], + &[], + ] { + assert!(with_scopes(refused).is_err(), "{refused:?}"); + } + assert_eq!(parse_mcp_external_idp(None), Ok(None)); + assert_eq!( + parse_mcp_external_idp(Some(&serde_json::json!({"issuer": ""}))), + Ok(None) + ); + } + // `frontend/src/lib/tokenExpiration.test.ts` holds the same table for the token form's // parser; the two must stay in step. #[test] diff --git a/backend/windmill-common/src/instance_config.rs b/backend/windmill-common/src/instance_config.rs index 3fe79417ee..bd5767b786 100644 --- a/backend/windmill-common/src/instance_config.rs +++ b/backend/windmill-common/src/instance_config.rs @@ -1591,6 +1591,10 @@ pub async fn sync_global_settings_declarative( crate::global_settings::parse_max_token_expiration_days(desired.get(max_expiration_key)) .map_err(|e| anyhow::anyhow!("{max_expiration_key}: {e}"))?; + let idp_key = crate::global_settings::MCP_EXTERNAL_IDP_SETTING; + crate::global_settings::parse_mcp_external_idp(desired.get(idp_key)) + .map_err(|e| anyhow::anyhow!("{idp_key}: {e}"))?; + let mut diff = diff_global_settings(current, desired, ApplyMode::Replace); let roles_key = crate::global_settings::WORKSPACE_ROLES_SETTING; let roles_written = diff.upserts.iter().any(|(k, _)| k == roles_key) diff --git a/backend/windmill-common/src/worker.rs b/backend/windmill-common/src/worker.rs index e6a44054d9..2f18ed262c 100644 --- a/backend/windmill-common/src/worker.rs +++ b/backend/windmill-common/src/worker.rs @@ -825,7 +825,7 @@ fn format_pull_query(peek: String) -> String { j.script_entrypoint_override, j.preprocessed, p.job_token_scopes, COALESCE(pj.runnable_path, j.args->>'_FLOW_PATH') as parent_runnable_path, COALESCE(p.email, j.permissioned_as_email) as permissioned_as_email, p.username as permissioned_as_username, p.is_admin as permissioned_as_is_admin, p.is_operator as permissioned_as_is_operator, p.groups as permissioned_as_groups, p.folders as permissioned_as_folders, p.end_user_email as permissioned_as_end_user_email, - p.viewer_data_access + p.viewer_data_access, p.mcp_client FROM q, j LEFT JOIN v2_job_status f USING (id) LEFT JOIN job_perms p ON p.job_id = j.id diff --git a/backend/windmill-mcp/src/server/backend.rs b/backend/windmill-mcp/src/server/backend.rs index 9a305843d2..76613525db 100644 --- a/backend/windmill-mcp/src/server/backend.rs +++ b/backend/windmill-mcp/src/server/backend.rs @@ -97,6 +97,17 @@ pub trait McpBackend: Send + Sync + Clone + 'static { /// The authentication context type type Auth: McpAuth; + /// Called once a tool call in a workspace has an outcome: `refusal` is the error the + /// caller receives, `None` when it succeeded. + async fn after_tool_call( + &self, + _auth: &Self::Auth, + _workspace_id: &str, + _tool: &str, + _refusal: Option<&str>, + ) { + } + // ───────────────────────────────────────────────────────────────── // Listing Operations // ───────────────────────────────────────────────────────────────── diff --git a/backend/windmill-mcp/src/server/runner.rs b/backend/windmill-mcp/src/server/runner.rs index e2ce8b6c04..6e18f36c7b 100644 --- a/backend/windmill-mcp/src/server/runner.rs +++ b/backend/windmill-mcp/src/server/runner.rs @@ -637,16 +637,22 @@ impl ServerHandler for Runner { // client for input, so the MRTR variants of `CallToolResponse` are never built. let result = match mode { McpMode::Single(workspace_id) => { - self.call_tool_single( - &auth, - &workspace_id, - &scope_config, - read_only, - request.name.clone(), - args, - &mcp_request, - ) - .await + let result = self + .call_tool_single( + &auth, + &workspace_id, + &scope_config, + read_only, + request.name.clone(), + args, + &mcp_request, + ) + .await; + let refusal = result.as_ref().err().map(|e| e.message.as_ref()); + self.backend + .after_tool_call(&auth, &workspace_id, &request.name, refusal) + .await; + result } McpMode::Multi(token) => { self.call_tool_multi( @@ -951,12 +957,32 @@ impl Runner { let named = self .name_runnables(auth, workspace_id, scope_config, filter, filter) .await?; - let (tool_type, path, _) = named - .into_iter() - .find(|(_, _, n)| n == name.as_ref()) - .ok_or_else(|| { - ErrorData::internal_error(format!("No tool named '{}'", name), None) - })?; + let Some((tool_type, path, _)) = named.into_iter().find(|(_, _, n)| n == name.as_ref()) + else { + // Says which side refused: the token's selection, or the user's own rights. + let message = if scope_config.granular + && self + .name_runnables( + auth, + workspace_id, + &crate::common::scope::McpScopeConfig { + scripts: vec!["*".to_string()], + flows: vec!["*".to_string()], + ..Default::default() + }, + filter, + filter, + ) + .await? + .iter() + .any(|(_, _, n)| n == name.as_ref()) + { + format!("Access denied: tool '{name}' is outside this token's selection") + } else { + format!("No tool named '{name}' is available to this user") + }; + return Err(ErrorData::internal_error(message, None)); + }; (tool_type, path, false) } else { // The `s-`/`f-`/`hs-` encoding: what hub scripts and items whose short diff --git a/backend/windmill-mcp/src/server/session.rs b/backend/windmill-mcp/src/server/session.rs index d9bb9e829b..4632541d0c 100644 --- a/backend/windmill-mcp/src/server/session.rs +++ b/backend/windmill-mcp/src/server/session.rs @@ -374,7 +374,7 @@ impl ServerHandler for SessionRunner { let text = self.backend.workspace_context(&auth, &workspace_id).await; return Ok(CallToolResult::success(vec![ContentBlock::text(text)]).into()); } - let mut result = self + let result = self .backend .call_session_tool( &auth, @@ -384,7 +384,12 @@ impl ServerHandler for SessionRunner { access(&auth, &caller.scope), caller.origin.as_deref(), ) - .await?; + .await; + let refusal = result.as_ref().err().map(|e| e.message.as_ref()); + self.backend + .after_tool_call(&auth, &workspace_id, &request.name, refusal) + .await; + let mut result = result?; for block in result.content.iter_mut() { if let Some(text) = block.as_text() { *block = ContentBlock::text(truncate_tool_result(text.text.clone())); diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 289724c777..e357150cd2 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -3858,6 +3858,9 @@ pub struct MiniPulledJob { /// unrestricted token. #[serde(default)] pub job_token_scopes: Option>, + /// `job_perms.mcp_client`, read only on pull: see `ApiAuthed::mcp_client`. + #[serde(default)] + pub mcp_client: Option, } impl MiniPulledJob { @@ -3930,6 +3933,7 @@ impl MiniPulledJob { concurrent_limit: None, concurrency_time_window_s: None, job_token_scopes: None, + mcp_client: None, } } } @@ -4244,6 +4248,7 @@ impl PulledJob { end_user_email: self.job.permissioned_as_end_user_email.clone(), job_token_scopes: self.job.job_token_scopes.clone(), viewer_data_access: self.job.viewer_data_access.unwrap_or(false), + mcp_client: self.job.mcp_client.clone(), }), _ => None, }; @@ -4352,7 +4357,8 @@ pub async fn get_mini_pulled_job<'c>( visible_to_owner, NULL as permissioned_as_end_user_email, NULL::boolean as viewer_data_access, - job_perms.job_token_scopes + job_perms.job_token_scopes, + job_perms.mcp_client FROM v2_job_queue INNER JOIN v2_job ON v2_job.id = v2_job_queue.id LEFT JOIN v2_job_status ON v2_job_status.id = v2_job_queue.id LEFT JOIN job_perms ON job_perms.job_id = v2_job_queue.id WHERE v2_job_queue.id = $1", job_id, @@ -7780,7 +7786,8 @@ async fn push_inner<'c, 'd>( authed.clone() } _ => { - if authed.is_some() { + // An on-behalf-of run passes its MCP caller only to record the client. + if authed.is_some_and(|a| a.mcp_client.is_none()) { tracing::warn!("Authed passed to push is not the same as permissioned_as, refetching direclty permissions for job {job_id}...") } windmill_common::auth::fetch_authed_from_permissioned_as( @@ -7914,9 +7921,9 @@ async fn push_inner<'c, 'd>( INSERT INTO v2_job_runtime (id, ping) VALUES ($1, null) ), inserted_job_perms AS ( - INSERT INTO job_perms (job_id, email, username, is_admin, is_operator, folders, groups, workspace_id, end_user_email, job_token_scopes) - values ($1, $32, $33, $34, $35, $36, $37, $2, $41, $47) - ON CONFLICT (job_id) DO UPDATE SET email = EXCLUDED.email, username = EXCLUDED.username, is_admin = EXCLUDED.is_admin, is_operator = EXCLUDED.is_operator, folders = EXCLUDED.folders, groups = EXCLUDED.groups, workspace_id = EXCLUDED.workspace_id, end_user_email = EXCLUDED.end_user_email, job_token_scopes = EXCLUDED.job_token_scopes + INSERT INTO job_perms (job_id, email, username, is_admin, is_operator, folders, groups, workspace_id, end_user_email, job_token_scopes, mcp_client) + values ($1, $32, $33, $34, $35, $36, $37, $2, $41, $47, $48) + ON CONFLICT (job_id) DO UPDATE SET email = EXCLUDED.email, username = EXCLUDED.username, is_admin = EXCLUDED.is_admin, is_operator = EXCLUDED.is_operator, folders = EXCLUDED.folders, groups = EXCLUDED.groups, workspace_id = EXCLUDED.workspace_id, end_user_email = EXCLUDED.end_user_email, job_token_scopes = EXCLUDED.job_token_scopes, mcp_client = EXCLUDED.mcp_client ) INSERT INTO v2_job_queue (workspace_id, id, running, scheduled_for, started_at, tag, priority, cache_ignore_s3_path, runnable_settings_handle) @@ -7972,6 +7979,9 @@ async fn push_inner<'c, 'd>( runnable_path, workspace_id, job_token_scopes.as_deref() as Option<&[String]>, + // From the pusher's identity, not `job_authed`: a run on behalf of another identity + // re-fetches its permissions, but was still started through the same client. + authed.and_then(|a| a.mcp_client.as_deref()), ) .execute(&mut *tx) .warn_after_seconds(1) @@ -8024,6 +8034,9 @@ async fn push_inner<'c, 'd>( let uuid_str = uuid_string.as_str(); let mut hm = HashMap::from([("uuid", uuid_str), ("permissioned_as", &permissioned_as)]); + if let Some(client) = authed.and_then(|a| a.mcp_client.as_deref()) { + hm.insert("mcp_client", client); + } let s: String; let operation_name = match job_kind { @@ -8969,7 +8982,7 @@ pub async fn get_same_worker_job( COALESCE(pj.runnable_path, v2_job.args->>'_FLOW_PATH') as parent_runnable_path, p.email as permissioned_as_email, p.username as permissioned_as_username, p.is_admin as permissioned_as_is_admin, p.is_operator as permissioned_as_is_operator, p.groups as permissioned_as_groups, p.folders as permissioned_as_folders, p.end_user_email as permissioned_as_end_user_email, - p.viewer_data_access + p.viewer_data_access, p.mcp_client FROM v2_job_queue INNER JOIN v2_job ON v2_job.id = v2_job_queue.id LEFT JOIN v2_job_status ON v2_job_status.id = v2_job_queue.id diff --git a/backend/windmill-queue/tests/debounce_test.rs b/backend/windmill-queue/tests/debounce_test.rs index 692a1108b3..2c4993ba75 100644 --- a/backend/windmill-queue/tests/debounce_test.rs +++ b/backend/windmill-queue/tests/debounce_test.rs @@ -3460,6 +3460,7 @@ mod debounce { viewer_data_access: None, runnable_settings_handle: rs_handle, job_token_scopes: None, + mcp_client: None, }; let pulled = PulledJob { @@ -3703,6 +3704,7 @@ mod debounce { viewer_data_access: None, runnable_settings_handle: rs_handle, job_token_scopes: None, + mcp_client: None, }; let pulled = PulledJob { diff --git a/backend/windmill-queue/tests/schedule_push.rs b/backend/windmill-queue/tests/schedule_push.rs index e79d4ff976..9e86386107 100644 --- a/backend/windmill-queue/tests/schedule_push.rs +++ b/backend/windmill-queue/tests/schedule_push.rs @@ -65,6 +65,7 @@ mod schedule_push { folders: vec![], scopes: None, token_prefix: None, + mcp_client: None, } } diff --git a/backend/windmill-worker/src/common.rs b/backend/windmill-worker/src/common.rs index f0697283aa..be2c7080d0 100644 --- a/backend/windmill-worker/src/common.rs +++ b/backend/windmill-worker/src/common.rs @@ -578,6 +578,17 @@ pub async fn get_reserved_variables( ) .await .to_vec(); + let mut variables = variables; + if let Some(client) = &job.mcp_client { + variables.push(variables::ContextualVariable { + name: "WM_MCP_CLIENT".to_string(), + value: client.clone(), + description: "OAuth client of the external identity provider the run was started \ + through on the user's behalf, propagated to flow steps" + .to_string(), + is_custom: false, + }); + } Ok(build_envs_map(variables).await) } @@ -2636,6 +2647,7 @@ mod tests { viewer_data_access: None, runnable_settings_handle: None, job_token_scopes: None, + mcp_client: None, } } diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index 23f8fb69e9..7c232fdca9 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -2457,7 +2457,8 @@ async fn advance_flow_status( v2_job.visible_to_owner, NULL as permissioned_as_end_user_email, NULL::boolean as viewer_data_access, - job_perms.job_token_scopes", + job_perms.job_token_scopes, + NULL::varchar as mcp_client", flow, &step_path as &[&str], step, diff --git a/docs/auth-surface.md b/docs/auth-surface.md index 3bcd90b571..3044f9c3cd 100644 --- a/docs/auth-surface.md +++ b/docs/auth-surface.md @@ -153,6 +153,24 @@ Symbols, not line numbers, are cited: they drift less. "true"/"false" strings) and is only consulted for the claim above; only GitHub is filtered to `primary && verified`; a missing email is fabricated from `name` as `@windmill.dev` and reaches `login_externally` with `email_asserted = false`. +- **MCP access tokens from an external issuer** (`mcp_external_idp`, EE, `mcp/external_idp.rs`): + taken only for a JWT whose unverified `iss` is the configured issuer, then verified against its + discovery JWKS. With no audience configured, only a token typed as an access token (`at+jwt` + header, or a `Bearer` `typ` claim) is taken, so a client's ID token cannot stand in for one; + an instance-deactivated account (`password.disabled`) is refused, since this path has no + Windmill token for deactivation to revoke. The token's client claim (`azp` by default) must name a configured client, and + its email claim an existing, enabled member of that client's workspace: no account is created, + and a client-credentials token (no user) is refused with 403. When `sso_groups_claim` is set, + the instance groups with an `external_id` come from that claim of the token alone, for that + request only (nested paths counting for their ancestors): nothing is written, unlike an SSO + login, and an absent claim means no IdP groups, so removing a user from every group revokes at + the next token. Roles (admin, superadmin, operator) are not derived from the token: they stay as + stored, which SCIM and SSO login keep current. Entra's overage pointer (`_claim_names`) is refused rather than read as no + groups. The resolved identity is cached per token for at most a minute. Runs + record the client in `job_perms.mcp_client` (and the job-start audit entry), from the pushing identity + rather than `job_authed`, so a run on behalf of another identity still names it; the + session toolset reaches the API through a JWT minted for the caller, which carries the client + in its `mcp_client` claim for the same reason, and so does a job's `WM_TOKEN`. - **`GET /api/oauth/login/{client}`** is an unauthenticated 302 to the provider β€” a plain link from any page starts SSO. - **`CLOUD_HOSTED`** is presence-tested (`windmill-common/src/worker.rs`): `CLOUD_HOSTED=false` diff --git a/frontend/src/lib/components/InstanceSetting.svelte b/frontend/src/lib/components/InstanceSetting.svelte index 485d558f24..4a7c614b0b 100644 --- a/frontend/src/lib/components/InstanceSetting.svelte +++ b/frontend/src/lib/components/InstanceSetting.svelte @@ -22,6 +22,7 @@ import CriticalAlertChannels from './instanceSettings/CriticalAlertChannels.svelte' import RetentionPeriodOverrides from './instanceSettings/RetentionPeriodOverrides.svelte' import AgentWorkloadIdentityIssuers from './instanceSettings/AgentWorkloadIdentityIssuers.svelte' + import McpExternalIdp from './instanceSettings/McpExternalIdp.svelte' import WorkspaceRolesSetting from './instanceSettings/WorkspaceRolesSetting.svelte' import SmtpSettings from './instanceSettings/SmtpSettings.svelte' import SecretBackendConfig from './instanceSettings/SecretBackendConfig.svelte' @@ -636,6 +637,8 @@ {:else if setting.fieldType == 'agent_workload_identity_issuers'} + {:else if setting.fieldType == 'mcp_external_idp'} + {:else if setting.fieldType == 'critical_error_channels'} {:else if setting.fieldType == 'otel'} diff --git a/frontend/src/lib/components/InstanceSettings.svelte b/frontend/src/lib/components/InstanceSettings.svelte index de470489fd..e854e42947 100644 --- a/frontend/src/lib/components/InstanceSettings.svelte +++ b/frontend/src/lib/components/InstanceSettings.svelte @@ -1261,7 +1261,7 @@
{#each settings[category] as setting} - {#if setting.fieldType != 'slack_connect' && !(quickSetup && setting.hideInQuickSetup) && !(quickSetup && category === 'Core' && setting.key === 'license_key')} + {#if setting.fieldType != 'slack_connect' && !(quickSetup && setting.hideInQuickSetup) && !(quickSetup && category === 'Core' && setting.key === 'license_key') && !(setting.key === 'mcp_external_idp' && authSubTab !== 'sso')} closeDrawer?.()} diff --git a/frontend/src/lib/components/instanceSettings.ts b/frontend/src/lib/components/instanceSettings.ts index 548f5c4259..fc90a75c05 100644 --- a/frontend/src/lib/components/instanceSettings.ts +++ b/frontend/src/lib/components/instanceSettings.ts @@ -80,6 +80,7 @@ export interface Setting { | 'instance_banner' | 'accent_color' | 'agent_workload_identity_issuers' + | 'mcp_external_idp' | 'workspace_roles' storage: SettingStorage advancedToggle?: { @@ -831,8 +832,9 @@ export const settings: Record = { }, { label: 'Auto-login SSO provider', - description: - 'If set, the login page redirects automatically to this provider. Use the OAuth provider key (e.g. "okta", "google") or "saml". The provider must be configured; otherwise the setting is ignored. Visit /user/login?no_sso=1 to bypass the redirect and fall back to the normal login form.', + description: 'Send the login page straight to this provider.', + tooltip: + 'Use the OAuth provider key (okta, google) or saml. Ignored when that provider is not configured. /user/login?no_sso=1 shows the normal login form.', key: 'auto_login_provider', fieldType: 'text', placeholder: 'okta', @@ -841,12 +843,26 @@ export const settings: Record = { { label: 'SSO groups claim', description: - 'Name of the SAML attribute or OIDC userinfo claim carrying the user\'s IdP groups ("http://schemas.microsoft.com/ws/2008/06/identity/claims/groups" on Entra SAML, "groups" for most OIDC providers). Its values must be the same group ids that SCIM stored as the instance groups\' external id (Entra emits object ids in both), since matching is by external id only. When set, every SSO login reconciles the user\'s membership in those SCIM-provisioned instance groups against the claim, so IdP group changes take effect at the next login instead of waiting for the SCIM push. Instance groups without an external id are never touched, and a login whose claim is absent or empty changes nothing. Leave empty to disable.', + "The claim or SAML attribute listing a user's IdP groups. Each SSO login then updates their membership in the groups SCIM created.", + tooltip: + 'Usually groups on OIDC, or http://schemas.microsoft.com/ws/2008/06/identity/claims/groups on Entra SAML. Values must match the external id SCIM stored for each group (Entra uses object ids). Groups without an external id are never changed, and a login without the claim changes nothing. MCP requests signed in through the external identity provider use the groups in their token the same way.', key: 'sso_groups_claim', fieldType: 'text', placeholder: 'groups', storage: 'setting', ee_only: '' + }, + { + label: 'MCP external identity provider', + description: + 'Let MCP clients sign in with your OpenID Connect provider. Each client acts as the signed-in Windmill user, within the access you set for it below.', + tooltip: + 'Tokens Windmill issued keep working. The user must already exist in Windmill: they sign in once first. When the SSO groups claim is set, each request uses the groups listed in its token, so a change in the IdP applies at the next token. Runs record the client, and their steps read it as WM_MCP_CLIENT.', + key: 'mcp_external_idp', + fieldType: 'mcp_external_idp', + storage: 'setting', + ee_only: '', + hideInQuickSetup: true } ], 'Agent workers': [ diff --git a/frontend/src/lib/components/instanceSettings/McpExternalIdp.svelte b/frontend/src/lib/components/instanceSettings/McpExternalIdp.svelte new file mode 100644 index 0000000000..358256947d --- /dev/null +++ b/frontend/src/lib/components/instanceSettings/McpExternalIdp.svelte @@ -0,0 +1,265 @@ + + +
+
+ + +
+ + +
+
+ +
+ MCP clients + + Each OAuth client of the issuer works in one workspace with the access set here, and never + beyond what its signed-in user can do. + + {#each form.clients as client, i (client.id)} +
+
+ +
+ {#if client.open} +
+ +
- {/if} + (variable.value = '')} /> + {:else} +
+ + {#snippet children({ item })} + + + + {/snippet} + + {#if editorKind == 'plain'} + + {:else if editorKind == 'json'} +
+ {#await import('$lib/components/SimpleEditor.svelte')} + + {:then Module} + + {/await} +
+ {:else if editorKind == 'yaml'} +
+ {#await import('$lib/components/SimpleEditor.svelte')} + + {:then Module} + + {/await} +
+ {/if} +
+ {/if} +
-
+{/if}