r/opencode • • 12d ago

What permission/ safety should Opencode have?

Hi,

I'm fairly new to OpenCode and coding. I'm trying to setup my opencode.jsonc to balance security and convenience, avoiding harmful actions like deleting files or injections without being asked for permission constantly.

What actions do you allow?
What do you restrict or require asking?

I don't use a sandbox, that's why I'm careful

3 Upvotes

8 comments sorted by

2

u/squirrelscrush 11d ago

This is my setup: https://pastebin.com/zaRRYxcY

I have it strict in the sense that it always asks me for any external file. Maybe you can use something like Jev to automate the permissions.

1

u/Samosval-vedro-nasr 11d ago

I just use it in virtual machine. It even installs packages for me

1

u/Future_AGI 11d ago

in opencode.jsonc the newer permissions rules apply in order with the last match winning, so set shell on * to ask, then allow read-only commands like git status * and git diff *, and deny git push *, rm * and read on *.env. Edits inside the project can stay on allow, while anything outside it goes through the external_directory action, the one to keep on ask. On an older V1 config the same idea uses permission and bash as the key names.

1

u/mrspock33 9d ago edited 9d ago

No affiliation, but we've been experimenting with microsandbox (open source). While we started with docker sandbox, (which was solid), didn't like that you had to authenticate to with docker to use it, even locally. microsandbox's commands are nearly identical, so it was any easy switch. https://microsandbox.dev/

Forgot to add, they have a quick start guide for opencode. I don't use it this way, but a dead simple way to get started: https://docs.microsandbox.dev/how-to/agents/opencode

1

u/Defiant_Vehicle6882 2d ago

Quiero hacer unas pruebas de seguridad con ayuda de Open code Pero no me lo está permitiendo por qué me dice que por políticas de seguridad no puede ayudarme, saben cómo se puede hacer para que se salte esas políticas de seguridad y no se restrinja ??

1

u/_4rcadia 12d ago

Models today are smart enough to avoid most harmful actions and identity prompt injections. For the best experience I would recommend just running OpenCode under full permissions. If you are still worried:

  1. Run agents in Docker Sandboxes
  2. Use cloud agents.
  3. Backup your files.
  4. Just ask OpenCode to set it up for you. OpenCode knows it's own config & APIs.

1

u/NME-Cake 10d ago

Tbh nmr4 is a trash take - you should understand the setup aswell. Its not that complex

1

u/_4rcadia 10d ago

Not denying that. You can always read the docs and audit the config. Letting it explain is also doable. Agents don't lie, at least not deliberately.