Skip to content

Conversation

@randomm
Copy link

@randomm randomm commented Jan 9, 2026

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 tools field was being spread directly from agent config, bypassing permission evaluation.
Solution

  • Exclude tools field from agent config spread to prevent inheritance
  • Filter tools by agent-specific permission rules in ToolRegistry
  • Apply permission filtering in session initialization and prompt construction

Fixes: #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.

Janni Turunen added 2 commits January 9, 2026 14:03
…nomalyco#6527)

Security vulnerability: Subagents were inheriting parent agent's tools array
directly, allowing permission bypass. Agents with restricted tool access could
access parent tools they shouldn't have permission to use.

Core changes:
- config.ts: Exclude 'tools' field from agent config spread to prevent inheritance
- task.ts: Filter tools by agent-specific permission rules when constructing prompts
- session/index.ts: Apply permission filtering in session initialization
- session/prompt.ts: Filter tools array before passing to subagent prompts
- registry.ts: Add permission-aware tool filtering in ToolRegistry.tools()

The fix ensures each agent only sees tools matching their own permission rules,
preventing unauthorized tool access in nested agent scenarios.

Fixes anomalyco#6527
Test suite validates the security fix for subagent permission inheritance:
- permission-inheritance.test.ts: Tests tool inheritance blocking
- permission-security-fix.test.ts: Validates permission filtering behavior
- registry.test.ts: Tests ToolRegistry permission-aware filtering
- tool-registry-permissions.test.ts: Additional registry permission checks

Tests verify agents cannot access parent tools outside their permission scope.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security Bug] Subagent permissions not enforced - configured restrictions ignored

1 participant