mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-04 08:09:16 +00:00
chore: name every access level in the session docs and share ACCESS_LEVELS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f54b393b15
commit
b71dc8951d
@@ -499,7 +499,7 @@ impl McpBackend for WindmillBackend {
|
||||
pub struct McpSelection;
|
||||
|
||||
/// The scopes that give the whole of MCP at some access level, rather than a selection.
|
||||
const ACCESS_LEVELS: [&str; 3] = ["mcp:all", "mcp:run", "mcp:read"];
|
||||
pub(crate) const ACCESS_LEVELS: [&str; 3] = ["mcp:all", "mcp:run", "mcp:read"];
|
||||
|
||||
/// MCP scopes without an access level: favorites, chosen scripts, flows, endpoints or hub apps.
|
||||
fn scoped_to_selection(scopes: &[String]) -> bool {
|
||||
|
||||
@@ -890,8 +890,9 @@ async fn oauth_approve_inner(
|
||||
.collect();
|
||||
// On every access level, so the grant keeps the session toolset if it is later raised to
|
||||
// `mcp:all`, which without the marker means the tools server on its URLs.
|
||||
let access_level = ["mcp:all", "mcp:run", "mcp:read"];
|
||||
if scopes.iter().any(|s| access_level.contains(&s.as_str()))
|
||||
if scopes
|
||||
.iter()
|
||||
.any(|s| super::core::ACCESS_LEVELS.contains(&s.as_str()))
|
||||
&& !scopes.iter().any(|s| s == SESSION_SCOPE)
|
||||
{
|
||||
scopes.push(SESSION_SCOPE.to_string());
|
||||
|
||||
@@ -164,8 +164,8 @@ fn pattern_covers(caller: &str, requested: &str) -> bool {
|
||||
/// URL, which an older selection, carrying none of the newer scopes, still does.
|
||||
pub const RUNNABLES_AS_TOOLS_SCOPE: &str = "mcp:runnables_as_tools";
|
||||
|
||||
/// Added server-side to an `mcp:all` OAuth grant so the tools server's URLs serve it the AI
|
||||
/// session's toolset. Grants nothing: an un-narrowed `mcp:all` token without it predates the
|
||||
/// Added server-side to every access-level OAuth grant so the tools server's URLs serve it the
|
||||
/// AI session's toolset, including once it is raised to `mcp:all`. Grants nothing: an un-narrowed `mcp:all` token without it predates the
|
||||
/// session toolset there, and must keep the tools server's endpoint tools.
|
||||
pub const SESSION_SCOPE: &str = "mcp:session";
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ use serde_json::Value;
|
||||
use std::borrow::Cow;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// `mcp:all`, and no scope from outside `mcp:` that confines the token to some routes
|
||||
/// An access level (`mcp:all`, `mcp:run`, `mcp:read`), and no scope from outside `mcp:` that confines the token to some routes
|
||||
/// or paths (`variables:read:f/x/*`): the tools call the API without a route scope, so
|
||||
/// that confinement would be lost here. The job tag fence is carried through instead.
|
||||
fn admits(scopes: &[String], all: bool) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user