fix(BA-5594): restrict agent_nodes and agents_v2 queries to superadmin only#10803
Merged
jopemachine merged 3 commits intomainfrom Apr 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an information disclosure issue where non-superadmin users could retrieve sensitive agent infrastructure details via GraphQL, by restricting access to the legacy agent_nodes connection and the v2 agents_v2 query.
Changes:
- Enforced superadmin-only access for Strawberry
agents_v2viacheck_admin_only(). - Restricted legacy
AgentNode.get_connection()to return an empty result set for non-superadmins.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/ai/backend/manager/api/gql/agent/resolver.py |
Adds an admin-only guard to the v2 agents listing resolver. |
src/ai/backend/manager/api/gql_legacy/agent.py |
Adds a superadmin gate to the legacy paginated agent node connection resolver. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jopemachine
added a commit
that referenced
this pull request
Apr 6, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9702cce to
59ea141
Compare
HyeockJinKim
previously approved these changes
Apr 6, 2026
59ea141 to
12bab04
Compare
12bab04 to
a9cca0c
Compare
fregataa
reviewed
Apr 7, 2026
a9cca0c to
99e78a0
Compare
HyeockJinKim
approved these changes
Apr 8, 2026
seedspirit
approved these changes
Apr 8, 2026
…n only Regular users could access full agent infrastructure details (addr, available_slots, occupied_slots, scaling_group, region) via agent_nodes and agents_v2 GraphQL queries. The legacy resolve_agents/resolve_agent_list were properly protected with @privileged_query(UserRole.SUPERADMIN), but agent_nodes used RBAC with AgentPermission.CREATE_COMPUTE_SESSION which is granted to all users, and agents_v2 had no access control at all. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verify that agent_nodes (legacy) and agents_v2 (Strawberry) reject non-superadmin users: regular users, domain admins, and monitors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
99e78a0 to
3c70210
Compare
|
Backport to 26.3 is failed. Please backport manually. |
|
Backport to 26.2 is failed. Please backport manually. |
|
Backport to 25.15 is failed. Please backport manually. |
jopemachine
added a commit
that referenced
this pull request
Apr 8, 2026
Restrict legacy `agent_nodes` GraphQL query to superadmin only, preventing regular users from accessing agent infrastructure details such as internal addresses, resource capacity, and hardware metadata. Note: 25.15 does not have the v2 `agents_v2` query, so only the legacy `agent_nodes` resolver is patched here. Backported-from: main Backported-to: 25.15 Backport-of: 10803
HyeockJinKim
pushed a commit
that referenced
this pull request
Apr 8, 2026
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.
Summary
agent_nodesandagents_v2GraphQL queriesagent_nodes: Added superadmin role check inAgentNode.get_connection()— returns empty results for non-superadmin (consistent with existingresolve_agents/resolve_agent_listwhich use@privileged_query(UserRole.SUPERADMIN))agents_v2: Addedcheck_admin_only()guardagent_summary_listis unaffected — it's the intentional non-admin schema that excludes sensitive fields (noaddr,region,hardware_metadata)Test plan
agent_nodesas regular user → should return empty resultsagent_nodesas superadmin → should work as beforeagents_v2as regular user → should return 403agents_v2as superadmin → should work as beforeagent_summary_liststill works for regular usersResolves BA-5594 (#10800)
🤖 Generated with Claude Code