Repository navigation
実装: visual-impact-policy-trusted の CheckRun provenance に exact workflow_run.id binding の adversarial negative control を追加する - #2229
Conversation
…ow_run.id binding の adversarial negative control を追加する visual-impact-trusted-consumer.yml が triggering workflow_run.id / strict run_attempt の attempt-specific jobs を pagination 完走し、component-vrt-report job(cardinality exactly one) の check_run_url から exact CheckRun を独立取得して provenance tuple を final fail-closed に 検証するようにする。別 workflow_run.id / 別 run_attempt からの component-vrt-report CheckRun substitution を、head SHA・CheckRun name・github-actions App identity が一致していても拒否する。 - resolve_visual_impact.py に verify_component_vrt_checkrun_provenance() を追加し、 job の run_id/run_attempt/head_sha/name/conclusion と CheckRun の id/name/head_sha/status/conclusion/app.id/app.slug、および job.check_run_url ↔ exact CheckRun の join を検証する。 - require_component_vrt_checkrun_provenance を CLI builder 経路で常時 true にし、 opt-out を持たせない。 - adversarial negative control テスト(別 run/別 attempt からの substitution 拒否、 malformed/API失敗、cardinality違反)を追加。 Not controlled: 同一 workflow run 内での candidate-controlled producer による job/artifact/evidence の偽造は #2101(same-run producer integrity / attestation)の 責務であり本変更には含まない。evidence-recovery harness は #2195 の責務。 Closes #2100 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2229/ The preview will be removed when this PR is closed. |
判定REQUEST_CHANGES
PR head の通常 CI は成功しています。ただし、以下の blocker はテスト失敗ではなく、provenance の結合点と runtime evidence の不足に関するものです。 Findings[P1] 認証した exact CheckRun ID が producer decision に結合されていない
一方、 したがって静的にコードパスを追う限り、次の mutant が通過します。 これは current CheckRun を別のものとして認証する攻撃ではありませんが、最終成果物が申告する CheckRun provenance と、trusted consumer が認証した CheckRun provenance が不一致でも SUCCESS になる状態です。Issue #2100 が要求する「最終 trusted verdict までの完全な provenance tuple」と一致していません。 必須修正
check_run_id
job_id
workflow_run_id
run_attempt
head_sha
app_id
app_slugその上で 併せて、trusted payload を一切変更せず、decision の CheckRun ID だけを別 ID に変更する adversarial test を追加してください。 [P1] strict-attempt CheckRun と、ダウンロードした artifact の attempt が結合されていない新しい jobs 取得は正しく attempt-specific endpoint を使用しています。しかし decision/evidence artifact は従来どおり run-scoped endpoint から取得され、同名 artifact の最初の一件を無条件で採用しています。 gh api "repos/${REPO}/actions/runs/${RUN_ID}/artifacts?per_page=100"
[.artifacts[] | select(.name=="visual-impact-decision-v1")][0]
[.artifacts[] | select(.name=="component-vrt-evidence-manifest")][0]ここには次の問題があります。
GitHub の公式 artifact endpoint は このため、以下の状態を current code だけでは排除できません。 これは API 契約とコードから導く推論ですが、少なくとも「artifact が current attempt 由来である」という証明は成立していません。API の既定順序が descending でも、順序は provenance ではなく、 この論点は、候補 branch が同一 run 内で producer を偽装する #2101 の問題と完全には同一ではありません。#2101 は immutable producer/attestation の境界です。本 finding はそれ以前の、current attempt と accepted artifact の freshness relation が欠落している問題です。 必須対応は次のどちらかです。
どちらの場合でも、前 finding の decision CheckRun ID 照合は必要です。 [P1] PR head 版の trusted acquisition path は実行されておらず、AC10 証拠がレビュー不能
ただし、その結果として PR #2229 に付いた また、新規 workflow test は主に YAML 内の文字列を検査しています。
これは wiring の静的確認には有効ですが、shell 自体を実行しておらず、API failure、multi-page response、途中 empty page、changed 現在 PR 上でレビュー可能なコメントは preview bot のみで、sanitized AC10 log や独立実行結果は添付されていません。リポジトリの review policy でも、PR body self-report は単独では APPROVE の根拠にならず、immediate runtime AC には inspectable な artifact/log evidence が必要です。 必須修正 security-sensitive な acquisition を workflow 内の長い shell から standalone script に分離してください。Python 実装が適しています。current-head の非 privileged CI で、fake 最低限、以下を executable test に含めるべきです。
privileged [P2] REST API version と response schema の契約が固定されていないGitHub の endpoint examples は また、attempt-specific endpoint の公式 response example には 推奨は、全 trusted API call に共通 wrapper を設け、Accept、API version、timeout、HTTP failure taxonomy を一元化することです。attempt の一次束縛は endpoint path の 評価できる点実装の中心部分は良好です。
また、candidate code を privileged 推奨する最小 fix delta
verdict: REQUEST_CHANGES
reviewed_head_sha: bb3dcbba014336e9fa58b00440c6ae957bf28854
blockers:
- authenticated CheckRun identity is discarded and not compared with decision.component_vrt_report_check_run_id
- run-scoped artifacts are not bound to the triggering run_attempt
- candidate-head acquisition path has no executable/current-head runtime evidence
warnings:
- GitHub REST API version and response-schema assumptions are not pinned |
…entity照合とacquisition実行証跡を追加する - P1-1: ComponentVrtCheckrunProvenanceResultに認証済みidentity(check_run_id/job_id/ workflow_run_id/run_attempt/head_sha/app_id/app_slug)を追加し、 verify_trusted_artifact()でdecisionの自己申告component_vrt_report_check_run_id/ github_actions_app_identityと fail-closed で照合する (component_vrt_report_check_run_id_decision_mismatch/ github_actions_app_identity_decision_mismatch) - P1-3: attempt-scoped jobs pagination/cardinality/canonical URL/exact CheckRun取得を acquire_component_vrt_checkrun()として実行可能なPython関数に切り出し、 --mode acquire-component-vrt-checkrun CLIとfake gh subprocessによるend-to-end実行 テストを追加。workflow側はinline gh api/jqのpaginationループをこのCLI呼び出しに置換 - P1-2: artifact-attempt bindingが未実装でありIssue #2230で追跡している旨のコメントを verify_trusted_artifact()に追加(コード変更ではなくscope narrowing) - P2: gh api呼び出しにAccept/X-GitHub-Api-Versionヘッダを明示的に固定 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta iteration 1 完了報告(impl-review-loop)OWNER レビュー(issuecomment-5308275349、REQUEST_CHANGES、reviewed_head_sha 対応内容
独立検証結果
最終判定verdict: APPROVE
reviewed_head_sha: "2e5bf8c1b7cf5e7cdfb65d27df27284170b9b3ed"
blockers: []
warnings: []live mergeability: merge not performed — 指示通り、ここで停止し人間のマージ判断を待ちます。 |
Summary
visual-impact-policy-trustedの base-locked trusted consumer が、triggeringworkflow_run.idと strictrun_attemptを trust root として attempt-specific jobs endpoint を pagination 完走し、component-vrt-reportjob(cardinality exactly one)のcheck_run_urlから exact CheckRun を独立取得して、run/attempt ↔ CheckRun の provenance tuple を final verdict で fail-closed に検証するようにする。head SHA・CheckRun name・github-actionsApp identity が一致していても、別workflow_run.id/ 別run_attemptからのcomponent-vrt-reportCheckRun substitution は拒否される。さらに、認証済み CheckRun identity(check_run_id/app_id/app_slug)を producer 側の自己申告 decision(component_vrt_report_check_run_id/github_actions_app_identity)と最終境界で fail-closed に照合し、両者の不一致も拒否する。本 PR が保証する範囲は、triggering workflow run/attempt に対して exact
component-vrt-reportCheckRun が存在し、その CheckRun ID が decision の自己申告値と一致することのみである。decision/evidence artifact(visual-impact-decision-v1/component-vrt-evidence-manifest)自体が同一 run_attempt 由来であることの保証(artifact-attempt binding)は本 PR のスコープ外であり、GitHub の artifact 一覧 API に attempt を絞り込む機能が無いことに起因する構造的ギャップとして #2230 で追跡する。Closes #2100(本 Issue を解決する)
baseline main は
acb422b5f24b93c4ee6aea5518ad57b072f384e0(Issue #2100 の Current Validated Scope に記録された fresh source baseline)。実装ブランチは origin/mainda0169d76b7dd6839ea2425fc5d8e35e4eb556f9へ rebase 済みで、コンフリクトは発生していない(5つの先行コミットはいずれも本 PR の Allowed Paths を変更していない)。変更内容
scripts/agent-ops/resolve_visual_impact.py:verify_component_vrt_checkrun_provenance()を追加。job のrun_id/run_attempt/head_sha/name/conclusionと CheckRun のid/name/head_sha/status/conclusion/app.id/app.slug、およびjob.check_run_url↔ 独立取得した exact CheckRun の join を検証する。require_component_vrt_checkrun_provenanceは CLI builder 経路で常時trueになり、呼び出し側の opt-out を持たない。.github/workflows/visual-impact-trusted-consumer.yml: attempt-specific jobs endpoint(repos/{repo}/actions/runs/{run_id}/attempts/{run_attempt}/jobs)を pagination 完走し、component-vrt-reportの cardinality exactly one を確認したうえでcheck_run_urlを抽出、exact CheckRun API を独立取得して provenance 検証 CLI へ渡す。scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py: workflow contract test を拡張(checkout --refoverride が存在しないこと等)。scripts/agent-ops/tests/test_resolve_visual_impact_checkrun_adversarial.py(新規): 別 run/別 attempt からのcomponent-vrt-reportCheckRun substitution 拒否、malformed/API失敗、cardinality違反などの adversarial negative control を追加。fix_delta(OWNER レビュー issuecomment-5308275349 対応、iteration 1)
ComponentVrtCheckrunProvenanceResultに認証成功時のみ populate されるcheck_run_id/job_id/workflow_run_id/run_attempt/head_sha/app_id/app_slugを追加し、verify_trusted_artifact()の最終境界でdecision.component_vrt_report_check_run_idを認証済みcheck_run_idと、github_actions_app_identityを認証済みapp_id/app_slugと fail-closed に照合する(不一致・欠落は新 reason codecomponent_vrt_report_check_run_id_decision_mismatch/github_actions_app_identity_decision_mismatchで拒否)。decision 側だけを別の genuine CheckRun ID にすり替える adversarial test を追加。acquire_component_vrt_checkrun()としてresolve_visual_impact.pyに切り出し、新 CLI mode--mode acquire-component-vrt-checkrunを追加。visual-impact-trusted-consumer.ymlの該当ステップはこの CLI 呼び出しに置換(privilegedworkflow_runトリガー・base-locked evaluator という信頼境界は維持し、候補ブランチのコードを直接実行する設計変更はしていない)。101件超の multi-page pagination、cardinality 0/2件超、duplicate job ID、total_count変化、非2xx、malformed JSON、必須フィールド欠落、canonical URL 不一致等をカバーする fixture-backed executable test を追加。visual-impact-trusted-consumer.ymlの全gh api呼び出しにAccept: application/vnd.github+json/X-GitHub-Api-Version: 2022-11-28を明示。Not implemented in this PR(スコープ外)
Checks
pnpm typecheck: PASSpnpm lint: PASSpnpm test: PASS(1872 tests, 112 files)pnpm build: PASSgit diff --check: PASSuv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: PASS(24 tests, read-only verification、実装・テスト自体は変更なし)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py scripts/agent-ops/tests/test_resolve_visual_impact_checkrun_adversarial.py -v: PASS(79 tests、fix_delta iteration 1 で追加した identity cross-check adversarial test 6件 + acquisition fixture test 15件を含む)uv run --locked pytest scripts/agent-ops/tests/: PASS(577 passed)actionlint .github/workflows/visual-impact-trusted-consumer.yml(v1.7.12、公式 rhysd/actionlint release を一時ディレクトリへ導入して実行): PASSuv run --locked ruff check(変更した3 Python ファイル): PASSAC10 Runtime Proof(read-only
gh apiによる実地検証)completed
pull_requestイベントのciworkflow run を対象に、以下を独立検証(sanitized identifiers のみ記録、token/Authorization header/raw API 全文は非記録):id=31946683002,run_attempt=1,head_sha冒頭51850929...component-vrt-reportの cardinality が exactly one であることを確認(job.id=95163696378)job.run_idが expected workflow run id と一致することを確認job.check_run_urlがrepos/{repo}/check-runs/{id}形式の exact Checks endpoint であることを確認し、CheckRun ID を抽出GET /repos/{repo}/check-runs/95163696378を取得し、id/name/head_sha/status=completed/conclusion=success/app.slug=github-actionsを検証証跡:
artifacts/runtime-verification-AC10-20260816T123524Z.log(sanitized evidence)。SKIP へのフォールバックや producer self-report での代用は行っていない。CI_TEST_PERFORMANCE_DECISION_V1
pr_numberは本 PR 起票前に生成したためnull。current-head のCI_CHECK_RUN_SCOPED等 authoritative CI evidence は本 PR 作成後の CI run から取得する。Visual Impact Declaration(視覚影響申告)
本 PR は UI(DOM/CSS)を変更していないが、
scripts/agent-ops/resolve_visual_impact.pyと.github/workflows/visual-impact-trusted-consumer.ymlがMETA_POLICY_PATHS(評価器/ポリシー自体のパス)に含まれるため、resolve()の meta_policy_change ルールにより登録済み全 surface が機械的に affected 扱いになる。実際の visual 変更が無いことはcomponent-vrt-reportjob の実 VRT 実行結果(baseline との差分なし)で担保される。Allowed Paths 準拠確認
変更ファイルは Issue #2100 の Allowed Paths 4件と完全一致(
git diff --name-onlyで確認済み):.github/workflows/visual-impact-trusted-consumer.ymlscripts/agent-ops/resolve_visual_impact.pyscripts/agent-ops/tests/test_visual_impact_trusted_consumer.pyscripts/agent-ops/tests/test_resolve_visual_impact_checkrun_adversarial.pySchema Change Applicability
本 PR は既存の internal provenance verification ロジックの拡張であり、外部消費される schema 定義の追加・変更は行わない。
Schema Consumer Inventory
該当なし(
not_schema_changeのため)。Safety Claim Matrix
workflow_run.idまたは別run_attemptからのcomponent-vrt-reportCheckRun substitution を、head SHA・CheckRun name・github-actionsApp identity が一致していても final trusted verdict で fail-closed に拒否する(Controlled)scripts/agent-ops/tests/test_resolve_visual_impact_checkrun_adversarial.pyの adversarial negative control(別 run/別 attempt からの substitution 拒否)+ AC10 runtime proof(artifacts/runtime-verification-AC10-20260816T123524Z.log)check_run_id/app_id/app_slug)と producer 側 decision の自己申告値(component_vrt_report_check_run_id/github_actions_app_identity)を最終境界で fail-closed に照合する(Controlled)test_decision_check_run_id_mismatch_against_authenticated_provenance_is_rejected等 identity cross-check adversarial test 6件本 PR は「provenance is fully trusted」「fully safe」等の広範な claim を行わない。Controlled/Not controlled の境界を上記の通り明示する。
Notes
visual-impact-trusted-consumer.ymlの base-locked consumer 側で exact triggering workflow run / attempt binding を実装した。ci.yml(candidate-controlled producer context)は read-only design reference のままで、Allowed Paths に含まれず変更していない。impl-review-loopによる独立 verification(test-runner)/ PR review(pr-reviewer)を継続する。merge は人間判断待ちとし、本 PR では実行しない。bb3dcbba014336e9fa58b00440c6ae957bf28854)を受けて fix_delta iteration 1 を適用し、head2e5bf8c1b7cf5e7cdfb65d27df27284170b9b3edへ更新した。artifact-attempt binding のギャップは follow-up Issue #2230 として分離起票済み。