Repository navigation
fix: filter script and flow path listings by token path scope - #12801
rubenfiszel wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying windmill with
|
| Latest commit: |
fb533a8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://85cb057f.windmill.pages.dev |
| Branch Preview URL: | https://ruben-win-2861-fixauth-filte.windmill.pages.dev |
|
/review |
|
Claude finished @rubenfiszel's task in 32s —— View job Good to merge Review
What I checked
FindingsNo P0, P1 or P2 findings. The follow-up named in the PR description is real and correctly kept out of scope: AGENTS.md complianceThe changes are small and focused, add no comments that narrate the change, and follow the existing pattern. No migrations, sqlx query changes or OpenAPI changes are needed, because the query text and response shapes are unchanged. Test coverageBackend: the new integration test Manual verification: the PR description already covers it. A token created through |
Codex ReviewGood to merge No P0/P1/P2 findings. All three handlers apply the existing predicate with the correct resource and Test coverageThe new Rust integration test covers all three API/DB paths with scoped and unscoped tokens. Existing predicate unit tests cover exact paths, wildcards, unscoped tokens and filter-tags-only scopes; no new predicate logic needs unit coverage. The author reports the regression test passes and fails against the unfixed handlers. My The PR reports manual verification using tokens created through Remaining manual check: open the dedicated-workers selector in workspace settings with a normal unscoped session. Confirm all eligible dedicated scripts remain listed with their workspace dependency names. |
Pi ReviewGood to merge The three handlers now filter through Note (pre-existing, not in this diff): Considered and dismissed
Test coverageBackend: the new Manual verification is already documented in the PR body and is sufficient: create a token via |
|
✅ Review round clean @ fb533a8 |
Summary
A token whose scopes restrict it to a path (e.g.
scripts:read:f/allowed/*) could callGET /w/{w}/scripts/list_paths,GET /w/{w}/scripts/list_dedicated_with_depsandGET /w/{w}/flows/list_pathsand receive every path in the workspace (and, for dedicated scripts, their language and workspace dependency names), including paths outside its scope. The mainlistendpoints andlist_search_scriptsalready filter by token path scope; these three did not.Fixes WIN-2861.
Changes
scripts/list_pathsandscripts/list_dedicated_with_deps: filter fetched rows withbuild_scope_path_predicate(&authed, "scripts", "read").flows/list_paths: filter withbuild_scope_path_predicate(&authed, "flows", "read").ScopePathFilterSQL requirement applies to paginated listings only).if_jobs:filter_tags:scopes, are unaffected.backend/tests/list_paths_scope.rs.Test plan
cargo test --test list_paths_scopepasses; it fails on the unfixed handlers (scoped token got["f/allowed/a", "f/other/b"])./users/tokens/createwith scopesscripts:read:f/allowed/*andflows:read:f/allowed/*now gets onlyf/allowed/afrom all three endpoints (same asscripts/list/flows/list). An unscoped token still gets every path.Follow-up (not in this PR)
list_paths_from_workspace_runnable(scripts and flows) andflows/list_paths_linking_agentreturn importer/linking paths without filtering them by the token's path scope. That is a similar but separate gap.Left in draft: touches an auth/token-scope path, so it wants a human look before ready.
🤖 Generated with Claude Code
Summary by cubic
Fixes three path-listing endpoints so a token scoped to a path only sees scripts and flows under that path, instead of every path in the workspace.
scripts/list_paths,scripts/list_dedicated_with_deps, andflows/list_pathsnow filter fetched rows throughbuild_scope_path_predicatewith the corresponding resource andreadaction.listhandlers.if_jobs:filter_tags:scopes, are unaffected.backend/tests/list_paths_scope.rs) covering scoped and unscoped tokens on all three endpoints.list_paths_from_workspace_runnableandflows/list_paths_linking_agentstill return importer/linking paths without path-scope filtering, which is a similar but separate gap.Written for commit fb533a8. Summary will update on new commits.