Allowlist: readonly entry, on_deny = continue, tokens of stopped runs (#20)

This commit was merged in pull request #20.
This commit is contained in:
hermes committed 2026-11-14 12:54:15 +00:00
1 parent 9ce4756fad
commit 39a2e74742
11 files changed
+487 -89

No files matched your search

+11
View File
@@ -18,12 +18,23 @@ sandbox = true # hx --sandbox (bwrap); required for yolo = tru
- Absent: no policy, hx may use every tool (orch prints a warning unless `sandbox = true`).
- `TOOL` allows every call of that tool (`read`, `write`, `edit`, `bash`, `lsp`, ...), `*` allows all.
- `readonly`: bash commands that only look, one simple command each: `ls cat head tail wc grep rg fd find pwd echo
stat file du df which tree diff sort cut nl tr jq basename dirname` and `git status|diff|log|show|blame|ls-files|rev-parse`.
Flags that run or write are refused per command (`find -exec/-delete/-fprint*`, `fd -x/--exec`, `rg --pre`,
`sort -o/--output`, `tree -o`, `git --output/--ext-diff/--textconv`), and so are `git -C`, other git subcommands and
anything outside the worktree. Typical profile: `allow = ["read", "write", "edit", "readonly", "Grep", "Glob", "LS",
"bash:cargo *"]`. In `claude_cli` mode Claude's other tools arrive under Claude's own names and need their own entry.
- `bash:PATTERN`: `*` glob over the whole command. Only simple commands match (no `; & | < > $ ( ) { } \` or
newline); path-like words must resolve inside the worktree or `read_roots`.
- Always denied, even with `*`: `git push` (publishing is the sink's job), credential-looking paths (`.env*`,
`.ssh`, `.aws`, `auth.json`, `*.pem`, `*.key`, ...), file tools outside the worktree (reads may also use
`read_roots`), writes to `.git` and `.hx`.
- A denied call ends the run as `needs-human` with `reason = "policy: ..."`; the branch keeps what was done so far.
- `on_deny = "continue"` (default `"stop"`): a call that is merely **not in the allowlist** is answered to the agent
(`orch-guard-soft: ... Use another way`), the tool does not run and the run goes on; the gate decides in the end.
**Hard** denies always stop the run: credential-looking paths, paths outside the worktree, `git push`, writes to
`.git`/`.hx`. Every deny is audited (`decision: deny`, `hard: true|false`) and counted (`denies` in the run state,
telemetry and the `denies` column of `orch report`).
Enforced twice: `orch guard` runs inside hx as an extension (installed as the worktree's `.hx/config.toml`, removed
after each attempt, rewritten before the next) and blocks the call before it executes. orch also checks every