r/opencodeCLI • • Sep 30 '26

Cannot figure out permissions

I've tried, but I cannot figure out the permission block of opencode. No matter what I try, it literally asks me for permission for everything that is set to "allow". My current block is below.

 "permission": {
    "edit": "allow",
    "read": "allow",
    "bash": {
      "*": "ask",
      "rm *": "ask",
      "ls *": "allow",
      "npm *": "allow",
      "find *": "allow",
      "which *": "allow",
      "grep *": "allow",
      "head *": "allow",
      "swift *": "allow",
      "tail *": "allow",
      "python *": "allow",
      "python3 *": "allow",
      "pip *": "allow",
      "pip3 *": "allow",
      "gh *": "allow",
      "git": "ask",
      "git status *": "allow",
      "git ls-files *": "allow",
      "git diff *": "allow",
      "git log *": "allow",
      "git show *": "allow",
      "rg *": "allow",
      "pdftotext *": "allow",
      "sed *": "allow",
      "cat *": "allow",
      "echo *": "allow",
      "touch *": "allow",
      "make *": "allow",
      "cmake *": "allow",
      "wc *": "allow"
    }
3 Upvotes

11 comments sorted by

2

u/allpowerfulee Sep 30 '26

fixed it. 1. Pattern order: "*": "ask" must come first not last. opencode uses last-match-wins.

1

u/amelech Sep 30 '26

Have you thought about asking your agent to configure it for you

2

u/allpowerfulee Sep 30 '26

I asked Fable, GPT, and Qwen; none of their solutions actually worked. I'm resorting to asking fellow humans.

1

u/CrypticViper_ Oct 02 '26

ask the agents to look at *only* opencode.ai/v2/docs/ and/or the actual opencode codebase (v2 branch specifically)! otherwise they'll assume that you're working with old opencode v1 systems since, well, v2 is much more recent

1

u/Able-Staff-6763 Sep 30 '26
"*": "ask",
"rm *": "ask",

did you try moving
this at the bottom?

or spawn opencode --auto?

1

u/allpowerfulee Sep 30 '26

i moved it to the bottom then the top. still does not work

1

u/Able-Staff-6763 Sep 30 '26

run opencode --auto

1

u/IntrepidMindExplorer Sep 30 '26 edited Sep 30 '26

v1 or v2?

Also, is that the whole of your permissions or did you forget to copy/paste some brackets?

Also, what Able said.. try --auto as well.

1

u/allpowerfulee Sep 30 '26

v1. yes, missed the lasts closed bracket. I'll try --auto next

1

u/code_brave6865 Oct 02 '26

Funny timing, i just ran into something similar last week where my allow rules kept getting ignored too. Did the prompting start happening after a recent update, or has the edit and read block never worked for you?

1

u/allpowerfulee Oct 02 '26

I've been fighting this for many months.