Repository navigation
feat(settings): protect the agent gh config directory and let the gh guard rely on it - #290
Conversation
…guard rely on it Declare every path agents must not write in write_protected_paths.json, which replaces harness_roots.json and gives each entry a purpose. The agent gh configuration the host mints (~/.config/agent-harness/gh) joins the harness roots: Claude denies it to file tools and in the sandbox's denyWrite, Codex keeps it read-only, Antigravity denies it, and guard_file.py refuses it for every provider with a host-specific reason. The gh guard now lets a read that names its repository with a literal --repo share its line with other commands when GH_CONFIG_DIR, and each gh config file in it, really lies inside a declared path. Unset, relative, or linked-out configuration still asks, as do assignments that change what gh reads. Also fix the stale DESIGN note that said the source denyWrite is not in effect. Refs #289 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review summaryRead-only review of the generalized Findings: one P2, posted inline.
What I checked and found fine:
I did not run the test suite. Minor, not posted as a finding: |
A sandbox may not deny writes to a path that does not exist yet, so another command on the line could create the declared directory with a socket. Refs #289 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no blocking findings (no P0/P1, no inline comments). I read the full diff, covering the new
Residual risk, which the ADR already lists as a "Bad" consequence and which I do not count against the merge. The gh guard's allowance rests on the provider sandbox really denying writes to |
Refs #289 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary (read-only) I found one issue, a P2. I didn't run the test suite.
Checked and no problems found:
🤖 Generated with Claude Code |
… root Sandboxed commands of hook-only providers may write a harness root, so a GH_CONFIG_DIR there could gain a socket from another command on the line. Refs #289 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review summaryRead-only review of the diff. I did not run the test suite. Overall the change is careful: it fails closed on a relative or unset P2 (inline, Not verified: The No other findings. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…mands The file guard refuses the gh configuration for every provider, but only Claude's denyWrite and Codex's guarded profile keep shell commands out of it, so Antigravity and the hook-only providers keep asking. Refs #289 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review of #290: no findings. What I checked:
I did not run the test suite. |
Refs #289 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review summaryNo P0–P2 findings. I read the full diff and checked the following.
P3, optional. Not verified here: that Codex always runs the |
🤖 I have created a release *beep* *boop* --- ## [0.7.0](v0.6.0...v0.7.0) (2026-12-01) ### Features * **settings:** protect the agent gh config directory and let the gh guard rely on it ([#290](#290)) ([8dbb4bf](8dbb4bf)) --- 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>
…s unwritable Update the agent-config input to 99f2ca3 (v0.7.0, furedea/agent-config#290), which denies writes to ~/.config/agent-harness/gh for every agent and lets the gh guard trust a protected GH_CONFIG_DIR for literal --repo reads. agent-harness is already at its current main (249aeac). Add contracts that the rendered Claude, Codex and Antigravity settings deny writes to that directory. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…s unwritable (#536) ## 概要 `agent-config` を v0.7.0(`99f2ca3`)に更新します.これには furedea/agent-config#290 が含まれます. - agent 用の gh 設定ディレクトリ `~/.config/agent-harness/gh` を,すべての agent から書込み不可として宣言します. - gh ガードは,保護された `GH_CONFIG_DIR` を,リテラルな `--repo` 付きの読み取りに限って信頼します. `agent-harness` は dotfiles#532 の時点から現在の main(`249aeac`)のままで,更新はありません. あわせて `nix/checks.nix` に契約を追加しました.描画された Claude / Codex / Antigravity の設定が,いずれも `~/.config/agent-harness/gh` への書込みを拒否することを評価で確認します. ## 確認済み - `nix flake check` が通ります. - 追加した3つの契約はいずれも `true` です. ## マージ後の確認(ユーザー) 1. `sudo darwin-rebuild switch` を実行し,agent のセッションを再起動する. 2. 新しい Claude セッションで `git fetch -q origin && gh pr list --repo furedea/dotfiles --limit 1` が承認プロンプトなしで実行できる. 3. Claude からの `~/.config/agent-harness/gh/config.yml` への Edit / Write が拒否される. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
エージェント用の gh 設定ディレクトリ
~/.config/agent-harness/ghを全 provider で書込み禁止にし,gh ガードはそれを根拠に「literal な--repoの読み取り + 同じ行の別コマンド」で確認を求めなくなる.宣言は
harness_roots.jsonを一般化したwrite_protected_paths.json(各項目にpurpose)に移した.判断事項: マージ前に下の「dotfiles が満たすべきこと」と「マージ後の確認」.
Refs #289(#282 の続き,#181 の暫定段階)
~/.config/agent-harness/gh/config.ymlgit fetch -q origin && gh issue list --repo o/r(保護されたGH_CONFIG_DIR,Claude / Codex)GH_CONFIG_DIR未設定・相対・存在しない・宣言外・設定ファイルが宣言外へ link・宣言パス自体が linkexport GH_HOST=…/HOME=… gh/XDG_CONFIG_HOME=… gh/export HTTPS_PROXY=…--repoなしの読み取り + 別コマンド検証
uv run pytest -q tests: 6658 passed, 2 skipped(git-lfs と gofmt が未インストール)ruff check/ruff format --check/ty check/vulture/deptry/ls_lint/adr-check: 通過changes_directoryによる ask で失敗し,実装後に通過GH_CONFIG_DIRを信頼する」を修正.Red(新テスト失敗)→ Green,関連 57 件通過harness用の宣言(~/.hermesなど)の中のGH_CONFIG_DIRも信頼する」を修正.hook しか持たない provider ではシェルがルートに書けるため,gh-config用の宣言だけを信頼する.Red → Greenproviderなし)と Codex に限定.Red(5 provider が allow)→ Green,全テスト 6666 passedcheck(mode: str)とAGENT_GH_POLICYの文字列は既存のコードで今回の変更範囲ではなく,entry without a pathは外側のinvalid write protection policy: <path>が操作を示すので変えていないdotfiles が満たすべきこと(#532 で既に満たす)
GH_CONFIG_DIRを 絶対パス$HOME/.config/agent-harness/ghとして Claude のsettings.envと Codex のshell_environment_policy.setに渡す.~/.config,~/.config/agent-harnessを symlink にしない(実体が宣言の外にあると gh ガードは ask に戻る).config.yml/hosts.ymlを置くなら実体もこのディレクトリ内に置く.マージ後の確認(ユーザー)
~/.claude/settings.jsonにEdit(~/.config/agent-harness/gh/**)とsandbox.filesystem.denyWriteの~/.config/agent-harness/ghがあること,Codex のconfig.tomlに"~/.config/agent-harness/gh" = "read"があること.~/.config/agent-harness/gh/config.ymlへの Write が拒否されること.sandbox の Bash でtouch ~/.config/agent-harness/gh/xが失敗すること.git fetch -q origin && gh pr view <n> --repo furedea/agent-configが確認なしで動くこと.GH_CONFIG_DIRが渡らない場合,その行は従来どおり ask になる(安全側).渡したい場合は dotfiles 側で hook の環境にも設定する.設計・証拠・範囲
agents/hooks/rules/write_protected_paths.json(旧harness_roots.json).purposeはharnessとgh-config.テスト用の上書き変数はAGENT_WRITE_PROTECTED_PATHS(旧AGENT_HARNESS_ROOTS_POLICY).別ファイルを並べず一般化したのは,provider 設定・file guard・gh guard が同じ問い(エージェントがそのパスを書けるか)を読むため.guard_file.py harnessのモード名は hooks.json と全 adapter が参照するので据え置いた.tests/test_harness_protection.pyが宣言と各 provider の設定を照合すること.作業ディレクトリと$TMPDIRは許可リストに関係なく書けるので,Claude のdenyWriteと Codex のreadも足した._read_host_problemの docstring とtests/hooks/test_gh_protected_config.py):GH_HOST,GH_REPO,GH_CONFIG_DIR,HOME,XDG_CONFIG_HOME,proxy,CA bundle は環境変数で,行の代入・exportは既存のchanges_environmentで ask.http_unix_socketはconfig.yml/hosts.ymlにあり保護ディレクトリ内.--repoがあれば作業ディレクトリのリモートと git 設定は読まない._stand_in_problemが独立に判定する.既存テストcp x later/git; gh pr list -R …は PATH にlaterがなく実際には仕込めていなかった(changes_directoryだけで ask していた)ので,PATH に相対エントリを足して本当に仕込める形にし,gh も対象に加えた.test_gh_line_asks.py)は「gh の設定が保護されていない」前提を fixture で明示した.保護されたGH_CONFIG_DIRの環境で実行すると allow になっていたため.denyWriteを置き換えるので未適用」という注記は,agent-harness#213 が 2026-11-11 に close され,インストール済み設定にソースの項目が入っていることを確認して直した.$HOMEが symlink の配下にあるホストではholds()が一致せず常に ask になる.安全側なので変えていない.partly-superseded-byにした.🤖 Generated with Claude Code