mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-29 00:07:30 +00:00
fix: let a restricted caller re-save a token's mcp:session marker
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
50feb9ddba
commit
708964bbc2
@@ -591,7 +591,9 @@ pub fn ensure_scopes_within_caller(
|
||||
|
||||
for requested in requested_restrictions {
|
||||
if requested.starts_with("mcp:") {
|
||||
if !caller_mcp.contains(requested.as_str()) {
|
||||
// `mcp:session` (windmill_mcp's SESSION_SCOPE) grants nothing: it only picks
|
||||
// the toolset an `mcp:all` token gets, and `mcp:all` is matched here itself.
|
||||
if requested != "mcp:session" && !caller_mcp.contains(requested.as_str()) {
|
||||
return Err(Error::PermissionDenied(format!(
|
||||
"A scope-restricted token cannot grant MCP scope '{requested}' unless the \
|
||||
caller holds the same scope verbatim"
|
||||
@@ -1964,6 +1966,11 @@ mod tests {
|
||||
opt_scopes(Some(vec!["mcp:scripts:*"])).as_deref()
|
||||
)
|
||||
.is_err());
|
||||
assert!(ensure_scopes_within_caller(
|
||||
&mcp_all,
|
||||
opt_scopes(Some(vec!["mcp:all", "mcp:session"])).as_deref()
|
||||
)
|
||||
.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user