|
| 1 | +Title: Make all agents use deny-by-default permissions |
| 2 | + |
| 3 | +Problem |
| 4 | +------- |
| 5 | +Agent definitions in .opencode/agent/*.md currently include permissive or wildcard bash permission entries (e.g. "*": allow) that grant agents broader runtime capabilities than necessary. This increases risk of accidental or malicious repository changes, leaking secrets, or executing destructive commands from downstream agents. |
| 6 | + |
| 7 | +Users |
| 8 | +----- |
| 9 | +- Repository maintainers and Producers who rely on safe, auditable agent behavior |
| 10 | +- Agent authors (Forge) who will update agent definitions |
| 11 | +- Implementation agents (Patch, Probe) who may need to run commands during sessions |
| 12 | + |
| 13 | +Success criteria (testable) |
| 14 | +--------------------------- |
| 15 | +1. All agent definition files under .opencode/agent/ contain explicit, least-privilege permission rules. No agent grants a blanket "*": allow for bash. Any previously present "*": allow is either: |
| 16 | + - replaced with a minimal explicit allow-list of permitted bash patterns, or |
| 17 | + - replaced with "*": ask (or removed entirely) where interactive confirmation is required. |
| 18 | +2. A repository-level policy document is added at .opencode/agent/PERMISSIONS.md describing the deny-by-default model, recommended minimal granted patterns, and the review process for changes. |
| 19 | +3. Changes are made on a feature branch named feature/ge-urs-<short> and submitted as a PR. The PR references bd#ge-urs and contains a short summary of edits per-agent. |
| 20 | +4. Automated check: run a script (or rg) to assert no .opencode/agent/*.md file contains the pattern '"*": allow' (failure if found). This check is run locally before creating the PR. |
| 21 | + |
| 22 | +Constraints |
| 23 | +----------- |
| 24 | +- Do not change runtime/CI behavior beyond permissions metadata in .opencode/agent/*.md (no edits to CI, runtime code, or other repository policies without explicit Producer approval). |
| 25 | +- Keep each agent's permissions minimal and documented in the agent file's rationale section. |
| 26 | +- Avoid disruptive or large diffs; prefer per-agent small edits and PRs grouped logically. |
| 27 | + |
| 28 | +Existing state |
| 29 | +-------------- |
| 30 | +- Agent files are present in .opencode/agent/*.md. Some agents currently have permissive entries (e.g., Build had "*": allow; Forge had "*": ask). |
| 31 | +- A bd issue exists: ge-urs (in_progress) assigned to forge. |
| 32 | + |
| 33 | +Desired change (high-level) |
| 34 | +-------------------------- |
| 35 | +- Adopt deny-by-default: remove blanket allow rules and replace with specific minimal patterns or explicit "ask" where necessary. |
| 36 | +- Add a short PERMISSIONS.md to describe the convention and provide examples. |
| 37 | +- Provide a small automated assertion script (scripts/check-agent-permissions.sh) that returns non-zero if a wildcard allow is present. |
| 38 | + |
| 39 | +Likely duplicates / related docs |
| 40 | +------------------------------- |
| 41 | +- .opencode/agent/*.md (the files to change) |
| 42 | +- AGENTS.md and .github/copilot-instructions.md (guidance and rules) |
| 43 | +- bd issue: ge-urs |
| 44 | + |
| 45 | +Related issues |
| 46 | +-------------- |
| 47 | +- ge-urs (current task) |
| 48 | + |
| 49 | +Recommended next step |
| 50 | +--------------------- |
| 51 | +1. Confirm scope: approve this intake draft or request edits. |
| 52 | +2. If approved, I will: |
| 53 | + - Create a feature branch feature/ge-urs-permissions and update agent files conservatively (one commit per agent file changed). |
| 54 | + - Add .opencode/agent/PERMISSIONS.md and scripts/check-agent-permissions.sh. |
| 55 | + - Run the local check and open a PR referencing bd#ge-urs. |
| 56 | + |
| 57 | +Questions / open items |
| 58 | +---------------------- |
| 59 | +- Confirm whether you want a single PR updating all agents, or multiple smaller PRs (per-agent). Recommended: a single PR limited to metadata-only changes for speed. |
| 60 | +- Confirm whether replacing "*": allow with specific patterns should be done automatically (best-effort) or manually per agent with human review for each pattern. |
| 61 | + |
0 commit comments