Skip to content

fix: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する (#2076) - #2085

Merged
squne121 merged 2 commits into
mainfrom
worktree-issue-2076-visual-impact-trusted-consumer-yml-gh-ap
Aug 11, 2026
Merged

squne121 merged 2 commits into
mainfrom
worktree-issue-2076-visual-impact-trusted-consumer-yml-gh-ap

Conversation

@squne121

@squne121 squne121 commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #2076 の契約に従い、.github/workflows/visual-impact-trusted-consumer.yml の producer artifact download で未対応の --output を使わないよう、stdout リダイレクトへの2行変更を提供する。対象PRは Draft のままとし、Issue は Closes #2076 で紐付ける。

Checks

  • current PR head: 9865e529fc6b155ca519ec10febf243be076dc3c
  • current PR base: 9aa2cb45e23409e164cb885c8b02cc8816808bc6
  • Allowed Paths readback: .github/workflows/visual-impact-trusted-consumer.yml のみ。
  • AC1/AC2: current-head PR diff で --output の2箇所を stdout リダイレクトへ置換していることを確認した。追加の製品差分はない。
  • current-head CI run 31463851015 は success。typecheck、lint、test、build、actionlint、python-test、e2e、ci-verdict-summary、visual-impact-policy を含むCI Check Runは success である。
  • visual-impact-policy-trusted の failure は別の workflow_run consumer 状態であり、Issue contract の deferred runtime verification を本PRの成功証拠へ読み替えない。

受け入れ条件の達成状況

  • AC1: current-head PR diff に gh api と --output の組み合わせは残らず、対象2箇所は stdout リダイレクトへ置換されている。
  • AC2: decision.zip と evidence.zip は、それぞれ gh api ... > decision.zip と gh api ... > evidence.zip の形で取得する。
  • AC3: Runtime Verification Applicability は deferred。main landing 後に fix(contract-review): RVA 欠落を fail-closed に統一 #2070 を最新 main へ更新して fresh CI を発生させる post-merge 条件であり、current head における genuine runtime 成功は主張しない。

Allowed Paths 遵守

Visual Impact Declaration(視覚影響申告)

この workflow の変更は meta policy change として次の2 surface に影響する。UI baseline の変更は主張せず、宣言は untrusted input としてCIの独立判定に委ねる。

schema: VISUAL_IMPACT_DECLARATION_V1
surfaces:
  - surface_id: combat-hud-critical
    disposition: verified_unchanged
  - surface_id: combat-hud-running
    disposition: verified_unchanged

Schema Change Applicability

  • decision: not_schema_change
  • reason: workflow の既存 shell command 2箇所の出力先を変更するだけであり、キー集合・スキーマ・型定義・consumer contract は変更しない。

Schema Consumer Inventory

before

gh api ... --output <zip> が未対応フラグで失敗し、artifact download が完了しない。

after

gh api ... > <zip> により GitHub CLI の標準出力を同じ zip ファイルへ保存する。

Consumer ファイル 更新有無 備考
.github/workflows/visual-impact-trusted-consumer.yml はい producer artifact の download command 2箇所のみ
resolve_visual_impact.py いいえ evaluator contract を変更しない

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
未対応 --output を artifact download command から除去する はい post-merge の genuine workflow_run 実行 current-head PR diff と run 31463851015 の actionlint success #2076 merge 後に #2070 を更新して deferred 条件を確認
producer artifact を既存 evaluator へ渡す経路を維持する はい untrusted artifact の長期 hardening 変更範囲は download command 2行のみ #2076 の範囲外。必要時は別 Issue として扱う
current-head CI の確認範囲を限定する はい deferred runtime verification と statusCheckRollup 集約 run 31463851015 の scoped CI Check Run success #2076 のpost-merge条件とcontrol-plane blockerは別途扱う

CI_TEST_PERFORMANCE_DECISION_V1

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 2076
  pr_number: 2085
  decision_scope: ci_change
  changed_paths:
    - .github/workflows/visual-impact-trusted-consumer.yml
  lane_classification:
    fast_static:
      applicable: true
      evidence:
        - "run 31463851015: typecheck/lint/actionlint success"
      required_commands:
        - pnpm typecheck
        - pnpm lint
    python_unit:
      applicable: true
      evidence:
        - "run 31463851015: test/python-test/python-test-core success"
      required_commands:
        - pnpm test
    contract_artifact:
      applicable: true
      evidence:
        - "run 31463851015: visual-impact-policy/ci-verdict-summary success"
        - "current-head PR diff: workflow file 1件、stdout redirect 2行"
      required_commands:
        - "Issue #2076 AC1/AC2 static assertions"
        - "actionlint .github/workflows/visual-impact-trusted-consumer.yml"
    integration:
      applicable: true
      evidence:
        - "run 31463851015: build/e2e success"
      required_commands:
        - pnpm build
  baseline_inputs:
    ci_runtime_baseline_v1_available: true
    run_count: 1
    p50_p95_ready: false
  artifact_consistency:
    ci_test_selection_v1_checked: false
    missing_pytest_args: []
  risk_flags:
    - baseline_insufficient
    - "workflow_run の genuine runtime verification は deferred"
  reviewer_gate:
    approve_allowed: true
    required_evidence:
      - CI_CHECK_RUN_SCOPED
      - ci_runtime_baseline_v1
    approve_denied_reason: null
  follow_up_required:
    - null

Notes

visual-impact-trusted-consumer.yml の Download producer artifacts ステップで
gh api ... --output decision.zip / evidence.zip を実行していたが、gh api は
--output フラグをサポートしておらず unknown flag: --output で常に失敗していた。
gh api ... > decision.zip / > evidence.zip のstdoutリダイレクト形式へ修正し、
visual-impact-policy-trusted CheckRun が実際に producer artifact を取得・検証
できるようにする。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2085/

The preview will be removed when this PR is closed.

@squne121

Copy link
Copy Markdown
Owner Author

判定

システム全体としては REQUEST_CHANGES 相当です。
ただし、PR #2085 の 2行のコード変更そのものは正しいです。問題は、この修正で復活する visual-impact-policy-trusted が、現在の実装では名前どおりの「trusted な独立検証」になっていない点です。

PR #2085 は current head 9865e529fc6b155ca519ec10febf243be076dc3c、1ファイル・+2/-2 で、gh api ... --output file.zip を stdout redirect に置換しています。 GitHub CLI の現行 gh api に --output はなく API 応答は stdout に出るため、この修正方向は妥当です。Artifact REST API も ZIP download endpoint を提供します。([GitHub CLI]1)

Findings

  1. P0 — untrusted producer が「整合した偽 artifact」を作れば trusted consumer を PASS させられます。

    trusted workflow 自身のコメントは、PR head が ci.yml の producer job 定義を支配でき、exit 0 化・step 削除等が可能であることを正しく認識しています。そのうえで producer artifact を「fully UNTRUSTED」として再検証し、producer が verdict を強制できない、と主張しています。

    しかし base-locked な verify_trusted_artifact() が独立に確認している identity は実質、
    head_sha、repository、pull_request_number
    の3つだけです。残りは schema validation と artifact 内部の自己整合性検査です。

    特に canonical schema では affected_surfaces が単なる array で minItems がありません。component_vrt_report_check_run_id、artifact_id、artifact_digest も null が許されています。

    したがって悪意ある PR は、自分が制御する producer から例えば次のような意味の decision を生成できます。

    repository            = 正しい値
    pull_request_number   = 正しい値
    head_sha              = 正しい current head
    base_sha / registry SHA / hashes = 書式だけ正しい偽値
    affected_surfaces     = []
    component VRT check   = null
    artifact metadata     = null
    

    evidence artifact を出さなくても、verifier は affected_surfaces を loop するだけなので reason が1件も追加されず ok=True になります。これは digest collision のような理論攻撃ではなく、現在のコードから直接導ける bypass です。

    既存の AC33 テストも「producer が success を偽装したが artifact が不整合/欠落」という negative control しかありません。producer が decision と manifest の双方を整合するよう偽造するケースを検証していません。実際、正常系テスト自体が synthetic な decision + synthetic manifest の自己整合性だけで PASS します。

    GitHub も workflow_run は先行 workflow が untrusted code を実行し得る場合に security risk があると明示しており、後続 workflow で secrets/write token を扱う場合は特に注意を求めています。([GitHub Docs]2)

    これは fix: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する (#2076) #2085 が新しく作ったバグではありません。 実装: visual-surface dependency registry と required visual-impact policy check を導入し、UI変更PR内でVRT処置を強制する #2019 の trusted-consumer 設計の既存 P0 です。ただし fix: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する (#2076) #2085 を merge すると transport failure が解消され、今度はこの verifier が実際に green を出せるようになるため、見逃してよい問題ではありません。

  2. P1 — GitHub が持つ provenance をほぼ検証していません。

    VISUAL_IMPACT_DECISION_V1 には base_sha、registry blob SHA、PR body digest、changed-path digest、component VRT CheckRun ID、GitHub Actions identity、artifact ID/digest が入っていますが、trusted consumer はそれらを GitHub API の live data と再照合していません。

    GitHub artifact API からは artifact の size_in_bytes、digest、workflow run 情報等を取得できます。([GitHub Docs]3) 少なくとも trusted side で、live PR diff → affected surfaces、current PR body digest、artifact metadata、component-VRT CheckRun の App/結論を再取得して producer の自己申告と突合すべきです。

    より強くするなら、candidate-controlled workflow の自己申告を信頼根にせず、trusted commit SHA で pin した reusable workflow に evidence-producing logic を移し、artifact attestation を発行・検証する設計が適しています。GitHub は reusable workflow を {owner}/{repo}/.github/workflows/<file>@<ref> で参照でき、commit SHA pin を最も安全な選択肢としています。また artifact attestation は workflow・repository・commit 等に provenance を結び付けられます。([GitHub Docs]4)

    重要なのは「untrusted producer が自分で attestation する」だけでは不足なことです。attestation signer 自体を trusted workflow に固定する必要があります。

  3. P1 — untrusted ZIP を検証前に workspace へ無制限展開しています。

    現在は artifact を decision.zip / evidence.zip に落とし、そのまま unzip -o -q で repository workspace 配下へ展開した後、Python verifier が JSON の byte-size 上限を確認します。

    つまり verifier の 1 MB / 5 MB 上限は ZIP 展開前の resource bound ではありません。producer が untrusted という設計なら、archive metadata を取得して compressed/uncompressed size と entry set を先に制限し、${RUNNER_TEMP} 配下へ展開する方が境界として明確です。これは 実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する #2076 の以前の adversarial review でも follow-up hardening 候補として既に認識されています。

  4. P2 — post-merge AC3 は transport reachability の証明にはなるが、trust correctness の証明にはなりません。

    実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する #2076 は適切に Runtime Verification Applicability: deferred へ修正され、main landing 後に fix(contract-review): RVA 欠落を fail-closed に統一 #2070 を latest main に更新し、Download producer artifacts = success、independent verifier が non-skipped、current-head CheckRun が出ることを要求しています。

    これは今回の --output バグを直したことの runtime evidence としては十分です。しかし上記 P0 が残る以上、visual-impact-policy-trusted = success を「独立した安全性判定が成立した」と読むことはできません。

    AC33/AC34 系に少なくとも次の adversarial fixture が必要です。

    candidate-controlled producer → schema-valid + self-consistent + affected_surfaces=[] → trusted consumer MUST FAIL

    加えて non-empty surface についても、producer が decision と manifest の双方を自己整合するよう偽造したケースを FAIL させる必要があります。

PR #2085 をどう扱うべきか

この P0 を PR #2085 の1ファイル2行 scope に混載するのは勧めません。#2076 は evaluator logic を明示的に Out of Scope としており、#2070 との exact-overlap を解く bootstrap PR として綺麗に分離されています。現在の active repository ruleset で required status check になっているのは typecheck / lint / test / build / python-test であり、visual-impact-policy-trusted は含まれていません。 classic branch protection は GitHub App 権限で 403 となったため、そこまで含めた完全な enforcement 状態だけは独立確認できませんでした。

したがって推奨は次です。

最終評価

Patch correctness: APPROVE
PR #2085 単体の bootstrap scope: 条件付き APPROVE
visual-impact-policy-trusted をセキュリティ境界として完成済みとする主張: REQUEST_CHANGES / P0

既存 pr-reviewer APPROVE は2行差分と #2076 contract を見る限り理解できますが、関連する #2019 trust model まで敵対的に展開すると、その判定だけでは不十分です。今回最も重要なのは --output の2行ではなく、「untrusted producer の自己整合した出力」を cryptographic/provenance evidence と誤認していることです。

@squne121

Copy link
Copy Markdown
Owner Author

レビューありがとうございます。ご指摘の通り対応します。

対応方針

  1. PR fix: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する (#2076) #2085(本PR): 2行diffのscopeは維持し、追加のリファクタは行いません。「trusted verification を安全に完成させる」という主張はしておらず、Issue 実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する #2076 の Outcome も「producer artifact の download に成功し、実際の独立再検証結果(success/failure)を報告できる状態」に限定した記述になっています。

  2. P0 follow-up の起票: ご指摘の forged-self-consistent artifact bypass(verify_trusted_artifact() が producer 自己申告の affected_surfaces を独立に re-derive せず、affected_surfaces: [] の自己整合的な偽 decision で ok=True を通してしまう問題)を Issue 調査: visual-impact-policy-trusted の base-locked evaluator が untrusted producer の自己申告 affected_surfaces を re-derive せず、forged-self-consistent artifact で bypass可能 #2090 として起票しました。

    調査: visual-impact-policy-trusted の base-locked evaluator が untrusted producer の自己申告 affected_surfaces を re-derive せず、forged-self-consistent artifact で bypass可能 #2090

    Scope は verify_trusted_artifact() の trusted-side re-derivation(live PR diff × registry からの affected_surfaces 再計算、component-VRT CheckRun / artifact metadata の live re-check)と、forged-self-consistent artifact を確実に FAIL させる adversarial fixture の追加です。PR fix: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する (#2076) #2085 の変更とは分離し、混載していません。

  3. visual-impact-policy-trusted を required status check に昇格させるのは Issue 調査: visual-impact-policy-trusted の base-locked evaluator が untrusted producer の自己申告 affected_surfaces を re-derive せず、forged-self-consistent artifact で bypass可能 #2090 完了後とし、本PRでは行いません。

以上を踏まえ、PR #2085 自体(2行のtransport bug修正)はご指摘どおり patch correctness / bootstrap scope として妥当と理解しております。マージ判断は引き続き人間にお任せします。

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.

実装: visual-impact-trusted-consumer.yml の gh api --output 未対応バグを修正する

1 participant