fix: refuse the tools preview to a token withholding superadmin rights, restricted badge after a single access line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-12-03 10:49:29 +01:00
co-authored by Claude Opus 5.5
parent 2efcb9b1d9
commit a67f528425
4 changed files with 33 additions and 21 deletions
+4 -3
View File
@@ -389,10 +389,11 @@ pub async fn list_runnable_tools(
"A scope-restricted token cannot list its owner's tools".to_string(),
));
}
// The listing runs with the owner's admin rights, which this token does not carry.
if authed.admin_withheld {
// The listing runs with the owner's admin and superadmin rights, which this token may not
// carry: only a credential holding both may list.
if authed.admin_withheld || authed.super_admin_withheld {
return Err(Error::NotAuthorized(
"A token without its owner's admin rights cannot list its owner's tools".to_string(),
"A token without all of its owner's rights cannot list its owner's tools".to_string(),
));
}
let w_id = query.workspace_id;