fix: prevent subagent permission bypass via tools field inheritance #7473
+968
−44
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
Fixes a security vulnerability where subagents bypassed permission restrictions due to direct tools array inheritance from parent agents.
Problem
Agents with restricted tool access could access parent agent tools they shouldn't have permission to use. The
toolsfield was being spread directly from agent config, bypassing permission evaluation.Solution
toolsfield from agent config spread to prevent inheritanceFixes: #7474
Related: #5894, #3808, #7296, #6527
Test Coverage
4 test files with comprehensive coverage validating agents cannot access tools outside their permission scope.
Verified manually to finally fix this issue. I had been stuck on 1.0.200 for few days due to this and having a rather complex multi-sub-agent configuration that relies on permissions guard rails working correctly.