fix: enforce workspace filter on agent listing — multi-tenant projects (#4223)#3
Open
neuralmint wants to merge 1 commit into
Open
fix: enforce workspace filter on agent listing — multi-tenant projects (#4223)#3neuralmint wants to merge 1 commit into
neuralmint wants to merge 1 commit into
Conversation
Closes #4223 Add workspace-scoped agent operations to prevent cross-tenant data leakage in multi-tenant projects. Every agent lookup, listing, and mutation is now scoped to the authenticated caller's workspace. Changes: - Add workspace field to SessionInfo (defaults to 'default') - Add workspace parameter to registry.list(), get(), count(), get_enabled(), register(), and new disable()/enable() methods - Update agent routes to extract workspace from authenticated session - Return 404 for cross-workspace agent access (no existence leak) - Return 4xx without performing protected lookups on unauthorized requests - Add route-level tests covering authorized, unauthorized, cross- workspace, and malformed request scenarios - Add AgentStatus.DISABLED enum value - Restore AuthMiddleware with session validation and role checks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Enforce workspace filter on agent listing
Closes #4223
Problem
The agent listing endpoints and agent CRUD operations trusted object identifiers without tying them to the caller's workspace. In a multi-tenant deployment, this allowed tenants to see or mutate orchestration data outside intended API boundaries, or receive misleading success responses.
Solution
Every agent lookup, listing, and mutation is now scoped to the authenticated caller's workspace:
list(),get(),count(),get_enabled(), andregister()accept an optionalworkspaceparameter. Cross-workspace lookups returnNone(no existence leak)./api/v2/agents/*routes extract the workspace from the authenticated session viarequest.state.session.workspace.AgentRegistrymethods, not just route-level checks.disable()/enable()methods andAgentStatus.DISABLEDenum value to the registry.request.state.sessioninjection.Acceptance Criteria
Test output