opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: Add Permission Control for Path Restrictions in Bash Tool

Open thuanpham582002 opened this issue 1 year ago • 2 comments

Summary: Allow users to approve bash commands that reference external paths via permission system.

Problem: Bash tool hard-rejects external paths without user control.

mkdir -p ~/.config/opencode  # ❌ Fails immediately

Solution: Add external_paths permission type:

{
  "permission": {
    "external_paths": "ask"   "ask" | "allow" | "deny"
  }
}

Implementation: Modify bash.ts to use Permission.ask() for external paths instead of hard rejection.

Benefits:

  • User control over external path access
  • Consistent with other tool permissions
  • Enables legitimate operations (config migration, etc.)

Files: packages/opencode/src/tool/bash.ts

thuanpham582002 avatar Sep 23 '25 16:09 thuanpham582002

note: we probably want some functionality to allow access for other tools to work outside cwd too, like read for instance.

rekram1-node avatar Sep 23 '25 16:09 rekram1-node

This will be done as part of: #1961

rekram1-node avatar Sep 23 '25 19:09 rekram1-node