Skip to content

実装: secret_boundary_guard の grep ERE portability を改善する #1735

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "secret_boundary_guard.sh の GNU/BSD grep 間 ERE portability を改善する"
change_kind: code

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: なし(単独改善のため該当なし)
  • Desired Destination: なし(単独改善のため該当なし)

Current Validated Scope

  • secret_boundary_guard.sh の GNU/BSD grep ERE portability を改善する

Remaining Parent Gaps

なし

概要

secret_boundary_guard.sh の GNU/BSD grep 間の ERE portability を改善する。\s、\b、echo など、GNU/BSD grep または shell input の差異に弱い処理が残っている。

背景

secret_boundary_guard.sh では \s、\b、echo など、GNU/BSD grep または shell input の差異に弱い処理が残っている。

local secret leakage は GitHub branch protection では防げない local-only risk であるため、secret_boundary_guard のような local-only secret protection guard は維持する価値がある(#1782 の OWNER 敵対的レビュー、#1782 (comment) 参照)。

対象

  • secret_boundary_guard.sh
  • regex fixtures

Outcome

secret_boundary_guard.sh の GNU/BSD grep 間 ERE portability 問題(\s/\b/echo)が解消された状態。portability fixture test が追加され、全て成功する。

In Scope

portability

secret_boundary_guard.sh では最低限、次を実施する。

  • \s を [[:space:]] に置換
  • \bWORD\b を portable な境界表現に置換
  • echo "$COMMAND" を printf '%s\n' "$COMMAND" に置換
  • LC_ALL=C を明示
  • tab、newline、separator、quoted text の fixture を追加

例:

(^|[^[:alnum:]_])WORD([^[:alnum:]_]|$)

この Issue で目標とするのは POSIX shell 全体への移植ではなく、GNU/BSD grep 間の ERE portability とする。

Out of Scope

Acceptance Criteria

  • AC1: secret_boundary_guard.sh の \s、\b、echo の portability 問題が解消されている
  • AC2: tab、newline、quoted text を含む fixture が成功する
  • AC3: Linux と BSD系 grep 相当環境で再現可能な test evidence がある

Verification Commands

# AC1
$ rg -c "echo .\$COMMAND." .claude/hooks/secret_boundary_guard.sh

# AC2
$ uv run --locked python3 -m pytest .claude/hooks/tests/test_secret_boundary_portability_fixtures.py

# AC3
$ rg -c "LC_ALL=C" .claude/hooks/secret_boundary_guard.sh

Allowed Paths

  • .claude/hooks/secret_boundary_guard.sh
  • .claude/hooks/tests/test_secret_boundary_contract.py
  • .claude/hooks/tests/test_secret_boundary_multiedit.py
  • .claude/hooks/tests/test_secret_boundary_portability_fixtures.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

  • docs/dev/hook-boundaries.md

Scope Delta(該当時のみ記載)

N/A

Delivery Rule

1 Issue = 1 PR を原則とする。worktree で作業し、Draft PR を既定とする。

Notes for Reviewer

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jul 25, 2026
  2. changed the title [-]実装: Hook の並列実行 semantics に対応し secret boundary guard の portability を改善する[/-] [+]実装: secret_boundary_guard の grep ERE portability を改善する[/+] on Aug 12, 2026
  3. squne121 commented on Aug 12, 2026

    @squne121
    OwnerAuthor

    本文改訂: reframe/split(#1782 敵対的レビュー反映)

    #1782 の OWNER 敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1782#issuecomment-5266277591)に基づき、本 Issue を reframe/split した。

    Acceptance Criteria を旧12件から3件(portability 関連のみ)に narrowing し、Allowed Paths からも hookchain test harness ファイルを除去した。

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

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions