Repository navigation
fix(hooks): close shell-syntax bypasses of the guard hooks - #11
Merged
Merged
Conversation
guard_git and guard_command parsed `bash -c` scripts and heredocs fed to a shell, but not `echo "..." | sh` or `sh <<< "..."`, so a destructive command passed that way went unjudged. A literal echo or plain printf piped into a shell, and a static here-string, are now parsed as nested commands; any other input source asks for review. Word decoding moves to shell_words so shell_syntax stays within the file-length limit. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
git accepts any unique prefix of a long option, so `git reset --har` ran a hard reset while guard_git saw no `--hard`. Options before `--` are now spelled out against each judged verb's long options; an ambiguous prefix stays as written, since git rejects it. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`cat .en*` reads .env, but the secret path guard compared the glob text with each rule as if it were a literal path. A glob that narrows the file name is now matched against the rule's own text, judged without expanding it on the file system, and a partly quoted glob is unquoted first. A bare `*` stays unjudged, like any word that names no path. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The secret commit check matched only commands that start with `git commit` and read the hook's own working directory, so `cd x && git commit` and `git -C x commit` went unchecked. Each git commit in the parsed command is now checked in the directory reached through any preceding cd and its own -C, --git-dir, and --work-tree options. A directory known only at run time blocks the commit, and configuration options from the command are never passed to git. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A cd inside a subshell or before || may leave the commit where it started, so each commit is now checked in every directory the command may have reached, skipping those where git cannot list staged files since the commit fails there too. A command the parser cannot read no longer skips a commit that uses cd or -C, and a run-time value of a -c option no longer blocks the commit. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aths `cat ~/.ss*/id_rsa`, `cat id_*`, and `cat secret*` still escaped the glob check: only the file name was compared, and a word with neither `/` nor `.` was never judged. Globs are now compared with each rule segment by segment, letting a rule's `**` span any number of segments, and a glob that narrows a name is judged like a path. A bare `*` segment still overlaps only a rule segment that is itself a glob. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Spelling out abbreviations turns `--force-c` into `--force-create`, the long form of `-C`, which the destructive options did not list. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Scripts passed to dash or ksh through -c, a heredoc, a here-string, or a pipe were not parsed, unlike those passed to sh, bash, and zsh. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`GIT_DIR=x git commit` and similar assignments point the commit at a repository or index the staged check does not read, so such a commit is now blocked like one whose directory is known only at run time. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 tasks
`cat {.env,x}` reads .env, but the brace word was matched as written.
Comma braces are now expanded as the shell does before the secret path
check, up to a bound that keeps the hook from stalling.
Refs #3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tution `sh < file` now has the file read at hook time and its content judged as nested commands, asking when it is not a readable regular file or its name is computed. `sh <(...)` asks, like `curl ... | sh`. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`git branch --delete --force`, `--delete -f`, `-d --force`, and `-df` delete an unmerged branch exactly as `-D` does. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A commit inside a command the parser cannot read was blocked when it might use another repository. It now asks the user instead; providers whose hooks cannot ask still deny it. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…yntax The secret path check needs the same view of where a command runs as the commit check, so the cd tracking moves next to the parser. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comparing a glob with each secret rule's text blocked harmless globs such as `cat *.json` or `cat .*` whenever some secret name could fit. An unquoted glob is now expanded as the shell would, against the files that exist at hook time in every directory the command may reach, and `~` against the home directory; only an actual secret match blocks. A glob in a directory known only at run time needs review. Path extraction moves to shell_paths. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only the last input redirection reaches the shell, but the hook joined them, so `sh <<< '"' <<< 'git reset --hard #"'` parsed as one quoted word and passed. A shell with more than one input redirection now asks. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`env -C x git commit` ran the commit in x while only the starting directory was checked; env's -C and --chdir now count as directories the command may reach. `env GIT_''INDEX_FILE=y git commit` hid the variable from the raw-text search, which now ignores quoting. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`cat $HOME/.ssh/id_*` expanded to nothing because $HOME stayed literal, so the glob dropped out of the secret path check. $HOME is now resolved before expansion, and a glob that still holds a run-time value needs review. Brace expansion past its limit also needs review instead of silently dropping the remaining words. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`echo 'git reset --hard' | sh 3<<< 'git status'` passed because a redirection of descriptor 3 was judged as the shell's script, and `cd nested && sh < script.sh` read the starting directory's file. Only redirections of descriptor 0 now count, a duplicated descriptor asks, and a script file is read in every directory the shell may run in. Input handling moves to shell_input, and the tree walk to shell_words, to keep shell_syntax within the file-length limit. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…it check `env -u VAR -C x git commit` took VAR for the program and missed the directory change, and `GIT_\<newline>DIR=` escaped the variable search. env's -u and --unset values are now skipped, and line continuations are removed before the search. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`cat **/*.json` missed nested/deeper/api_key.json because ** matched a single directory level. It now spans directories, as zsh and bash with globstar expand it. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`git restore --stag --no-staged file` restores the working tree, but the option set still held --staged and passed. -S, -W, and their negations are now applied in order, short clusters included. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`(sh) <<< "..."` and `{ sh; } <<< "..."` hand the shell a script
through the compound command's redirection, which went unread. A shell
now also reads input its enclosing compound command redirects, asking
when that meets a pipe. Script files found in several directories are
parsed one by one, so one file's comment cannot swallow another's
command.
Refs #3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`sh < script.sh` whose script sets GIT_INDEX_FILE before committing escaped the variable search, which read only the command text. The search now covers every parsed command, scripts included. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A recursive glob such as `~/**/*.json` walked the whole tree before every command and could stall the hook past its timeout. Globs now expand through a walk that skips hidden, dependency, and Nix store trees and needs review after 10000 directory entries. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Skipping dependency and store trees let `cat **/*.key` read a key under target/ or node_modules/ unjudged. The walk now enters every directory the shell's globstar enters, and the visit bound alone keeps a large tree from stalling the hook by asking for review. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`sh 00<<< ...` redirects standard input, `env -C . -C x` runs in x, and `GIT_INDEX_FILE+=x` sets the variable when it is unset; each was misread. Descriptors are compared as numbers, the last env -C wins, and appending assignments count as assignments. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ADR-0013 and ADR-0014 are taken by the open bootstrap-server parity change. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`cat data/**` reads every file below data, but the walk returned only what followed a ** segment, so a trailing ** named nothing. Refs #3 Co-Authored-By: Claude Opus 5.5 <[email protected]>
`echo git {reset,--hard} | sh` writes `git reset --hard`, but the hook
decoded the brace word as written. An echo or printf word the shell
splits or expands, braces included, now asks.
Refs #3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 tasks
furedea
added a commit
that referenced
this pull request
Oct 24, 2026
…mmand (#17) ## 概要 レーンが Claude の実装を Codex にレビューさせるとき,skill が「the Codex review command」としか書いていなかったため,レーンが `codex-companion.mjs review` を選び,検証の hook に拒否されました(#11).レビューに使うコマンドと,回数・直す範囲の決まりを書きます. - `agents/skills/git-workflow/references/branches.md` - `agents/skills/herdr-delegation/SKILL.md` | 頼み方 | 扱い | |---|---| | `task "<prompt>"`(`--write` なし) | つなぎの標準.読み取り専用.依頼文に,要件の在りか(手元のファイルか本文.Codex はネットワークに出られない),差分の範囲 `origin/main...HEAD`,読み取り専用であること,どのファイルでも読んで確かめてよいこと,指摘ごとに P0〜P3 を付けること,弱い指摘より指摘なしを選ぶこと,文体と名前は指摘しないことを入れる | | `review` | 今は使わない.hook が専用の会話を拒否するため(修正は #19) | | `adversarial-review` | 危険の大きい変更や設計が大きく分かれる変更で,設計を疑わせたいときだけ | レビューは最初と確認の 2 回まで.自動で直すのは P0 と P1 だけで,P2 以下と設計の判断は PR 本文か Issue に書いてユーザーに回します.`LANE-READY` の条件も「P0 と P1 の指摘が残っていない」に合わせました.実装の依頼(`task --write`,`codex:rescue`)の記述は変えていません. ## 対象外 `review` の会話を hook で通せるようにすること(#19). ## テスト 文言を固定するテストは追加していません(`tests/test_workflow_skill_layout.py` は prose の主張を検査しない方針).`uv run pytest tests/test_workflow_skill_layout.py` は 64 件成功しました. ## レビュー 新しい決まりに沿った `task` で 1 回レビューし,指摘はありませんでした.Codex のサンドボックスでは pytest を実行できず,テストの合格はレーン側と CI で確認しています. ## 履歴 方針の変更ごとに書き換えたため,コミットが複数あります(squash merge 前提). Closes #14 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]> Co-authored-by: furedea-agent[bot] <343832694+furedea-agent[bot]@users.noreply.github.com>
furedea
added a commit
that referenced
this pull request
Oct 24, 2026
## 概要 ADR-0015 の契約に照らして,#18 の項目のうち契約 1 の違反または誤検知として直せるものを直した. - `**/` の付かない秘密パスのルール(`.env`,`.env.*`,`credentials.json`,`id_rsa`,`id_ed25519`,`service-account*.json`)を,どの深さでも一致するよう定義側で修正した. - commit 検査・glob 展開・暗黙の push 先の判定を,hook プロセスの作業ディレクトリではなく payload の `cwd` 基準にした(`hook_input.payload_directory`). - オプションの別引数の値は長いオプションの省略形として正規化しない(`git tag -m --sig v1`). - `sudo` をプロセスラッパーとして扱い,包まれたコマンドを判定する(`sudo VAR=val <cmd>` も対象).追跡できない `-D`/`-R` は確認に回す. ## 受け入れる制限 残りの項目は #18 にコメントで理由を記録した. ## レビュー Opus サブエージェントのレビューで P1 が 2 件あり,修正済み(`sudo VAR=val <cmd>` の判定,`sudo -D`/`-R` を確認に回す). P2 以下: - 未知の sudo オプションは parse 段階で ask になり,従来の forbidden による deny より緩い扱いになる(要件どおり). - 直接起動した guard で,入れないディレクトリへの chdir 失敗は try の外で起きる.adapter 経由では先に chdir 済みで影響しない. Closes #18 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
furedea
pushed a commit
that referenced
this pull request
Nov 10, 2026
🤖 I have created a release *beep* *boop* --- ## 0.1.0 (2026-11-10) ### Features * add devin provider to hooks.json with hook adapter (furedea/dotfiles[#136](#136)) ([5bc5550](5bc5550)) * add git-commit-split skill ([35f4e16](35f4e16)) * add Hermes Agent and pi hook providers (furedea/dotfiles[#138](#138)) ([ed3a774](ed3a774)) * add lock-settings, report-doc-conflict, and report-hook-block skills ([35b8585](35b8585)) * **agents:** add Rust style skill ([a82df41](a82df41)) * **agents:** allow cd, sed, awk, xargs, cp, and mv under the sandbox (furedea/dotfiles[#165](#165)) ([5783f87](5783f87)) * **agents:** bootstrap the harness on servers without Nix ([80a0f9b](80a0f9b)) * **agents:** chain git add, status, commit, and push outside the sandbox (furedea/dotfiles[#169](#169)) ([dd5a05c](dd5a05c)) * **agents:** Codex implements, Claude reviews, and lanes clean up opened workspaces (furedea/dotfiles[#266](#266)) ([c9a3fd9](c9a3fd9)) * **agents:** generate hook settings from nix ([b20d592](b20d592)) * **agents:** hand approved lanes to Herdr task worktree sessions (furedea/dotfiles[#184](#184)) ([58a591f](58a591f)) * **agents:** own personal agent source (furedea/dotfiles[#52](#52)) ([51060b1](51060b1)) * **agents:** permit commands by reversibility (furedea/dotfiles[#124](#124)) ([bb96256](bb96256)) * **agents:** run agent git inside the sandbox with unsigned commits (furedea/dotfiles[#172](#172)) ([1492f3e](1492f3e)) * **agents:** start Herdr Claude lanes on Sonnet at medium effort (furedea/dotfiles[#257](#257)) ([3caf8d5](3caf8d5)) * **agents:** write PR bodies inline and close lanes' parent workspaces (furedea/dotfiles[#211](#211)) ([8c6df4e](8c6df4e)) * **claude:** close the sandbox escape and reach the Nix daemon inside (furedea/dotfiles[#191](#191)) ([b61f2ac](b61f2ac)) * **claude:** let Go CLIs verify TLS inside the sandbox (furedea/dotfiles[#167](#167)) ([282b3d2](282b3d2)) * **claude:** let sandboxed commands listen on local ports (furedea/dotfiles[#206](#206)) ([36c09d2](36c09d2)) * **claude:** run the Codex plugin companion outside the sandbox (furedea/dotfiles[#232](#232)) ([0255159](0255159)) * **codex:** let Codex write, test, and deliver inside the sandbox (furedea/dotfiles[#200](#200)) ([33a0a82](33a0a82)) * compose Herdr and Moshi agent hooks (furedea/dotfiles[#33](#33)) ([4951ee8](4951ee8)) * **dsh:** add the dsh hook adapter ([#101](#101)) ([db86f57](db86f57)) * **git-commit-split:** accept mode from slash-command argument ([10c3ef7](10c3ef7)) * **git-commit-split:** modularize commit splitting workflow with branch ([bab6f19](bab6f19)) * **github:** add repository creation script ([1a7910b](1a7910b)) * **hermes:** use Apple Mail for mail access (furedea/dotfiles[#69](#69)) ([94268fa](94268fa)) * **hooks:** add related test selection rules ([2aca101](2aca101)) * **hooks:** add shared audit and command guard hooks ([6ab33b5](6ab33b5)) * **hooks:** allow read-only local curl diagnostics and log syntax ask kinds (furedea/dotfiles[#287](#287)) ([83cd643](83cd643)) * **hooks:** ask before an agent adds a lint suppression (furedea/dotfiles[#214](#214)) ([b767665](b767665)) * **hooks:** ask only for effects that escape the sandbox (furedea/dotfiles[#163](#163)) ([21409a5](21409a5)) * **hooks:** block destructive non-push git operations ([cc02cb4](cc02cb4)) * **hooks:** escalate unrecognized command forms to a prompt (furedea/dotfiles[#159](#159)) ([e30de17](e30de17)) * **hooks:** fast-forward main after cleaning up merged lanes (furedea/dotfiles[#210](#210)) ([f8a60af](f8a60af)) * **hooks:** honor project allow rules only from trusted owners ([#33](#33)) ([305d391](305d391)) * **hooks:** improve lint-format feedback across providers ([8a512f6](8a512f6)) * **hooks:** judge heredocs, substitutions, loops, and redirections structurally (furedea/dotfiles[#175](#175)) ([9276283](9276283)) * **hooks:** let sessions lock flake inputs and close their own lanes (furedea/dotfiles[#208](#208)) ([f109b49](f109b49)) * **hooks:** let the parent run cleanup_worktrees.py after merge (furedea/dotfiles[#300](#300)) ([fc44c74](fc44c74)) * **hooks:** remove merged task worktrees and branches at session start (furedea/dotfiles[#185](#185)) ([2701e0b](2701e0b)) * **hooks:** replay recent commands through the hooks (furedea/dotfiles[#199](#199)) ([2ed4984](2ed4984)) * **hooks:** report ast-grep rule findings after an edit ([#119](#119)) ([ff91d8c](ff91d8c)) * **hooks:** review only commands that reach past the sandbox (furedea/dotfiles[#178](#178)) ([40c97da](40c97da)) * **hooks:** run zizmor offline after workflow edits (furedea/dotfiles[#295](#295)) ([79b66a6](79b66a6)) * **hooks:** scan with the shared ast-grep rules shipped beside the hooks ([#121](#121)) ([35a9270](35a9270)) * **hooks:** support Go projects in formatting, verification, and permissions ([#57](#57)) ([5506f3c](5506f3c)) * **hooks:** verification selection, unified patch input, formatter/linter ordering (furedea/dotfiles[#144](#144)) ([99a825b](99a825b)) * **lint:** add the first ten ast-grep rules and drop the prose they replace ([#117](#117)) ([c235eb5](c235eb5)) * **nix:** expose the plain agents path as passthru.tree of agent-source ([#94](#94)) ([63632e4](63632e4)) * **security:** add a program_path option that pins a rule's program to one absolute path ([#61](#61)) ([d629ca9](d629ca9)) * **security:** allow agent-browser and agent-desktop except named risky forms ([#63](#63)) ([8dc8da5](8dc8da5)) * **security:** allow cargo caches, crates.io, and OSV in the sandbox ([#60](#60)) ([2f29423](2f29423)) * **security:** allow Go caches and module hosts in the sandbox ([#58](#58)) ([4b3a35c](4b3a35c)) * **security:** ask for every docker form the allowlist does not list ([#54](#54)) ([764374f](764374f)) * **security:** deny the 1Password CLI and keep the Codex login in the keyring ([#52](#52)) ([0580825](0580825)) * **skill-auditor:** support Codex audit workflow ([0d88c3f](0d88c3f)) * **skills:** add measurement-evidence and change-type evidence to tsdd ([#70](#70)) ([85714b5](85714b5)) * **skills:** clarify names and add Herdr delegation (furedea/dotfiles[#127](#127)) ([e6576ba](e6576ba)) * **skill:** skill-auditor by nyosegawa/skills/skill-auditor ([f191132](f191132)) * **skills:** render provider-specific SKILL.md frontmatter ([44325e5](44325e5)) * **statusline:** render the status on one line (furedea/dotfiles[#110](#110)) ([03ad85e](03ad85e)) * update bash-style skill instructions ([9ab1d65](9ab1d65)) * update github-ci-init skill templates ([d238f51](d238f51)) * verify agent changes through native hooks (furedea/dotfiles[#106](#106)) ([923b0ae](923b0ae)) ### Bug Fixes * **agents:** accept generated command permissions (furedea/dotfiles[#66](#66)) ([0af9650](0af9650)) * **agents:** allow gh api reads that pass --allow-escape-sequences (furedea/dotfiles[#265](#265)) ([e732939](e732939)) * **agents:** apply harness review findings (furedea/dotfiles[#149](#149)) ([c8a51d7](c8a51d7)) * **agents:** cap Codex session-end timeout ([2f29a7e](2f29a7e)) * **agents:** deny codex-companion calls the sandbox exclusion cannot match (furedea/dotfiles[#269](#269)) ([25518ab](25518ab)) * **agents:** harden hooks and separate workflow responsibilities (furedea/dotfiles[#128](#128)) ([7e508c4](7e508c4)) * **agents:** let pnpm fetch from the npm registry inside the sandbox (furedea/dotfiles[#222](#222)) ([ac114e8](ac114e8)) * **agents:** let the forbidden rule admit Sonnet lane arguments (furedea/dotfiles[#259](#259)) ([f1b29a9](f1b29a9)) * **agents:** make the bootstrap hint work for POSIX login shells ([c2667fa](c2667fa)) * **agents:** stop asking for commands the hooks can prove safe (furedea/dotfiles[#242](#242)) ([a93d241](a93d241)) * **agents:** wait for hook state locks instead of failing with EAGAIN (furedea/dotfiles[#285](#285)) ([673c108](673c108)) * allow secret scanner hook files ([bca4207](bca4207)) * **bootstrap:** give Codex the agent GitHub token settings and run the bootstrap in CI ([#21](#21)) ([25de080](25de080)) * **bootstrap:** keep Neovim's fallback nvim.log out of the working directory ([#43](#43)) ([3c9fc5c](3c9fc5c)) * **bootstrap:** make the server bootstrap behave like the Nix hosts ([#15](#15)) ([4554dec](4554dec)) * **bootstrap:** print actionable profile and legacy-file messages only when needed ([#49](#49)) ([1918254](1918254)) * **bootstrap:** target the login profile bash actually reads ([#50](#50)) ([0dae5bf](0dae5bf)) * **bootstrap:** verify downloaded tools against pinned checksums ([#111](#111)) ([1744df3](1744df3)) * **ci:** install the locked agent-harness instead of reading it from the flake ([bc2395b](bc2395b)) * **ci:** provide the shell format config and locked JavaScript tools ([dd59634](dd59634)) * **claude:** trust only the CA store bundled with Claude Code (furedea/dotfiles[#284](#284)) ([34be271](34be271)) * **codex:** fall back to auth.json when no keyring is available ([#62](#62)) ([79b6ceb](79b6ceb)) * correct agent tooling and Hister activation (furedea/dotfiles[#85](#85)) ([4bab065](4bab065)) * honor pytest testpaths and bootstrap bats on servers (furedea/dotfiles[#116](#116)) ([b17b59e](b17b59e)) * **hooks:** allow double quoted commit messages ([fc4afd4](fc4afd4)) * **hooks:** bound curl -o, -d and -H in the localhost rule (furedea/dotfiles[#291](#291)) ([7c9db8a](7c9db8a)) * **hooks:** close shell-syntax bypasses of the guard hooks ([#11](#11)) ([c6aacdf](c6aacdf)) * **hooks:** close the guard contract gaps from [#11](#11) review ([#31](#31)) ([db318db](db318db)) * **hooks:** deny codex-companion calls whose text holds a dollar sign or backtick (furedea/dotfiles[#290](#290)) ([f37c317](f37c317)) * **hooks:** find GNU grep on PATH instead of the first grep (furedea/dotfiles[#193](#193)) ([99ba317](99ba317)) * **hooks:** format without dotfiles-installed dprint and prettier configs ([#16](#16)) ([db21f55](db21f55)) * **hooks:** ignore git-ignored sources when judging a project removed ([#22](#22)) ([97c6b93](97c6b93)) * **hooks:** ignore prose arguments when matching forbidden patterns (furedea/dotfiles[#189](#189)) ([d2049d6](d2049d6)) * **hooks:** judge each command as one line with any grep (furedea/dotfiles[#196](#196)) ([202f937](202f937)) * **hooks:** keep merged worktrees holding non-regenerable ignored files ([#29](#29)) ([ac03cfa](ac03cfa)) * **hooks:** keep the first grep when no GNU grep is on PATH (furedea/dotfiles[#195](#195)) ([a0e6a2f](a0e6a2f)) * **hooks:** keep the verification snapshot from locking out symlinked or large worktrees ([#66](#66)) ([7d13f0e](7d13f0e)) * **hooks:** let cleanup_worktrees remove Claude Code session files ([#36](#36)) ([0a910bc](0a910bc)) * **hooks:** let cleanup_worktrees tests choose the untrusted locations (furedea/dotfiles[#306](#306)) ([e82980e](e82980e)) * **hooks:** let GitHub API reads take an unquoted jq filter (furedea/dotfiles[#198](#198)) ([5b6210a](5b6210a)) * **hooks:** make stop verification reliable (furedea/dotfiles[#81](#81)) ([04a33dd](04a33dd)) * **hooks:** preserve verification evidence (furedea/dotfiles[#87](#87)) ([4b5b9c2](4b5b9c2)) * **hooks:** redirect sandbox-failing Git forms and drop covered prompts (furedea/dotfiles[#180](#180)) ([34e39a7](34e39a7)) * **hooks:** resolve Rust integration test targets inside tests subdirectories (furedea/dotfiles[#304](#304)) ([2ccf547](2ccf547)) * **hooks:** respect project formatters and bound diagnostics (furedea/dotfiles[#131](#131)) ([30e83cf](30e83cf)) * **hooks:** scope generic secret regex to quoted values ([fc09292](fc09292)) * **hooks:** silence successful hook execution ([795d8f0](795d8f0)) * **hooks:** skip JavaScript triggers in projects without JavaScript tests (furedea/dotfiles[#161](#161)) ([dc80e28](dc80e28)) * **hooks:** skip verification for a language whose project was removed ([#6](#6)) ([4a9f325](4a9f325)) * **hooks:** support relocated harness assets (furedea/dotfiles[#82](#82)) ([59057bc](59057bc)) * **hooks:** treat any gh api call without write flags as a read (furedea/dotfiles[#201](#201)) ([3ecb215](3ecb215)) * **hooks:** treat glob characters inside double quotes as literal for literal_words rules ([#41](#41)) ([174a7f9](174a7f9)) * **hooks:** use agent-neutral guidance ([37153ce](37153ce)) * improve agent notifications and session setup (furedea/dotfiles[#92](#92)) ([9bf2349](9bf2349)) * load secret patterns from hook directory ([ca465ef](ca465ef)) * migrate dotfiles path to ghq convention ([faff774](faff774)) * **nix:** build CPython 3.15.2 for the ssl eMudhra denylist ([#113](#113)) ([faba045](faba045)) * **nix:** default editor to Neovim (furedea/dotfiles[#105](#105)) ([2a9a22a](2a9a22a)) * resolve hook directory from bash source ([c6ca454](c6ca454)) * restore SSH signing and reliable Bats verification (furedea/dotfiles[#91](#91)) ([891adce](891adce)) * **sandbox:** deny writes to every repository's git hooks and config (furedea/dotfiles[#298](#298)) ([1941513](1941513)) * **sandbox:** match the Codex plugin script under any numeric version (furedea/dotfiles[#302](#302)) ([a49ddc3](a49ddc3)) * **security:** allow the Go checksum tree head and vulnerability database in the sandbox ([#59](#59)) ([af6e158](af6e158)) * **security:** ask for every script a non-bash shell receives ([#99](#99)) ([f88f8fd](f88f8fd)) * **security:** close quoted-argument and wrapper bypasses in the command guard ([#76](#76)) ([5f72757](5f72757)) * **security:** close the remaining command guard bypasses ([#83](#83)) ([0387739](0387739)) * **security:** decide not-a-fork for project rules on hosts without gh ([#67](#67)) ([acaa758](acaa758)) * **security:** keep agent-browser and agent-desktop calls inside the sandbox ([#64](#64)) ([3f2d578](3f2d578)) * **security:** read more of the scripts handed to fish and PowerShell for deny rules ([#110](#110)) ([2c652bb](2c652bb)) * **skills:** audit Codex skill observations (furedea/dotfiles[#88](#88)) ([f429967](f429967)) * **skills:** refine routing triggers from audit ([cef3b9c](cef3b9c)) * **tests:** make git test wrappers exec the real git binary (furedea/dotfiles[#310](#310)) ([893c405](893c405)) * **tests:** stop shifting past the codex wrapper arguments ([eb0f6d7](eb0f6d7)) ### Performance Improvements * **hooks:** evaluate policy regexes with one grep and run pytest in parallel (furedea/dotfiles[#125](#125)) ([ce80ea3](ce80ea3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
furedea
added a commit
that referenced
this pull request
Nov 15, 2026
#205) ## 概要 ガード節に関する散文の指針を2か所から削除しました.各言語のテンプレートリンターが `return`/`raise`/`continue`/`break` の後の `else` を拒否するようになったため,散文での指示は不要になりました. Refs #74 ## 変更内容 | ファイル | Before | After | | --- | --- | --- | | `agents/AGENTS.md:30` | `- Keep functions single-purpose at one abstraction level, with short variable lifetimes and guard clauses over nested conditionals.` | `- Keep functions single-purpose at one abstraction level, with short variable lifetimes.` | | `agents/skills/rust-style/references/types.md:73` | `- Prefer early returns for guard clauses.` | 行を削除(前後は独立した箇条書きのため,文の調整は不要) | ## 言語ごとのカバー状況 | 言語 | else-after-return | ネストの深さ | 根拠 | | --- | --- | --- | --- | | Python | ruff `RET505`-`RET508` | `PLR1702` | template-python #28 | | TypeScript | oxlint `no-else-return` | `max-control-nesting` | template-typescript #43 | | Go | revive `indent-error-flow` / `superfluous-else` / `early-return` | `max-depth` | template-go #11 | | Rust | clippy pedantic `redundant_else` | `excessive_nesting` | template-rust(既存) | `agents/skills/*` を `rg` で調べた結果,同系統の記述は上記の rust-style の1件だけでした. ## 検証 - `rg -i "guard clause"` で,削除した2行以外にこの文言を固定するテストやレンダリング済みスナップショットがないことを確認しました. - 変更は Markdown のみです.各コミットで pre-commit(shfmt / ls-lint / shellcheck)と commit-msg(commitlint)がパスしました. - CI の結果は push 後に確認します. ## レビュー指摘への対応 `codex-review` が P2 の指摘を1件出しました(`agents/AGENTS.md:30`).内容は,「テンプレート外のプロジェクトや else を伴わないネストはリンターの対象外なので,文言を残すべき」というものです. ユーザーが次の理由で方針判断として受け入れ,スレッドに返信して resolve しました. - 新規プロジェクトはテンプレートからのみ作られるため,テンプレート外は対象外です. - else を伴わないネストの深さも,上表のルールが検査します. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
シェルの書き方しだいでガード hook が破壊的操作や秘密情報を見逃す 4 種類のすり抜けを,修正前に失敗するテストを書いてから直した.コミットは修正の種類ごとに分けている.レビューの指摘への対応と,承認された追加修正(addendum 1〜4)は,追補コミットにしている.
Closes #3
ガードの契約(ADR-0015)
docs/adr/0015_judge_only_statically_determinable_shell_text_in_the_guards.mdに記録した.eval,hook が読めない入力を与えられたシェル,同じコマンド内で定義した関数やエイリアス.この 2 つの規則のどちらにも当たらない書き方は,その場で直さずに既知の制限として #18 に記録する.
変更内容
shell_syntax.py,shell_input.py)00<も含む)に届く次の入力を,入れ子のコマンドとして判定する:echo/printfからのパイプsh < file(hook の実行時に,到達しうる各ディレクトリでファイルを読み,1 ファイルずつ判定)( ... ),{ ...; })から引き継いだリダイレクト<(...),fd の複製,標準入力への複数のリダイレクト,パイプと引き継いだリダイレクトの併用,内容が実行時に決まる入力,シェルが展開する単語を含むecho(波括弧を含む).dash・kshを加えた.git_safety.py)--より前にある長いオプションの一意な省略形を,正式名に直してから判定する.switch --force-create,branch --delete --force(-dfなどの書き方も含む).restoreは,-S/-Wとその否定形を出現順に評価する.shell_paths.py,provider_adapter.py)cd,env -Cの後)で,~・$HOMEはホームディレクトリとして扱う.実際の展開結果が秘密パスのルールに一致したときだけブロックする.**は隠しディレクトリとシンボリックリンク以外のすべてのディレクトリを走査し,末尾の**は配下のすべてのファイルに一致する.走査が 10000 エントリを超えたら確認を求める.paths commandを使う provider は確認を出せないため,review を求める理由付きの拒否になる.guard_file.py)cd x && git commitとgit -C x commitに検査が掛かっていなかった.cd/pushd/env -C)と,その commit 自身の-C/--git-dir/--work-treeで決まるリポジトリで検査する.GIT_DIRなどの代入(+=,引用・行継続で分割したもの,読み込んだスクリプト内のものを含む)がある.-c設定は,hook が実行する git に渡さない.検証
**,echoの波括弧)はこの PR で直した.reviewサブコマンドは,検証フックがgit diffを拒否したため使えなかった.既知の制限
#18 にまとめた.主なもの:
**/の付かない秘密パスのルールは,サブディレクトリ下のパスに一致しない.sudoはラッパーとして扱わない.計画との差分
shell_words.py・shell_input.py・shell_paths.pyを新設した.ADR-0015 を追加した(0013・0014 は fix(bootstrap): make the server bootstrap behave like the Nix hosts #15 が使っている).🤖 Generated with Claude Code