-
Notifications
You must be signed in to change notification settings - Fork 6.9k
fix: prevent Plan mode bypass via sub-agent spawning #9254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ashwinhegde19
wants to merge
12
commits into
anomalyco:dev
Choose a base branch
from
Ashwinhegde19:fix/plan-mode-subagent-bypass
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix: prevent Plan mode bypass via sub-agent spawning #9254
Ashwinhegde19
wants to merge
12
commits into
anomalyco:dev
from
Ashwinhegde19:fix/plan-mode-subagent-bypass
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
…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
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
|
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.
5b1fcdd to
24aa3f2
Compare
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
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 #6527 - Plan Mode Security Bypass via Sub-Agent Spawning
When a parent session operates under Plan mode (
edit="deny"), sub-agents spawned via thetasktool could previously bypass these restrictions and gain full edit capabilities.Changes
hasPlanRestrictions()function to detect Plan mode sessionsplanPermissions()function returning permission rules that deny edit toolsTaskToolto:edit,write,patch, andmultiedittoolsSecurity 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:
All 770 tests pass.