[PR #3592] feat: add pattern-based external file access permission #10700

Closed
opened 2026-02-16 18:15:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3592

State: closed
Merged: No


I've vibed a solution for my issue (#3218). I thought it might be cool to have a more granular control, so added bash-like complex permission for external files.

Claude overview:

  • Implements pattern-based external file access permission system (#3218)
  • Adds external_files permission with support for allow, ask, and deny modes
  • Supports pattern-based control similar to bash permissions (e.g., */docs/*: "allow")
  • Defaults to ask for security while enabling flexible configuration for monorepo workflows

Changes

Tool Updates

  • Read Tool: Added permission check for files outside working directory
  • Write Tool: Added permission check before file creation/modification
  • Edit Tool: Added permission check for external file edits
  • Patch Tool: Added permission check for all file operations in patches

Configuration Examples

Simple Permission

{
  "permission": {
    "external_files": "ask"
  }
}

Pattern-Based (Monorepo)

{
  "permission": {
    "external_files": {
      "*/docs/*": "allow",
      "*/packages/*/README.md": "allow",
      "*/node_modules/*": "deny",
      "*": "ask"
    }
  }
}

Per-Agent Configuration

{
  "agent": {
    "build": {
      "permission": {
        "external_files": "allow"
      }
    }
  }
}

Closes #3218

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3592 **State:** closed **Merged:** No --- I've vibed a solution for my issue (#3218). I thought it might be cool to have a more granular control, so added bash-like complex permission for external files. # Claude overview: - Implements pattern-based external file access permission system (#3218) - Adds `external_files` permission with support for `allow`, `ask`, and `deny` modes - Supports pattern-based control similar to bash permissions (e.g., `*/docs/*: "allow"`) - Defaults to `ask` for security while enabling flexible configuration for monorepo workflows ## Changes ### Tool Updates - **Read Tool**: Added permission check for files outside working directory - **Write Tool**: Added permission check before file creation/modification - **Edit Tool**: Added permission check for external file edits - **Patch Tool**: Added permission check for all file operations in patches ## Configuration Examples ### Simple Permission ```json { "permission": { "external_files": "ask" } } ``` ### Pattern-Based (Monorepo) ```json { "permission": { "external_files": { "*/docs/*": "allow", "*/packages/*/README.md": "allow", "*/node_modules/*": "deny", "*": "ask" } } } ``` ### Per-Agent Configuration ```json { "agent": { "build": { "permission": { "external_files": "allow" } } } } ``` Closes #3218
yindo added the pull-request label 2026-02-16 18:15:26 -05:00
yindo closed this issue 2026-02-16 18:15:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10700