Skip to content

feat(hooks): review only commands that reach past the sandbox - #178

Merged
furedea merged 1 commit into
mainfrom
feat/ask-only-outward-effects
Oct 17, 2026
Merged

furedea merged 1 commit into
mainfrom
feat/ask-only-outward-effects

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Replaying the 151 Bash commands run after #175 gave 58 non-allow verdicts. 56 of them were prompts for local commands that used a shell variable or a form the precise allowlist did not list. This PR keeps prompts for effects the sandbox cannot undo.

  • Local commands pass in any form. The allowed guard now governs only gh, curl, and wget, listed per rule under programs. Every other command passes unless a forbidden rule or the dangerous-Git guard denies it. This covers git commit -S, git -C $W add, sed -i '', cat > $D/pr.md, and unlisted subcommands of approved tools.
  • Run-time words in governed programs. A run-time word counts as a placeholder, so it passes only where any value would. gh pr view $N and gh api repos/o/$r/... --jq (reads) pass. gh api $E --method DELETE asks.
  • The Git guard asks about a run-time word only when it can hide a denial. That means a dynamic program or subcommand, an argument of a verb judged by its options (push, reset, branch, switch, checkout, restore, rm, mv, gc, worktree remove), or the repository an implicit push reads its branch from. git -C $W push origin topic, git -C $R worktree add ... $W, and git commit -m "$MSG" pass.
  • Parser fixes.
    • A lone [ is no longer a glob, so [ -d "$W" ] is not a run-time program.
    • Parameter operations such as ${c:0:7} parse. A substitution inside ${x:-$(rm -rf y)} is still denied.
  • Permissions. ln -s moves to allow. git stash drop and git stash clear stay ask, because recovering a dropped stash needs dangling-commit archaeology. The plan had listed them as recoverable; that was wrong.
  • ADR-0036 supersedes ADR-0034.

Closes #177

Verification

  • uv run --frozen pytest tests: 1459 passed. The 3 errors in tests/hermes/test_hermes_gateway.py also occur on main.
  • Replayed every Bash command from today's sessions (284) through the new hooks: 273 allow and 7 deny. The 4 remaining asks are:
    • a run-time program ($P -c ...);
    • zsh-only ${(@f)...};
    • git worktree remove $R-$w;
    • curl to a remote host.
  • The existing denials stay green: substitutions, clauses, shell heredocs, force pushes, pushes to main, --no-verify, and git add -A.
  • ruff, ty, and lefthook pre-commit passed.

🤖 Generated with Claude Code

Local commands now pass in any form unless a forbidden rule or the
dangerous-Git guard denies them. Precise forms remain only for gh, curl,
and wget, where a run-time word counts as a placeholder. The Git guard
asks about a run-time word only when it can hide a denial: the program
or subcommand, an argument of an option-judged verb, or the repository
an implicit push reads its branch from.

A lone bracket is no longer a glob, parameter operations such as
${c:0:7} parse, and ln -s is allowed. ADR-0036 supersedes ADR-0034.

Refs #177

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea
furedea merged commit 73a0618 into main Oct 17, 2026
11 checks passed
@furedea
furedea deleted the feat/ask-only-outward-effects branch October 17, 2026 08:46
furedea added a commit that referenced this pull request Oct 17, 2026
…ts (#180)

Prompts reported after #178 came from three sources other than the
allowlist.

- **Sandbox-failing Git forms are redirected.**
- The dangerous-Git guard denies `git commit -S`/`--gpg-sign`, `git tag
-s`/`--sign`/`-u`, and `git push -u`/`--set-upstream`.
- The denial message names the form that works. These forms fail inside
the sandbox, and sessions then retried them with the sandbox disabled,
which prompted.
- Options are matched as parsed arguments, so a commit message that
mentions `-S` passes.
- **`nix develop` moves to allow.** It enters the project's development
shell, which `flake.lock` pins. `nix shell` and `nix run` keep asking.
- **The shell directory scope check is dropped.**
- `cd` and `git -C` outside the registered worktree asked even for
reads. The sandbox confines shell writes, and the check never saw
absolute-path writes made without a `cd`.
  - Write, Edit, patch, and `workdir` target checks stay.

Closes #179

## Verification

- `uv run --frozen pytest tests`: 1464 passed. The 3 errors in
`tests/hermes/test_hermes_gateway.py` also occur on main.
- ruff, ty, and lefthook pre-commit passed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@furedea-agent furedea-agent Bot mentioned this pull request Nov 12, 2026
1 task done
furedea added a commit that referenced this pull request Nov 12, 2026
agent-config 0.1.2(`3b3d9c5`)を取り込みます.#74 のモデル判定まわりの残りがすべて入ります.

| 取り込む変更(furedea/agent-config) | 中身 |
| --- | --- |
| #172 | 「ルールの見本のフォルダ」の判定を 1 か所にまとめる |
| #173 | jev-lint の子プロセスに `GIT_LITERAL_PATHSPECS=1` を渡す(#159) |
| #174 | 時間に頼らないタイムアウトのテスト(#171) |
| #175,#178 | Go と Rust のルールの穴と,境目の見本(#164) |
| #180 | 読み取り専用の GraphQL の問い合わせのあとに `jq` を付けてよくする |
| #177 | Stop のテストの行を,ランナーごとに 1 つの件数にまとめる(Rust は `312 passed` のように合計する)
|

- [x] `darwin-rebuild switch` で反映済み

ほかのセッションが main の古い `flake.lock` で反映すると,これらが取り消されます.早めにマージします.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ask only for commands whose effects leave the sandbox

1 participant