fix: enforce token path scopes on flows and scripts list_paths

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-12-03 00:03:44 +01:00
co-authored by Claude Opus 5.5
parent 86651b4fb7
commit c253a4fffd
3 changed files with 88 additions and 2 deletions
+5 -1
View File
@@ -3562,12 +3562,16 @@ async fn list_paths(
) -> JsonResult<Vec<String>> {
let mut tx = user_db.begin(&authed).await?;
let allowed = build_scope_path_predicate(&authed, "scripts", "read");
let scripts = sqlx::query_scalar!(
"SELECT distinct(path) FROM script WHERE workspace_id = $1",
w_id
)
.fetch_all(&mut *tx)
.await?;
.await?
.into_iter()
.filter(|p| allowed(p))
.collect::<Vec<_>>();
tx.commit().await?;
Ok(Json(scripts))