Skip to content

Commit 75e6320

Browse files
committed
feat: make openspec-plan agent permissions fully explicit
- Add explicit allow/deny for all OpenCode permission keys - read: allow all, deny .env files - edit: deny * base, allow only spec files (project.md, AGENTS.md, openspec/**, specs/**) - bash: deny * base, allow read-only filesystem and git read commands - Add explicit allow for glob, grep, list, lsp, todoread, todowrite - Add explicit allow for webfetch, websearch, codesearch, task, skill, question - Keep doom_loop and external_directory as ask (safety guards)
1 parent 2691da4 commit 75e6320

1 file changed

Lines changed: 57 additions & 3 deletions

File tree

src/config.ts

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,68 @@ export function createConfigHook(ctx: { directory: string }): Hooks["config"] {
1919
description: "OpenSpec Architect - Plan and specify software architecture.",
2020
prompt: OPENSPEC_SYSTEM_PROMPT,
2121
permission: {
22+
// --- Read ---
23+
// Allow all reads; block .env files (no secrets needed for spec work)
24+
read: {
25+
"*": "allow",
26+
"*.env": "deny",
27+
"*.env.*": "deny",
28+
".env": "deny",
29+
".env.*": "deny"
30+
},
31+
32+
// --- Exploration tools (read-only, no side effects) ---
33+
glob: "allow",
34+
grep: "allow",
35+
list: "allow",
36+
lsp: "allow",
37+
38+
// --- Task management ---
39+
todoread: "allow",
40+
todowrite: "allow",
41+
42+
// --- Web & search ---
43+
webfetch: "allow",
44+
websearch: "allow",
45+
codesearch: "allow",
46+
47+
// --- Agent tooling ---
48+
task: "allow",
49+
skill: "allow",
50+
question: "allow",
51+
52+
// --- Safety guards ---
53+
doom_loop: "ask",
54+
external_directory: "ask",
55+
56+
// --- Edit: deny everything, allow only spec files ---
57+
// Rules are evaluated last-match-wins, so "*": "deny" must come first
2258
edit: {
23-
// Allow editing specific root files
59+
"*": "deny",
2460
"project.md": "allow",
2561
"AGENTS.md": "allow",
26-
// Allow editing anything in openspec directory
2762
"openspec/**": "allow",
28-
// Allow editing anything in specs directory (standard OpenSpec structure)
2963
"specs/**": "allow"
64+
},
65+
66+
// --- Bash: deny all by default, allow read-only filesystem + git read ---
67+
bash: {
68+
"*": "deny",
69+
"grep *": "allow",
70+
"ls": "allow",
71+
"ls *": "allow",
72+
"cat *": "allow",
73+
"find *": "allow",
74+
"echo": "allow",
75+
"echo *": "allow",
76+
"pwd": "allow",
77+
"which *": "allow",
78+
"env": "allow",
79+
"printenv *": "allow",
80+
"git status*": "allow",
81+
"git log*": "allow",
82+
"git diff*": "allow",
83+
"git show*": "allow"
3084
}
3185
},
3286
color: "#FF6B6B" // Distinctive color for the agent

0 commit comments

Comments
 (0)