Skip to content

hook install/uninstall のロバスト性 (matcher 差分で重複, 部分一致, 不正 settings.json, .bak 単一世代) #28

Description

@senna-lang

概要

~/.claude/settings.json の編集が重複登録や誤削除、トレースバックを招きうる。

詳細

  • matcher 差分で重複登録 hooks.py:88-165: 既存 SessionStart の matcher が正準文字列 (startup|clear|resume|compact) と違うと検知漏れで prime/server/distill を二重追加。
  • 部分一致が脆弱 hooks.py:196-201 _is_loci: "loci" in cmd の部分一致。パスに "loci" を含むユーザーコマンドを誤マッチ/uninstall で誤削除。loci_bin prefix 一致に。
  • 不正 settings.json 未処理 hooks.py:50-57,183-189: json.load が例外未処理で生トレースバック (exit 1, 非actionable)。
  • .bak 単一世代 hooks.py:25-27 _write_settings: 毎回 .bak 上書き。2回目の不正実行で良い backup を潰す。

修正案

  • 全 SessionStart entry を跨いで loci コマンドを検知してから追加
  • loci_bin prefix 一致で判定
  • json.load を捕捉し actionable なメッセージ + 書き込み拒否
  • .bak をタイムスタンプ/ローテーション

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-mediumMedium: robustness/perfarea:clibugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions