[PR #11535] feat(opencode): add fine-grained permission options for file access #13826

Open
opened 2026-02-16 18:18:39 -05:00 by yindo · 0 comments
Owner

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

State: open
Merged: No


Summary

  • Replace dangerous 'always' permission with scoped alternatives
  • Add file_always, folder_always, folder_recursive, project_recursive options
  • Implement smart UI that shows relevant options based on tool type and context
  • Add comprehensive tests for new permission types
  • Improve security by allowing precise scope control for read/edit operations

Changes Made

Enhanced Permission Types

  • file_always: Always allow this specific file
  • folder_always: Always allow this specific folder (non-recursive)
  • folder_recursive: Always allow this folder and all subfolders
  • project_recursive: Always allow entire project folder recursively
  • Removed: dangerous "always" option that could allow anything

Smart UI Adaptation

  • File-based tools (read, edit) show all scoped options
  • Non-file tools (bash, etc.) show limited relevant options
  • Options dynamically adapt based on file context availability

Backend Changes

  • Updated PermissionNext.Reply enum with new options
  • Added pattern generation logic for different scopes
  • Enhanced reply handling to process new permission types

Testing

  • Added comprehensive test coverage for all new permission types
  • Verified pattern generation for files, folders, and project scopes
  • Tested both file-based and non-file tool scenarios

This improves security by providing precise control over what can be accessed, replacing previous all-or-nothing approach.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11535 **State:** open **Merged:** No --- ## Summary - Replace dangerous 'always' permission with scoped alternatives - Add file_always, folder_always, folder_recursive, project_recursive options - Implement smart UI that shows relevant options based on tool type and context - Add comprehensive tests for new permission types - Improve security by allowing precise scope control for read/edit operations ## Changes Made ### Enhanced Permission Types - **file_always**: Always allow this specific file - **folder_always**: Always allow this specific folder (non-recursive) - **folder_recursive**: Always allow this folder and all subfolders - **project_recursive**: Always allow entire project folder recursively - **Removed**: dangerous "always" option that could allow anything ### Smart UI Adaptation - File-based tools (read, edit) show all scoped options - Non-file tools (bash, etc.) show limited relevant options - Options dynamically adapt based on file context availability ### Backend Changes - Updated PermissionNext.Reply enum with new options - Added pattern generation logic for different scopes - Enhanced reply handling to process new permission types ### Testing - Added comprehensive test coverage for all new permission types - Verified pattern generation for files, folders, and project scopes - Tested both file-based and non-file tool scenarios This improves security by providing precise control over what can be accessed, replacing previous all-or-nothing approach.
yindo added the pull-request label 2026-02-16 18:18:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13826