Repository navigation
fix: summarize_agent_transcript.py の GitHub token redaction を github_pat_ 対応にする - #2806
Conversation
…pat_ 対応にする (#2736) REDACT_PATTERNS に fine-grained personal access token (github_pat_ prefix) 専用の matcher (github_pat_[A-Za-z0-9_]{20,}) を追加する。既存の classic gh[opsur]_ prefix パターンは github_pat_ の3文字目 (i) にマッチしないため このトークンは従来 redaction されずに transcript summary artifact へ そのまま残るおそれがあった。 tests/test_summarize_agent_transcript.py に deterministic synthetic github_pat_ トークン (82文字 body) を用いた完全一致 regression test (test_redact_patterns_fully_redacts_fine_grained_pat_token) を追加し、 token 全体および prefix/body の断片が出力に残らないことを検証する。 既存の classic token (ghp_/gho_/ghu_/ghr_/ghs_) redaction テストは全件 pass。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2806/ The preview will be removed when this PR is closed. |
Findings現行 HEAD
実装自体の評価追加された matcher の方向性は妥当です。GitHub の現行公式ドキュメントは fine-grained PAT の識別 prefix が 一方、GitHub の公開ドキュメントから fine-grained PAT body の厳密な length/character grammar は確認できません。したがって #2736/#2806 が「82文字を GitHub normative grammar と扱わず、repository-owned conservative redaction policy として CI も掘りました。main は PR base 関連 PR #2735 の 推奨 disposition
別枠の再発防止として価値があるのは |
|
確認した時点で、PR #2806 は open / draft、HEAD は 推奨は 新PRを作らず #2806 を resume し、対象コメントを 再発防止については既存 Issue を dedupe した上で、該当する open Issue がなかったため #2808 を起票済みです。#1641/#610/#2769 とは責務を分離しています。 そのまま既存の auto mode 対話セッションへ貼るプロンプトです。 repo = 対象:
目的: このセッションは既に auto mode で起動済みです。現在の runtime / launcher / profile / permission mode を維持し、再起動や別 runtime への切替、permission bypass は行わないでください。 最初に必ず fresh state を取得する過去の報告やこの prompt に書かれた SHA を authority とせず、開始時に以下を live 再取得してください。
開始前参考値:
ただし、これらは必ず live state で再bindしてください。 impl-review-loop の入力Issue #2736 を OWNER comment
を human context / fix_delta authority として明示的に渡してください。current skill が この OWNER comment は「ここで停止せよ」という veto ではなく、今回処理すべき landing disposition新しい branch / worktree / PR を無条件に作らないこと。 Issue #2736 には既存 open draft PR #2806 があるため、current canonical landing-disposition producer の fresh 判定に従い、適格なら duplicate PR を作らないでください。 stale evidence、head drift、main drift があれば current OWNER comment の fix_deltaOWNER comment の全 finding を current live repository と再照合したうえで処理してください。現時点で期待する最小修正は以下です。 A. PR body evidence contract を修正PR #2806 本文に、current
PR body mutation は repository-owned B. Safety Claim Matrix を N/A のままにしない今回の PR は credential redaction / secret-like token / current claim の射程は少なくとも以下程度に限定してください。
GitHub provider の exact token-validity grammar、repository 全体の credential protection、全 transcript surface の安全性など、今回証明していない広い claim は書かないでください。 current canonical 5-column Safety Claim Matrix が必要なら、その形式を使ってください。 C.
|
OWNER finding P2 (PR #2806 issuecomment-5856207106): 既存テストは body 82文字のケースのみを検証しており、`github_pat_[A-Za-z0-9_]{20,}` という recall-first ポリシーの下限境界 (20文字) が regression test で 固定されていなかった。deterministic synthetic body (20文字) の fine-grained PAT token に対する focused regression test を追加する。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
impl-review-loop pr-reviewer verdict(fresh head 再評価)対象 head: 検証サマリ
verdict: APPROVE
reviewed_head_sha: "a5cac07aabc91a203a5488e6a07091fdb2558aab"
blockers: []
warnings: [] |
…ontract drift を解消する (#2813) * 実装: PR body authoring validator と pr-review-judge の evidence/safety contract drift を解消する (#2808) open-pr の validate_pr_body.py::REQUIRED_SECTIONS を唯一の canonical required-section inventory とし、pr-review-judge が要求してきた「受け入れ条件の達成状況 / 検証コマンド結果 / Allowed Paths 遵守」を LP052 の enforcement に追加する。PR template と ac-evidence-checks.md はこの canonical list の materialized projection とし、focused pytest で parity を検査する。 safety-sensitive applicability は changed_paths のみに限定していた既存 _is_safety_sensitive() を、PR body / linked Issue body のテキストシグナル(GitHub PAT prefix、personal access token、secret-like token、credential redaction 等の強いシグナルに限定し、bare `token` の ような near-miss では誤検知しない)を含む deterministic minimum floor へ拡張する。 open_pr.py(create path)と update_pr.py(update path)の両方に同一の floor 入力を適用し、 PR #2806 の credential redaction 再発(scripts/summarize_agent_transcript.py はどの safety-sensitive path pattern にも一致しない)を防ぐ。 Allowed Paths に明示された9ファイルに加え、REQUIRED_SECTIONS 拡張の直接的な結果として 既存テストスイートを green に保つために必要な test fixture / generator (Scope Delta, PR 本文で明示): - .claude/skills/open-pr/scripts/tests/fixtures/pr_body/{valid_not_schema_change,not_schema_change_with_na_inventory}.md - .claude/skills/open-pr/tests/test_pr_body_hygiene.py - .claude/skills/open-pr/scripts/generate_pr_body.py + templates/pr_body.ja.md - .claude/skills/impl-review-loop/tests/test_handoff_pr_hygiene_regression.py Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: PR body fixture の日本語比率不足プロセスブロックを修正する pre-existing な .claude/skills/open-pr/scripts/tests/fixtures/pr_body/{not_schema_change_with_na_inventory,valid_not_schema_change}.md の Summary/Schema Change Applicability/Notes ブロックが日本語比率0のため PR Body Japanese Check (threshold 0.1) で fail していた。parser-sensitive な `Related issue: #N` 行はそのまま保持し、sibling bullet で日本語比率を満たす。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: PR body template の日本語比率不足プロセスブロックを修正する pre-existing な .claude/skills/open-pr/templates/pr_body.ja.md の Summary/Checks/Schema Change Applicability/Schema Consumer Inventory/Safety Claim Matrix/Notes の各ブロックが $placeholder のみで日本語比率0のため PR Body Japanese Check (threshold 0.1) で fail していた。各 $placeholder 行の直後にセクション説明の日本語 gloss 行を追加し、既存の見出し文字列・$placeholder token 自体は変更しない。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: safety-claim-gate.md の見出し日本語比率不足を修正する 「## Deterministic Minimum Floor(producer/reviewer 共有、Issue #2808 AC4)」見出しブロックが日本語比率0.032で PR Body Japanese Check (threshold 0.1) の fail 対象になっていた。見出し文言を日本語主体に言い換え、他ファイルからの参照がないことを確認した。 Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Test <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
scripts/summarize_agent_transcript.pyのREDACT_PATTERNSに、GitHub の fine-grained personal access token(github_pat_prefix)を検出する専用 matchergithub_pat_[A-Za-z0-9_]{20,}を追加した(Issue 実装: summarize_agent_transcript.py の GitHub token redaction パターンを fine-grained PAT (github_pat_) に対応させる #2736、PR fix: summarize_agent_transcript.py の GitHub token redaction を新形式 ghs_ App installation token に対応させる #2735 レビュー時に列挙された follow-up gap の一つ)。gh[opsur]_[A-Za-z0-9_]{20,}は、github_pat_の3文字目(i)がo/p/s/u/rのいずれとも一致しないため、fine-grained PAT には一切マッチしない。この gap により fine-grained PAT は従来 redaction されず transcript summary artifact にそのまま残存する可能性があった。ghs_専用 matcher の正規表現文字列自体を変更しておらず、単純な charset ベースの追加エントリである。GitHub 公式の exact grammar の再現ではなく、conservative な repository redaction policy として採用している(Issue 本文の In Scope 記載通り)。tests/test_summarize_agent_transcript.pyに、82文字 body の deterministic syntheticgithub_pat_トークンを用いた完全一致 regression test(test_redact_patterns_fully_redacts_fine_grained_pat_token)を追加し、token 全体および prefix/body の断片が出力に残らないことを検証した。github_pat_[A-Za-z0-9_]{20,}の recall-first ポリシーにおける下限境界(20文字 body)を固定する focused regression test(test_redact_patterns_fully_redacts_minimum_length_pat_token)を追加した。既存の82文字 body テストは変更せず残している。ghp_/gho_/ghu_/ghr_/ghs_)redaction テストは全件 pass(回帰なし)。受け入れ条件の達成状況
scripts/summarize_agent_transcript.pyのREDACT_PATTERNSにgithub_pat_prefix を検出する正規表現エントリが追加されている。a5cac07aabc91a203a5488e6a07091fdb2558aab上で再実行):github_pat_トークン(82文字 body)を用いた完全一致の behavioral pytest(test_redact_patterns_fully_redacts_fine_grained_pat_token)が追加され PASS。{20,}の下限境界(20文字 body)を固定するtest_redact_patterns_fully_redacts_minimum_length_pat_tokenを追加し PASS。ghp_/gho_/ghu_/ghr_/ghs_)に対する redaction テストが全て pass する(既存挙動の回帰がない)。検証コマンド結果
Issue #2736 本文の Verification Commands を、fresh current HEAD(
a5cac07aabc91a203a5488e6a07091fdb2558aab)上で実際に再実行した結果。過去の HEAD(c210f54f)の結果は再利用していない。Allowed Paths 遵守
Issue #2736 で許可されている変更対象パス(Allowed Paths)は次の2ファイルである:
scripts/summarize_agent_transcript.pytests/test_summarize_agent_transcript.py実際の changed files(
git diff --name-only main...HEAD、fresh HEAD 上で再確認):2ファイルとも Allowed Paths と完全一致しており、Allowed Paths 外の変更はない。
Checks
pnpm typecheckpnpm lintpnpm testpnpm buildscripts/summarize_agent_transcript.py/tests/test_summarize_agent_transcript.py(Python-only)の変更で pnpm ワークフローの対象外のため上記4コマンドは非該当。代わりに Issue 本文の Verification Commands(grep+uv run pytest)をすべて fresh HEAD 上で再実行し、全件 PASS を確認済みSchema Change Applicability
not_schema_changesummarize_agent_transcript.py内部の secret-like token redaction 用正規表現リストへのエントリ追加のみSchema Consumer Inventory
N/A(
not_schema_changeのため)Safety Claim Matrix
本 PR は credential / secret-like token の redaction ロジックを直接扱う(
docs/dev/secret-policy.md関連)ため、OWNER レビュー指摘(PR #2806 issuecomment-5856207106 finding P1 Blocker 2)に従い、bounded な具体的 claim へ更新する。claim の射程は以下の2点に限定し、GitHub provider の exact token-validity grammar や repository 全体の credential protection、全 transcript surface の安全性など、より広い claim はしない。scripts/summarize_agent_transcript.py::redact_string()の matchergithub_pat_[A-Za-z0-9_]{20,}が、対象文字列に含まれるgithub_pat_prefix トークン全体(prefix + body の断片を含む)を単一の<GITHUB_TOKEN>へ完全に置換するtest_redact_patterns_fully_redacts_fine_grained_pat_token(82文字 body)とtest_redact_patterns_fully_redacts_minimum_length_pat_token(20文字 body、{20,}下限境界)が fresh HEAD 上で PASS。両テストとも token 全体・prefix・body 断片が出力に残らないことを個別 assertion で検証ghp_/gho_/ghu_/ghr_/ghs_)の既存 redaction behavior が本変更により regression していないtest_redact_patterns_preserves_classic_github_token_redaction[ghp_/gho_/ghs_/ghu_/ghr_]の5個の parametrize node id が fresh HEAD 上で個別に PASS(aggregate self-report のみに依存しない)Notes
optional_follow_up、緊急対応不要)。M4 スコープ境界を変更しないimplement-issueskill、および PR fix: summarize_agent_transcript.py の GitHub token redaction を github_pat_ 対応にする #2806 OWNER レビュー finding 対応の fix_delta)による実装scripts/summarize_agent_transcript.pyとtests/test_summarize_agent_transcript.pyの2ファイルのみで、実際の変更もこの2ファイルに限定されているcompact_author_result.py/persist_retrospective_run.py/get_ci_failed_log.py/secret_exposure_scanner.py/check_session_recording_runtime_safety.pyの同種対応、およびghs_App installation token 対応(Issue 実装: summarize_agent_transcript.py の GitHub token redaction パターンを新形式 ghs_ App installation token に対応させる #2725 / PR fix: summarize_agent_transcript.py の GitHub token redaction を新形式 ghs_ App installation token に対応させる #2735 で対応済み)は本 PR では扱わないopen-prskill の canonical update wrapper(.claude/skills/open-pr/scripts/update_pr.py)経由で行い、gh pr edit --body-fileの直接呼び出しによる validator bypass は行っていない