Skip to content

Conversation

@Ashwinhegde19
Copy link

Summary

Fixes #6527 - Plan Mode Security Bypass via Sub-Agent Spawning

When a parent session operates under Plan mode (edit="deny"), sub-agents spawned via the task tool could previously bypass these restrictions and gain full edit capabilities.

Changes

  • Added hasPlanRestrictions() function to detect Plan mode sessions
  • Added planPermissions() function returning permission rules that deny edit tools
  • Modified TaskTool to:
    • Force sub-agents to use the "plan" agent when parent has edit restrictions
    • Pass inherited permission rules to sub-agent sessions
    • Explicitly disable edit, write, patch, and multiedit tools

Security Impact

This closes a permission escalation vulnerability where spawning sub-agents via the task tool could circumvent intended read-only constraints in Plan mode.

Testing

Added 18 new tests covering:

  • Plan mode detection logic
  • Permission rule generation
  • Agent availability filtering
  • Permission evaluation
  • End-to-end security scenarios

All 770 tests pass.

google-labs-jules bot and others added 10 commits January 15, 2026 18:49
…ile.list

Resolves a critical vulnerability where symlinks could be used to access files outside the project directory.
Implemented `fs.promises.realpath` validation to ensure the actual target path is within the allowed scope.
Added regression test in `packages/opencode/test/security/symlink.test.ts`.
…ile.list

Resolves a critical vulnerability where symlinks could be used to access files outside the project directory.
Implemented `fs.promises.realpath` validation to ensure the actual target path is within the allowed scope.
Added regression test in `packages/opencode/test/security/symlink.test.ts`.

Fixes anomalyco#101
fix(security): prevent path traversal via symlinks
…lyco#4997)

- Fix Ctrl+C behavior on Windows: copies selection if present, otherwise clears/exits.
- Resolve Ctrl+A conflict: move `model_provider_list` to `ctrl+alt+m`.
- Fix Navigation: map `ctrl+n`/`ctrl+p` to move down/up and history next/prev.
- Fix Multiline: ensure `shift+return` is mapped to newline.
- Fix Word Navigation: ensure `ctrl+left`/`ctrl+right` are mapped.
- Fix Word Deletion: ensure `alt+d` and `option+delete` are mapped.
fix(tui): resolve keybind conflicts and missing defaults
@github-actions
Copy link
Contributor

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

Potential Duplicate Found:

Ashwinhegde19 and others added 2 commits January 18, 2026 20:13
When a parent session operates under Plan mode (edit="deny"), sub-agents
spawned via the task tool could previously bypass these restrictions.

This fix ensures:
- Sub-agents inherit Plan mode restrictions from their parent session
- When parent has edit="deny", sub-agents are forced to use the "plan" agent
- Edit tools (edit, write, patch, multiedit) are explicitly disabled
- Inherited permission rules are passed to sub-agent sessions

Security: Closes a permission escalation vulnerability where task spawning
could circumvent intended read-only constraints.
@Ashwinhegde19 Ashwinhegde19 force-pushed the fix/plan-mode-subagent-bypass branch from 5b1fcdd to 24aa3f2 Compare January 18, 2026 14:47
@Ashwinhegde19
Copy link
Author

Rebased and squashed to a single clean commit. The PR now contains only the security fix for #6527 with no unrelated merge commits.

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 Issue/Bug] Plan mode restrictions bypassed when spawning sub-agents

1 participant