Skip to content

fix: Claude Code が無視する Write(path) の deny ルールを削除し、起動時の警告を解消(v0.79.2) - #180

Merged
okash1n merged 1 commit into
mainfrom
fix/permissions-write-rules
Oct 8, 2026
Merged

okash1n merged 1 commit into
mainfrom
fix/permissions-write-rules

Conversation

@okash1n

@okash1n okash1n commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

概要

キット導入後、Claude Code の起動時に次の警告が 7 行表示される問題を修正します(v0.79.2、patch)。

Permission deny rule (../../../../.claude/settings.json): Write(./.env) is not matched by file permission checks — only Edit(path) rules are. Use Edit(./.env) instead (Edit rules cover all file-editing tools).

原因

  • config/permissions.json の permissions.deny に Write(path) 形式のルールが 7 件あった(Write(./.env)、Write(./.env.*)、Write(./**/.env)、Write(./**/.env.*)、Write(/secrets/**)、Write(~/.zshrc)、Write(~/.bashrc))
  • Claude Code 2.1.210 以降は Write(path) / NotebookEdit(path) / Glob(path) 形式のルールを無視し、起動時に警告する。公式ドキュメント(permissions、2026-10-08 取得): "Edit rules apply to all built-in tools that edit files."
  • 7 件すべてに同じパスの Edit(path) ルールが併記されているため、保護は変わらない(削除したルールはもともと一致していなかった)

ユーザーに見える変更

  • 新規インストールでは警告が出なくなる
  • 既存インストールは次回の setup.sh --update(/update-kit、自動アップデート、install.sh の再実行)で settings.json の permissions.deny から 7 件が取り除かれる。permissions.deny を手で編集していた環境(非対話の 3-way merge はキットが削除した値を保持する)も、新しい sweep が完全一致の 7 文字列だけを取り除くので対象になる
  • 対象外: manifest を持たず既存の settings.json だけがある状態への新規インストール(bootstrap merge のみ)。CHANGELOG に手動の対処を記載
  • MDM: 配備される settings.json から 7 件がなくなる。KIT_MDM_EXPECTED_POLICY_SHA256 は不変(minimal / standard / full で確認)。renderer / installer は変更していないので install bundle の再配布は不要

変更内容

ファイル 変更
config/permissions.json Write(path) の deny ルール 7 件を削除(deny は 57 → 50 件。allow と他のルールは不変)
lib/update.sh _strip_ineffective_permission_rules: 更新時に permissions.deny から上の 7 文字列(完全一致)だけを取り除く。他のルール・順序・他のキーは変えず、該当がなければ書き換えない。_update_phase_settings の既存 sweep の最後で毎回実行
tests/unit/test-hook-fixtures.sh config/*.json と features/*/hooks*.json の permissions に Write(path) / NotebookEdit(path) / Glob(path) 形式がないことの静的検査(修正前は 7 件を検出)
tests/unit/test-retired-hooks.sh / test-update-refactor.sh sweep の単体テストと、利用者が permissions.deny を編集した環境・bootstrap merge・未編集・該当なしの各ケースで実ビルドを通す更新テスト
CHANGELOG.md [0.79.2] - 2026-10-08 の Fixed

リスク

  • 実 Claude Code 2.1.210+ で警告の再現と消失は確認していない(公式ドキュメントと CHANGELOG の記述に基づく)。マージ後にこの端末の /update-kit で確認する
  • sweep は kit が v0.79.1 まで同梱していた 7 文字列に限定しており、利用者が自分で書いた Write(path) ルールは触らない(警告は利用者側で直す必要がある)

実行した検査

  • 修正前コードで新規アサーション 12 件中 10 件が FAIL(静的検査は 7 件を検出、sweep を no-op にすると利用者編集・bootstrap のケースが FAIL)することを確認
  • 修正後: test-hook-fixtures / test-context-budget / test-biome-hooks / test-pr-creation-log / test-retired-hooks / test-update-refactor / test-merge / test-json-builder を最小ランナーで実行し 149/149 PASS。test-mdm-expected.sh 単体 30/30 PASS
  • mdm/render-expected.py の出力を main と比較: policy.json の SHA-256 は 3 プロファイルで同一、変わるのは settings.json のハッシュのみ
  • shellcheck -S warning(変更 .sh)、jq . config/permissions.json、git diff --check
  • レビュー(正しさ / テスト・文書 / Codex): 指摘なし
  • 全体スイートはローカル未実行。CI を正とする

config/permissions.json の permissions.deny に Write(path) 形式のルールが
7 件含まれていた。Claude Code はファイルの権限チェックに Edit(path) ルール
だけを使い(Edit ルールはファイルを編集するすべての組み込みツールに適用
される)、2.1.210 以降は Write(path) ルールごとに起動時の警告を表示する。

- config/permissions.json: Write(path) の deny ルール 7 件を削除した。同じ
  パスの Edit(path) ルールは以前から併記されているため保護範囲は変わらない
- lib/update.sh: 更新の設定フェーズで settings.json の permissions.deny から
  この 7 文字列(完全一致)だけを取り除く _strip_ineffective_permission_rules
  を追加した。permissions.deny を手で編集した環境では、非対話の 3-way merge
  が「キットが削除した項目」を残すため。利用者が追加したルールと並び順は
  変えず、該当がなければ書き換えない
- MDM: 配備される settings.json から 7 件がなくなる。policy.json の SHA-256 は
  変わらない(Minimal / Standard / Full × 日本語で確認)
- テスト: permission ルールの静的検査 1 件、掃除関数の単体テスト 6 件、
  実ビルドを通す設定フェーズのテスト 5 件を追加した(修正前は 10 件が失敗)
Copilot AI balanced review requested due to automatic review settings October 8, 2026 01:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T01:50:00.276738Z db0af2a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted migration is correctly scoped and comprehensively covered across configuration, merge, and update paths.

0 open findings

What changed in this PR

Removes ineffective Write(path) deny rules that trigger Claude Code startup warnings while preserving equivalent Edit(path) protection.

Changes:

  • Removes seven obsolete permission rules.
  • Sweeps legacy rules during updates.
  • Adds static, unit, and update-path regression coverage.
File Description
config/​permissions.json Removes ineffective deny rules.
lib/​update.sh Cleans legacy rules during updates.
tests/​unit/​test-hook-fixtures.sh Prevents unsupported permission forms.
tests/​unit/​test-retired-hooks.sh Tests precise cleanup behavior.
tests/​unit/​test-update-refactor.sh Tests update and merge paths.
CHANGELOG.md Documents v0.79.2 behavior.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@okash1n
okash1n merged commit 475212e into main Oct 8, 2026
12 checks passed
@okash1n
okash1n deleted the fix/permissions-write-rules branch October 8, 2026 03:02
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.

2 participants