Skip to content

Commit 4b20c99

Browse files
terisukeclaude
andcommitted
fix: set project-level permissions to work around config priority bug
User-level config at ~/.config/opencode/ has LOWER priority than project-level .opencode/opencode.jsonc. When project config exists with minimal permission rules, user-level read/bash allow rules are overridden, causing excessive permission prompts. Workaround: set comprehensive permissions at project level until the config merge behavior is fixed upstream. Fixes #31 Ref #32 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 6c20452 commit 4b20c99

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

‎.opencode/opencode.jsonc‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,110 @@
66
},
77
},
88
"permission": {
9+
// IMPORTANT: These permissions MUST be set at project-level because
10+
// user-level config (~/.config/opencode/opencode.jsonc) has LOWER priority
11+
// than project-level config. See issue #31 for details.
12+
"read": {
13+
"*": "allow",
14+
".env": "deny",
15+
".env.*": "deny",
16+
"**/.env": "deny",
17+
"**/.env.*": "deny",
18+
"secrets/**": "deny",
19+
"**/secrets/**": "deny",
20+
},
921
"edit": {
22+
"*": "allow",
1023
"packages/opencode/migration/*": "deny",
24+
".env": "deny",
25+
".env.*": "deny",
26+
"**/.env": "deny",
27+
"**/.env.*": "deny",
28+
},
29+
"glob": "allow",
30+
"grep": "allow",
31+
"list": "allow",
32+
"bash": {
33+
"*": "ask",
34+
// JS/TS toolchain
35+
"node *": "allow",
36+
"npm *": "allow",
37+
"npx *": "allow",
38+
"pnpm *": "allow",
39+
"bun *": "allow",
40+
"bunx *": "allow",
41+
"yarn *": "allow",
42+
"turbo *": "allow",
43+
"tsc *": "allow",
44+
// Python toolchain
45+
"python *": "allow",
46+
"python3 *": "allow",
47+
"pip *": "allow",
48+
"pip3 install *": "allow",
49+
"uv *": "allow",
50+
// Linters/formatters
51+
"eslint *": "allow",
52+
"prettier *": "allow",
53+
"biome *": "allow",
54+
// Test runners
55+
"jest *": "allow",
56+
"vitest *": "allow",
57+
"playwright *": "allow",
58+
// Git operations
59+
"git *": "allow",
60+
"gh *": "allow",
61+
// System utilities
62+
"ls *": "allow",
63+
"wc *": "allow",
64+
"lsof *": "allow",
65+
"test *": "allow",
66+
"set *": "allow",
67+
"dig *": "allow",
68+
"nslookup *": "allow",
69+
"cat *": "allow",
70+
"head *": "allow",
71+
"tail *": "allow",
72+
"mkdir *": "allow",
73+
"cp *": "allow",
74+
"mv *": "allow",
75+
"touch *": "allow",
76+
"chmod *": "allow",
77+
"which *": "allow",
78+
"echo *": "allow",
79+
"pwd": "allow",
80+
"env *": "allow",
81+
"sort *": "allow",
82+
"uniq *": "allow",
83+
"diff *": "allow",
84+
"grep *": "allow",
85+
"find *": "allow",
86+
"sed *": "allow",
87+
"awk *": "allow",
88+
"xargs *": "allow",
89+
// Network
90+
"curl *": "allow",
91+
"openssl *": "allow",
92+
// Container/Cloud
93+
"docker *": "allow",
94+
"vercel *": "allow",
95+
"supabase *": "allow",
96+
// Dangerous operations: deny
97+
"rm -rf *": "deny",
98+
"sudo *": "deny",
99+
"git push --force*": "deny",
100+
"git push -f *": "deny",
101+
"curl * | sh*": "deny",
102+
"curl * | bash*": "deny",
11103
},
104+
"websearch": "allow",
105+
"webfetch": "allow",
106+
"codesearch": "allow",
107+
"lsp": "allow",
108+
"task": "allow",
109+
"skill": "allow",
110+
"question": "allow",
111+
"todowrite": "allow",
112+
"external_directory": "ask",
12113
},
13114
"mcp": {},
14115
"tools": {

0 commit comments

Comments
 (0)