fix(security): restrict subagent toolsets to parent's enabled set - #3188
Closed
dieutx wants to merge 1 commit into
Closed
fix(security): restrict subagent toolsets to parent's enabled set#3188dieutx wants to merge 1 commit into
dieutx wants to merge 1 commit into
Conversation
The delegate_task tool accepts a toolsets parameter directly from the LLM's function call arguments. When provided, these toolsets are passed through _strip_blocked_tools but never intersected with the parent agent's enabled_toolsets. A model can request toolsets the parent does not have (e.g., web, browser, rl), granting the subagent tools that were explicitly disabled for the parent. Intersect LLM-requested toolsets with the parent's enabled set before applying the blocked-tool filter, so subagents can only receive a subset of the parent's tools.
Contributor
|
Merged via PR #3269. Your commit was cherry-picked onto current main with original authorship preserved. Good catch on the privilege escalation — subagent toolsets are now intersected with the parent's enabled set before filtering. Thanks! |
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
The
delegate_tasktool lets the LLM request arbitrary toolsets for subagents, including ones the user explicitly disabled for the parent. A model callingdelegate_task(toolsets=["terminal", "file", "web", "browser"])when the parent only has["terminal", "file"]grants the subagentwebandbrowser— a privilege escalation.Root Cause
_build_child_agent()atdelegate_tool.py:177passes LLM-providedtoolsetsthrough_strip_blocked_tools(which removesdelegation,clarify,memory,code_execution) but never intersects with the parent'senabled_toolsets. The blocked-tool filter is a different, smaller set than the user's tool restrictions.Fix
Intersect before filtering (
tools/delegate_tool.py)The no-toolsets path (child inherits parent's full set) and the blocked-tools filter are both unchanged.
Tests
5 new tests: intersection drops extras, subset passes through, no-toolsets inherits parent, blocked tools still removed, empty intersection yields empty set.