permissions: auto mode refuses dangerous calls #179

Merged
hermes merged 1 commits from feat/auto-permit into main 2026-11-12 13:45:31 +00:00
Collaborator

Adds an auto permission mode (--auto, permissions = "auto", /auto [on|off|log]).

Per bash/write/edit call, in order:

  1. danger::classify rules BLOCK: rm -rf of home/root/project/outside project, sudo, dd/mkfs, download piped to interpreter, force push, push to main/master, credential files sent over network, publish/deploy (npm, cargo, docker push, kubectl delete, terraform destroy), SQL DROP, writes to /etc, ~/.ssh, rc files, .git/hooks. Checked per chain segment; a block wins over stored "always" rules. Model gets blocked by auto mode: <reason>.
  2. Rules ALLOW routine work inside the project.
  3. Rest: one cheap-model request (danger::Judge, Haiku/Luna, ~300 in / <=100 out tokens, 20s timeout) answers ALLOW/BLOCK; failure or no judge -> normal prompt.

yolo skips all of it. claude_cli bridge uses the same gate (gate_why, deny message passed through), no judge there.

Tests: danger.rs tables (block/allow/ask/chain/judge parse), tool.rs integration (block without prompt, stored rule cannot beat block, judge allow, yolo bypass). fmt, clippy, workspace tests, e2e, m4-m8, sandbox, claude_cli, lsp install all green.
Note: tests/tui_smoke.py "second prompt for bash" flakes ~1 in 6 runs, also on plain main (measured), so all.sh stopped there; the remaining scripts were run individually.
Untested: real Haiku/Luna judge replies (no live login here), real claude deny message format, macOS paths. Pattern rules are not a sandbox.

Adds an auto permission mode (`--auto`, `permissions = "auto"`, `/auto [on|off|log]`). Per bash/write/edit call, in order: 1. `danger::classify` rules BLOCK: rm -rf of home/root/project/outside project, sudo, dd/mkfs, download piped to interpreter, force push, push to main/master, credential files sent over network, publish/deploy (npm, cargo, docker push, kubectl delete, terraform destroy), SQL DROP, writes to /etc, ~/.ssh, rc files, .git/hooks. Checked per chain segment; a block wins over stored "always" rules. Model gets `blocked by auto mode: <reason>`. 2. Rules ALLOW routine work inside the project. 3. Rest: one cheap-model request (`danger::Judge`, Haiku/Luna, ~300 in / <=100 out tokens, 20s timeout) answers ALLOW/BLOCK; failure or no judge -> normal prompt. yolo skips all of it. claude_cli bridge uses the same gate (`gate_why`, deny message passed through), no judge there. Tests: danger.rs tables (block/allow/ask/chain/judge parse), tool.rs integration (block without prompt, stored rule cannot beat block, judge allow, yolo bypass). fmt, clippy, workspace tests, e2e, m4-m8, sandbox, claude_cli, lsp install all green. Note: `tests/tui_smoke.py` "second prompt for bash" flakes ~1 in 6 runs, also on plain main (measured), so `all.sh` stopped there; the remaining scripts were run individually. Untested: real Haiku/Luna judge replies (no live login here), real claude deny message format, macOS paths. Pattern rules are not a sandbox.
hermes added 1 commit 2026-11-12 13:44:33 +00:00
hermes merged commit 88b98ccd35 into main 2026-11-12 13:45:31 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: johannes/hx#179