[security] fix(agent-to-agent): authorize create_agent actions#2383
Open
Hinotoi-agent wants to merge 1 commit into
Open
[security] fix(agent-to-agent): authorize create_agent actions#2383Hinotoi-agent wants to merge 1 commit into
Hinotoi-agent wants to merge 1 commit into
Conversation
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
This PR hardens the host-side agent-to-agent management boundary for
create_agentsystem actions.It adds an authorization check before the host creates persistent agent groups or writes bidirectional
agent_destinationsACL rows, and covers both denied and allowed paths with focused regression tests.Security issues covered
create_agentsystem actionBefore this PR
messages_outdatabase could containkind: "system"messages withaction: "create_agent".handleCreateAgent()trusted that action and immediately created a newagent_groupsrow, initialized group filesystem state, and inserted bidirectionalagent_destinationsrows.After this PR
handleCreateAgent()now checks the source agent group before mutating host state.Why this matters
Agent containers control their outbound session database, so the presence or absence of an MCP tool in the container is not a sufficient security boundary. The trusted host must treat every outbound system action as potentially forged and re-check authorization at the point where central DB and host filesystem state are mutated.
Without this check, a less-trusted or compromised agent can create long-lived agent identities and routing ACLs, changing the topology of the deployment without an owner/admin decision.
Attack flow
Affected code
create_agentsrc/modules/agent-to-agent/create-agent.ts,src/modules/agent-to-agent/create-agent.test.tsRoot cause
Issue: untrusted agent session can create/manage new agent groups through
create_agenthandleCreateAgent()created agent groups and destination rows without checking whether the source session's agent group was admin/owner-tied.CVSS assessment
create_agentsystem action mutates agent topology/ACLsCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:LRationale:
Safe reproduction steps
Create a non-admin/member-only source agent group and active session in a local test database.
Call the real
handleCreateAgent()with a forged system-action payload:{ "action": "create_agent", "requestId": "poc", "name": "Evil Child" }On vulnerable code, observe that a new child
agent_groupsrow is created and bidirectionalagent_destinationsrows are inserted.With this PR, the same source is denied before group creation, filesystem initialization, or destination ACL mutation.
The new regression test
denies create_agent from a member-only source agent without mutating groups or destinationscovers this behavior directly.Expected vulnerable behavior
On vulnerable code, a non-main/untrusted source agent can create a persistent child agent and receive a new destination name for it. The child also receives a
parentdestination back to the source group, creating bidirectional agent-to-agent routing without an owner/admin authorization point.Changes in this PR
canSourceCreateAgent()guard inhandleCreateAgent().Files changed
src/modules/agent-to-agent/create-agent.tscreate_agentcan mutate agent groups or destinations.src/modules/agent-to-agent/create-agent.test.tsMaintainer impact
create_agentdelivery-action path.Fix rationale
The durable boundary is the host-side mutation point, not the container-side tool registry. A compromised container can write outbound system messages directly, so the handler that creates
agent_groupsandagent_destinationsmust enforce the authorization decision immediately before those writes.Requiring explicit membership for global owner/admin authority keeps normal first-agent/owner workflows working while avoiding ambient privilege inheritance for unrelated child groups.
Type of change
Test plan
Executed with:
Token usage
Disclosure notes
create_agenthost-side authorization gap.