Skip to content

File and command permissions in OpenCode #16914

Description

@SebastienTs

Question

I understand that it is probably way more difficult to achieve on Windows than on Linux but how can I restrict my agent to not be able to access (that is no read, write but ALSO no listing whatsoever) any file outside the current project folder and ALSO prevent any bash command to target any file outside the same scope without asking?

Currently I have:

{ "$schema": "https://opencode.ai/config.json", "permission": { "bash": { "*": "ask", "* D:/OpenCode_Projects/*": "allow", }, "external_directory": {"*": "ask"} } }

But it is not ideal. Is there a wildcard for files inside the current project folder?

What if the agent write a script overcoming these restrictions and run it inside the project folder?

Also, when asked to accept a command it would be very useful to have an option "Always (Exact Same)" to only accept future execution of the exact same command, including all arguments (for instance activate a conda env and run a Python script) but not any other command.

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