-
Notifications
You must be signed in to change notification settings - Fork 0
fix: project-level permissions to work around config priority bug #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,9 +6,110 @@ | |||||||||||||||||||||
| }, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| "permission": { | ||||||||||||||||||||||
| // IMPORTANT: These permissions MUST be set at project-level because | ||||||||||||||||||||||
| // user-level config (~/.config/opencode/opencode.jsonc) has LOWER priority | ||||||||||||||||||||||
| // than project-level config. See issue #31 for details. | ||||||||||||||||||||||
| "read": { | ||||||||||||||||||||||
| "*": "allow", | ||||||||||||||||||||||
| ".env": "deny", | ||||||||||||||||||||||
| ".env.*": "deny", | ||||||||||||||||||||||
| "**/.env": "deny", | ||||||||||||||||||||||
| "**/.env.*": "deny", | ||||||||||||||||||||||
| "secrets/**": "deny", | ||||||||||||||||||||||
| "**/secrets/**": "deny", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| "edit": { | ||||||||||||||||||||||
| "*": "allow", | ||||||||||||||||||||||
| "packages/opencode/migration/*": "deny", | ||||||||||||||||||||||
| ".env": "deny", | ||||||||||||||||||||||
| ".env.*": "deny", | ||||||||||||||||||||||
| "**/.env": "deny", | ||||||||||||||||||||||
| "**/.env.*": "deny", | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| "glob": "allow", | ||||||||||||||||||||||
| "grep": "allow", | ||||||||||||||||||||||
| "list": "allow", | ||||||||||||||||||||||
| "bash": { | ||||||||||||||||||||||
| "*": "ask", | ||||||||||||||||||||||
| // JS/TS toolchain | ||||||||||||||||||||||
| "node *": "allow", | ||||||||||||||||||||||
| "npm *": "allow", | ||||||||||||||||||||||
| "npx *": "allow", | ||||||||||||||||||||||
| "pnpm *": "allow", | ||||||||||||||||||||||
| "bun *": "allow", | ||||||||||||||||||||||
| "bunx *": "allow", | ||||||||||||||||||||||
| "yarn *": "allow", | ||||||||||||||||||||||
| "turbo *": "allow", | ||||||||||||||||||||||
| "tsc *": "allow", | ||||||||||||||||||||||
| // Python toolchain | ||||||||||||||||||||||
| "python *": "allow", | ||||||||||||||||||||||
| "python3 *": "allow", | ||||||||||||||||||||||
| "pip *": "allow", | ||||||||||||||||||||||
| "pip3 install *": "allow", | ||||||||||||||||||||||
| "uv *": "allow", | ||||||||||||||||||||||
| // Linters/formatters | ||||||||||||||||||||||
| "eslint *": "allow", | ||||||||||||||||||||||
| "prettier *": "allow", | ||||||||||||||||||||||
| "biome *": "allow", | ||||||||||||||||||||||
| // Test runners | ||||||||||||||||||||||
| "jest *": "allow", | ||||||||||||||||||||||
| "vitest *": "allow", | ||||||||||||||||||||||
| "playwright *": "allow", | ||||||||||||||||||||||
| // Git operations | ||||||||||||||||||||||
| "git *": "allow", | ||||||||||||||||||||||
| "gh *": "allow", | ||||||||||||||||||||||
| // System utilities | ||||||||||||||||||||||
| "ls *": "allow", | ||||||||||||||||||||||
| "wc *": "allow", | ||||||||||||||||||||||
| "lsof *": "allow", | ||||||||||||||||||||||
| "test *": "allow", | ||||||||||||||||||||||
| "set *": "allow", | ||||||||||||||||||||||
| "dig *": "allow", | ||||||||||||||||||||||
| "nslookup *": "allow", | ||||||||||||||||||||||
| "cat *": "allow", | ||||||||||||||||||||||
| "head *": "allow", | ||||||||||||||||||||||
| "tail *": "allow", | ||||||||||||||||||||||
| "mkdir *": "allow", | ||||||||||||||||||||||
|
Comment on lines
+69
to
+72
|
||||||||||||||||||||||
| "cp *": "allow", | ||||||||||||||||||||||
| "mv *": "allow", | ||||||||||||||||||||||
| "touch *": "allow", | ||||||||||||||||||||||
| "chmod *": "allow", | ||||||||||||||||||||||
| "which *": "allow", | ||||||||||||||||||||||
| "echo *": "allow", | ||||||||||||||||||||||
| "pwd": "allow", | ||||||||||||||||||||||
|
||||||||||||||||||||||
| "pwd": "allow", | |
| "pwd *": "allow", |
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deny rules for curl | sh / curl | bash rely on spaces around the pipe ("curl * | sh*"). The bash permission patterns are matched against the raw command text, so variants like curl ...|sh, curl ...| bash, or extra whitespace won’t match and will fall back to the broader "curl *": "allow" rule. Add additional deny patterns that cover common spacing variants (or change curl * to ask).
| "curl * | sh*": "deny", | |
| "curl * | bash*": "deny", | |
| "curl * | sh*": "deny", | |
| "curl *| sh*": "deny", | |
| "curl * |sh*": "deny", | |
| "curl *|sh*": "deny", | |
| "curl * | bash*": "deny", | |
| "curl *| bash*": "deny", | |
| "curl * |bash*": "deny", | |
| "curl *|bash*": "deny", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grepis set toallow, but the grep tool’s permission check is only against the search pattern (not the files searched) and it runs ripgrep across the repo (including hidden files). That means secrets in.envcan still be discovered viagrepeven thoughreaddenies.env. If the intent is “.env access is denied”, consider settinggrepback toask/deny(or narrowing it), since the permission model can’t currently restrict grep by filepath.