Skip to content

Permission system: bash commands can create files outside permitted directories #18396

Closed as not planned

Description

@hcoin18

Bug Description

The permission system for external_directory in opencode.json only blocks file writes via the write/edit tools for non-permitted directories, but allows bash commands to create files outside permitted directories as a side effect.

Steps to Reproduce

  1. Set up opencode.json with limited external_directory permissions:
{
  "permission": {
    "external_directory": {
      "/opt/ai/opencode/**": "allow",
      "/tmp/**": "allow"
    }
  }
}
  1. Run a bash command that creates files outside permitted directories:
python3 -m venv /home/user/venv
  1. The venv is created successfully in /home/user/, bypassing the permission system.

Expected Behavior

  • The write/edit tools correctly block writes to non-permitted directories
  • However, bash commands that create files as a side effect should also be blocked or require confirmation
  • A configuration like write_confirmation_required: true at the permission level (or equivalent) should apply to all write operations including those via bash

Additional Context

The permission model is incomplete - it separates "direct file writes" (via tools) from "indirect file writes" (via bash commands). This creates a gap where users can inadvertently create files outside permitted directories.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 20, 2026
  2. github-actions commented on Mar 20, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions