Repository navigation
fix: visual-impact-policy-trusted の trusted-side re-derivation で forged-self-consistent artifact bypass を fail-closed に修正する - #2094
Merged
Conversation
…ed-self-consistent artifact bypass を fail-closed に修正する (#2091) verify_trusted_artifact() を拡張し、affected_surfaces の自己申告受容(bypass1)と evidence: {} coherent forgery(bypass2)を trusted side からの独立再計算・digest突合で 拒否するようにした。load_registry_text() は commit object 不存在(shallow checkout 等) と file 不存在を区別し、前者を fail-closed にした(AC4)。resolve_trusted_minimum() が TS-compiler graph walk なしで meta-policy/global-invalidator/direct-producer/ mapping-deletion/coverage-boundary の各シグナルを trusted side で再計算する。 Refs #2090
Contributor
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2094/ The preview will be removed when this PR is closed. |
Owner
Author
pr-review-judge 結果: APPROVEreviewed_head_sha: AC1〜AC7 を live diff・独立 pytest 実行(26 tests PASS)・関連 regression 9 file(74 tests)・Allowed Paths gate・required CI(6件 SUCCESS)で検証。blocker なし。
blockers: [] |
squne121
marked this pull request as ready for review
August 11, 2026 10:52
This was referenced Aug 11, 2026
squne121
added a commit
that referenced
this pull request
Aug 12, 2026
…トリガー (#2099) visual-impact-policy job のログにより、空 surfaces:[] では meta_policy_change で affected 扱いになった combat-hud-critical / combat-hud-running の各エントリが missing 判定されることが判明した(PR #2094 の既存前例パターンに合わせ、両 surface に disposition: verified_unchanged を明示)。component-vrt-report job の 実 VRT 実行結果(baseline diff 0px)がこの申告の evidence として機能する。 コード変更は含まない。
4 tasks done
squne121
added a commit
that referenced
this pull request
Aug 13, 2026
…ility の trusted-side 独立検証を追加する (#2144) * feat: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加 (#2099) candidate PR head を checkout/materialize せず、既にfetch済みのgit commit objectを `git ls-tree`/`git cat-file` で読むだけの base-locked な static import resolver (`resolve_trusted_transitive_graph()`) を追加し、 `resolve_trusted_minimum()` の trusted 5シグナルに transitive reachability チェックを追加した (Issue #2099 AC1/AC2)。absolute path / `..` escape / symlink escape / `/` 始まり specifier は単一の confined resolver で 一貫して拒否し (AC3)、per-file/total bytes・file count・import-hop depth・ wall-clock time それぞれに個別 fail-closed reason code を持つ resource bound を実装した (AC4)。transitive-only な変更を検出する adversarial fixture を追加し、`affected_surfaces: []` を forge した producer decision を trusted-side で確実に reject することを end-to-end で検証する (AC5)。 `.github/workflows/visual-impact-trusted-consumer.yml` の trusted input 取得における `|| true` fail-open を除去し (AC6)、`git show`/`git diff` の missing-path と genuine plumbing failure を区別する failure taxonomy を `read_git_blob_at_ref()` として実装した (AC7)。TypeScript dependency の trusted-side bootstrap は「Node dependency を一切持ち込まない」設計を 採用し、既存の pnpm/npm/npx 禁止 regression と自然に整合する (AC8)。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * chore: PR本文へ VISUAL_IMPACT_DECLARATION_V1 を追加した再検証トリガー (#2099) meta_policy_change fail-safe が正しく検出した VISUAL_IMPACT_DECLARATION_V1 欠落 (PR review comment #2144 (comment)) を修正するため PR body を更新した。visual-impact-policy job は github.event.pull_request.body をイベントトリガー時点の値で評価するため、 本 empty commit で新規 synchronize イベントを発火し、更新済み body で 再評価させる。コード変更は含まない。 * chore: VISUAL_IMPACT_DECLARATION_V1 に verified_unchanged エントリを追加した再検証トリガー (#2099) visual-impact-policy job のログにより、空 surfaces:[] では meta_policy_change で affected 扱いになった combat-hud-critical / combat-hud-running の各エントリが missing 判定されることが判明した(PR #2094 の既存前例パターンに合わせ、両 surface に disposition: verified_unchanged を明示)。component-vrt-report job の 実 VRT 実行結果(baseline diff 0px)がこの申告の evidence として機能する。 コード変更は含まない。 * fix: trusted transitive graph walker の CSS 削除バイパス・素の相対URL・無制限git・plumbing誤分類を修正 (#2099) PR #2144 レビュー fix_delta (iteration 2, human REQUEST_CHANGES) への対応: - P1-1: CSS `url()` のターゲットが候補ヘッドで削除/存在しない場合、これまで サイレントにグラフから消えていたのを `unresolvable_static_import` として fail-closed に報告するよう修正。`resolve_trusted_minimum()` はこれを `trusted_transitive_unknown_impact` として affected surface に反映するため、 偽の `affected_surfaces: []` を検出できる。 - P1-2: CSS `url()`/`@import` の素の相対指定子(`./` プレフィックスなし、 例 `bg.png`)を JS/TS のバブ import 分類器と区別する `_trusted_is_css_relative_specifier()` を新設し、CSS 専用の確認済み resolver 経路へルーティング。 - P1-3: TrustedGraphWalker/`git_ls_tree()`/`read_git_blob_at_ref()` の git subprocess 呼び出しに、検証全体で共有される単一の絶対デッドラインから 導出した `timeout=` を付与。スタールした git プロセスが wall-clock 上限を超えて無期限にブロックすることを防止。 - P1-4: `git ls-tree` / `git cat-file` の真の plumbing 失敗を resource-bound-exceeded と区別する新しい `TrustedGitPlumbingError` を 導入し、`trusted_transitive_git_plumbing_error:*` という別個の理由コード として最終判定に反映(Issue #2099 AC7 の 3 分類維持)。 新規リグレッションテスト 10 件を追加(28/28 既存+新規 pass、visual-impact consumer/schema 76/76 pass、ruff check/format 通過)。 Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
verify_trusted_artifact()の producer 自己申告affected_surfaces受容 bypass、evidence: {}coherent forgery bypass、load_registry_text()の missing-ref-object/missing-file 混同)を実装として反映する。verify_trusted_artifact()を拡張し、trusted side で独立に取得・再計算したbase_sha/PR body digest/changed-path digest/base-head registry blob sha/policy_versionのいずれかと producer 自己申告 decision を突合するロジックを追加した。evidence: {}(digest claim なし)の coherent forgery は、trusted_rederivationの有無に関わらず常に拒否する(surface_id が正しくても拒否)。resolve_trusted_minimum()を新設し、TS-compiler graph walk(resolve_visual_impact.mjs/Node)を一切使わず、meta-policy path / global invalidator / direct producer・contract path / registry-union mapping deletion / coverage-root boundary の 5 シグナルのみで trusted side から affected surfaces を独立に粗く再計算し、producer の過小申告(affected_surfaces: []forgery を含む)を検出する。load_registry_text()にMissingRefObjectErrorを追加し、commit object 不存在(shallow checkout 等)を、file 不存在(正当な bootstrap ケース)と区別して fail-closed にした。.github/workflows/visual-impact-trusted-consumer.ymlに、live base_sha 取得・PR body 取得・git diff/git show(候補 PR head の checkout やコード実行は一切行わない、静的データ読み取りのみ)による changed-path/registry の trusted-side独立取得ステップを追加した。Linked Issue(関連する Issue 番号)
本 PR が close する実装 Issue と、調査結果の正本として参照する research Issue は次の通り。
Closes #2091
Refs #2090
Acceptance Criteria
verify_trusted_artifact()が producer 自己申告に加え、trusted side で独立再計算した値(base_sha/changed-path digest/registry blob sha/policy_version)と突合するロジックを持つaffected_surfaces: []を含む forged decision がok=Falseとして拒否される(test_affected_surfaces_empty_forgery_rejected)evidence: {}coherent forgery がok=Falseとして拒否される(test_evidence_empty_coherent_forgery_rejected)load_registry_text()が missing-ref-object と missing-file を区別し、前者を fail-closed にする(test_missing_ref_object_fail_closed)affected_surfaces: []が引き続き PASS する回帰テストが存在する(test_no_visual_impact_empty_surfaces_pass)docs/dev/visual-impact.schema.jsonのaffected_surfacesにminItems: 1が追加されていない>3000 filesincomplete diff + stale base)が追加されているVerification(検証)
追加で実行した repository gate(すべて PASS):
Checks
pnpm typecheckpnpm lintpnpm testpnpm buildAllowed Paths Compliance(許可パス遵守)
scripts/agent-ops/resolve_visual_impact.py✅scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py✅.github/workflows/visual-impact-trusted-consumer.yml✅docs/dev/visual-impact.schema.jsonは変更していない(AC6 のminItems非追加要件をそのまま満たすため無変更)git diff --statで確認済み)Schema Change Applicability
not_schema_changedocs/dev/visual-impact.schema.json(VISUAL_IMPACT_DECISION_V1/VISUAL_IMPACT_DECLARATION_V1の canonical schema)自体は無変更。verify_trusted_artifact()に追加したtrusted_rederivationkwarg はデフォルトNoneの後方互換追加であり、既存呼び出し元(CLI--mode verify-trusted-artifactの既存フラグ)はそのまま動作する。Schema Consumer Inventory
N/A(
not_schema_changeのため)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 との差分 0px)で担保される。CI Test Performance Decision(CIテストパフォーマンス判定)
python-testレーンへの新規テストは 26 件・0.25 秒で軽微であり、runtime baseline への影響は無視できる。Safety Claim Matrix
affected_surfaces: []を trusted-side 独立再計算で拒否するresolve_trusted_minimum()は meta-policy/global-invalidator/direct-producer/mapping-deletion/coverage-boundary のみを判定し、TS-compiler transitive import graph(resolve_visual_impact.mjs)経由でのみ到達可能な surface の過小申告はこの trusted-side 独立検証だけでは検出できないtest_affected_surfaces_empty_forgery_rejectedPASSevidence: {}coherent forgery を拒否するtest_evidence_empty_coherent_forgery_rejectedPASSload_registry_text()の missing-ref-object を fail-closed にするtest_missing_ref_object_fail_closed,test_missing_ref_object_never_silently_empty_registry_in_resolvePASSaffected_surfaces: []PASS を維持するtest_no_visual_impact_empty_surfaces_passPASSbase_shaを拒否するtest_stale_base_rejectedPASS(livebase_shaの trusted-side取得は workflow 内gh api呼び出しに依存する)test_incomplete_changed_paths_rejectedPASS(実運用の workflow では REST files API でなく localgit diff --name-statusを使うため 3,000 件上限自体を設計上回避している)記載ルール遵守: 本 PR の Summary / title では無限定の
safe/read-only/sandboxed/isolated/completeを使用していない。主張は「trusted side で独立に取得・再計算した値との突合」という実装済みの境界に限定している。Not controlled(制御外事項)
resolve_visual_impact.mjsの Node/TS 解析を trust boundary に持ち込む設計は本 PR に含まない)Follow-up
Notes
scripts/agent-ops/resolve_visual_impact.py/scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py/.github/workflows/visual-impact-trusted-consumer.yml)に限定。docs/dev/visual-impact.schema.jsonは無変更。worktree-issue-2040-trusted-current-main、Issue 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040)は同じ.github/workflows/visual-impact-trusted-consumer.ymlを changed-file として含むが、declared_path_overlap advisory check では disjoint と判定された。実際の hunk 競合が発生した場合は merge 前に解消する。