Skip to content

実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1408"
goal_ref: "Issue #1450への人間の敵対的セキュリティレビュー(https://github.com/squne121/loop-protocol/issues/1450#issuecomment-4943281788)で指摘されたP1 Blocker「hash verifier/analyzer自体がcandidate-controlledであり、candidate repository内には信頼の起点となるexternal trust rootが存在しない」を解消する。さらに本Issue自身へのOWNER敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1454#issuecomment-4944530037、REQUEST_CHANGES)で指摘されたP1 Blocker(managed hook registrationの欠如・working tree digestとpush対象commitの不一致・検査後command書換えの欠如)を解消する"
change_kind: code

Parent Issue

#1408

Parent Goal Ref

  • Goal: Issue #1408のpublish lane approval bridgeが、検証済み証跡に基づいてrtk git pushを許可しつつ、危険・不一致なpushをdenyし続ける状態を確立する
  • Desired Destination: Issue 実装: publish laneのauthorization code(policy/adapter)の信頼境界をhash pinningでcandidate worktree外に確立する #1450(policy/adapterのhash pinningによるcandidate worktree内 trust boundary確立)に対する敵対的レビューで、「candidate repository内には信頼の起点が存在しない」ことが指摘された。本Issueはその信頼の起点(agentが書込み不能なexternal trust root)をPhase Aとして確立し、Issue #1450はこのtrust root上でcandidate integrity bindingを行うPhase Bとして本Issueに依存する

Current Validated Scope

Remaining Parent Gaps

  • 本Issue完了後も、実際のpublish lane判定ロジックの統合(.codex/hooks.jsonを本launcherへ実際に向ける本番切替、candidate側codex-hook-adapter.mjsのTCBからの完全分離、既存publish laneのpositive/negative regressionテストをtrusted launcher経由で再検証する統合作業)はIssue 実装: publish laneのauthorization code(policy/adapter)の信頼境界をhash pinningでcandidate worktree外に確立する #1450(Phase B、本Issueにblocked_byとして依存)で扱う
  • privileged operatorによる実機へのinstall実行(install_trust_root.sh / /etc/codex/requirements.tomlへの実登録)は本Issueでは行わず、installer scriptと手順書の提供までを本Issueの範囲とする
  • Node/pnpm session-recording adapter(codex-hook-adapter.mjs・write-codex-session-manifest.mjs等)自体の再実装・security-critical pathからの完全分離実装は本Issueでは行わず、launcher側でNode component群を authorization TCBから除外する契約と検証のみを本Issueで扱う

Outcome

managed PreToolUse(/etc/codex/requirements.tomlにadmin-enforcedで登録されたhook)が捕捉した exact publish lane に対する local authorization TCB が、candidate worktree外の、agentが書込み不能な絶対パスに配置されたtrusted dispatcher/launcherのソース一式・external trust manifest schema(AUTHORIZATION_TCB_MANIFEST_V1)・privileged operator向けbootstrap/rotation installer scriptとしてscripts/trust-root/配下に追加される。launcherはproject-local .codex/hooks.jsonの削除・改変・無効化に依存せず作動し、push対象として確定したlocal_oidのtree/blobをmanifestと照合し、一致時のみupdatedInputでtrusted publisher(絶対パス・--force-with-lease固定)に置換して実行する。manifest欠落時・component改変時・symlink化時・origin/main等のremote-tracking ref書換え時・PATH偽装時・fake rtk実行時にはすべてfail-closedでdenyする。リポジトリ全体のremote-write security boundaryとは表現せず、GitHub branch protection / server-side rulesを最終防御として引き続き前提とすることをdocsに明記する。対応する実subprocess integration test(temporary external trusted directory + temporary candidate worktree + temporary bare Git repositoryを用いた改変検知テスト)がPASSしている状態。

In Scope

  • scripts/trust-root/trusted_hook_launcher.py(dispatcher): candidate repository外の絶対パスで動作するself-contained Python launcherのsource。managed PreToolUse payloadを受け取り、外部manifestを読み込み、push対象として確定したlocal_oidの<local_oid>:<component-path> blob bytesをtrusted Git invocationで読みSHA-256をmanifestと照合する(working tree pathのlstatを正本にしない)。critical pathにuncommitted changeがある場合はcandidate_tree_ambiguousでdenyする。一致時のみ、allow時に元のBash commandをそのまま通すのではなく、updatedInput.commandで絶対パスのtrusted publisher(/usr/bin/git push --force-with-lease=<ref>:<expected-remote-oid> origin <local_oid>:<validated-ref>固定argv)に置換して実行する。Node/pnpm/composite/session-manifest producer(write-codex-session-manifest.mjs・codex-metadata-scan.mjs・codex-postrun-verifier.mjs等)はauthorization TCBから除外し、Pythonは固定absolute pathかつ-I(isolated mode)で実行する
  • scripts/trust-root/manifest_schema.py: AUTHORIZATION_TCB_MANIFEST_V1のschema定義とバリデータ(manifest_version, repository, trusted_commit_oid(full 40-hex), components[].path/sha256, issued_by, generation(monotonic release epoch)を必須とし、unknown key・missing component・duplicate componentをdeny)。digest契約はsha256 / raw file bytes / lowercase hex / 64桁 / regular fileのみ / symlink deny / repository-relative posix path / line-ending正規化なし / unicode正規化なしに固定する。component digestはtrusted_commit_oidのtreeからinstallerが生成する契約とし、任意の手元ファイルからは生成できないことをdocsとinstallerロジックで明記する。issued_byはaudit metadataであり authenticity の根拠にしないことをschema docstringに明記する
  • scripts/trust-root/install_trust_root.sh: privileged operatorが手動実行するinstaller(実行対象はrepo外のoperator指定ディレクトリ。既定値は/opt/loop-protocol/trust-rootのようなroot-owned anchorとし、「任意directory」を許容しない)。installerはrelease-based atomic layout(releases/<generation>-<manifest-digest>/配下にmanifest/authorization component、active.jsonはtmp+fsync+renameで単一原子的activation)を構築し、installer実行時のeuidがtrust root owner euidと同一の場合installationを拒否する(runtime_euid_must_differ_from_owner)。agentはこのスクリプトを実行しない
  • Git参照をtrust rootの入力として使う場合、--no-replace-objectsの使用、明示的な--git-dir指定、GIT_DIR/GIT_COMMON_DIR/GIT_OBJECT_DIRECTORY/GIT_ALTERNATE_OBJECT_DIRECTORIES/GIT_CONFIG_COUNT等の環境変数除去、git rev-parse --verify <oid>^{commit} --end-of-optionsによるcommit型確認をlauncher内で実装する。Git subprocessは固定PATH・専用HOME・GIT_CONFIG_GLOBAL=/dev/null・GIT_CONFIG_SYSTEM=/dev/null・GIT_CONFIG_NOSYSTEM=1を明示し、env -i相当のallowlist方式で環境を構築する(blacklist方式は使わない)
  • publish evidence(session_id/turn_id/tool_use_id/local_oid/remote_oid/issue_number/nonce/expiry)は inherited環境変数ではなく、trusted verifierが生成したversioned JSON/FDで launcher に渡す契約とする。LOOP_CANONICAL_REPO_URL_PATTERN/LOOP_DEFAULT_BRANCHは production launcherでは環境変数由来の値を信頼せず、test-only dependency injectionとしてのみ扱う
  • launcherのfail-closed reason code(authorization_trust_root_missing / authorization_manifest_invalid / authorization_component_missing / authorization_component_type_invalid / authorization_component_digest_mismatch / authorization_reference_untrusted / authorization_runtime_untrusted / candidate_tree_ambiguous / candidate_commit_component_mismatch)を定義し、すべてgeneric allowでなくdenyする
  • featureはmanifestとtrusted directoryがprivileged operatorによってinstallされるまでdisabled(fail-closedでdeny)状態にする
  • privileged bootstrap・manifest rotation・system-managed hook registration(/etc/codex/requirements.tomlへの[features].hooks = true固定と managed PreToolUse登録手順)の手順(担当者・順序・failure/rollback)をdocsに明記する: bootstrap_executor: privileged_operator / manifest_update_authority: privileged_operator / rollback_policy: explicit_operator_approval / activation_order: [merge_trusted_code, install_trusted_runtime, install_manifest, register_managed_hook, enable_publish_lane]。managed hookはallow_managed_hooks_onlyを必須にせず、project-local hookの状態(削除・空化・無効化)に関わらずmanaged launcherが独立して作動する契約であることを明記する
  • 以下のtamperシナリオに対する実subprocess integration testをscripts/trust-root/tests/に追加する: candidate adapter/policy/analyzer/composite改変(working tree改変とHEAD改変の両方を区別)、symlink化、origin/main書換え、refs/replace追加、偽python3/git/node/rtkをPATH先頭配置、.codex/hooks.jsonの削除・空化・別command変更、installer euidとowner euidの同一化、ancestor directoryのgroup-writable化

Out of Scope

Runtime Verification Applicability

  • reason: launcherのtrust boundaryはcandidate worktree外の実プロセス起動・実subprocess実行・実ファイルシステム操作(symlink・lstat・regular file判定)・実Git ref/object/config解決に依存するため、fixtureへの関数呼び出しだけのunit testでは「candidate verifierを消してもdenyされる」ことを証明できない。temporary external trusted directory + temporary candidate worktree + temporary bare Git repository + 実subprocessを用いた統合テストで検証する
decision: immediate
applicable_acs:
  - AC1
  - AC2
  - AC3
  - AC4
  - AC5
  - AC6
  - AC7
  - AC8
  - AC9
  - AC10
  - AC11
  - AC12
  - AC13
  - AC14
  - AC15
  - AC16
execution_environment:
  cli_tools:
    - python3
    - uv
  fixtures:
    - temporary external trusted directory
    - temporary candidate worktree
    - temporary bare Git repository
  auth_required: false
  network_required: false
skip_conditions:
  - "root-owned/EUID分離ファイルシステム操作(chmod/rename/openat相当)をサポートしないCI runner上では、privileged filesystemテストのみ skipif 可能とする(それ以外のtamperシナリオは skip 不可)"
fallback_policy:
  fallback_success_is_pass: false
  notes: "skip対象ACはPRコメントにskip理由と再現手順を明記し、privileged smokeを別artifactとして人間が実施した証跡(実行ログ・timestamp)を添付する。fallback経由の成功をPASSに変換しない"
artifact_requirements:
  - "scripts/trust-root/tests/test_trusted_hook_launcher.py の pytest 出力"
  - "scripts/trust-root/tests/test_manifest_schema.py の pytest 出力"

Acceptance Criteria

  • AC1: launcher entrypointがcandidate repository外の絶対パスに配置される設計になっており、scripts/trust-root/trusted_hook_launcher.pyにその絶対パス解決・owner-only permission検証ロジックが実装されている
  • AC2: scripts/trust-root/manifest_schema.pyがAUTHORIZATION_TCB_MANIFEST_V1のschema・full commit OID・全componentのSHA-256・generationを単一manifestで原子的にbindし、unknown key/missing component/duplicate componentをdenyすることがテストで確認できる
  • AC3: candidate側のadapter/policy/analyzer/compositeいずれかのファイル内容をworking tree上でのみ改変した状態でlauncherを実subprocessとして起動すると、authorization_component_digest_mismatchでdenyする
  • AC4: candidate側のverifier/policyからintegrity checkの呼び出し自体を削除しても、external launcher(candidate側の実行に依存しない構成)がdenyを維持する
  • AC5: 全component一致時、launcherはcandidate側のpolicy/analyzerファイルを実行せず、external trusted directory配下のtrusted copyのみを絶対パスで実行する
  • AC6: candidate componentをsymlink化・非regular file化・欠落・manifest内duplicate entryにした場合、いずれもfail-closedでdenyする
  • AC7: candidate repository内のorigin/main等のremote-tracking refを書き換えても、launcherのtrusted resolutionには影響しない
  • AC8: refs/replaceを追加しても、--no-replace-objects相当のlauncher側処理によりtrusted resolutionに影響しない
  • AC9: PATHの先頭に偽python3 / git / node / rtkを配置しても、launcherおよびtrusted publisherは絶対パス実行のため影響を受けない
  • AC10: privileged bootstrap・manifest rotation・managed hook registrationの担当者・順序・failure/rollback動作がdocs(docs/dev/hook-boundaries.md)にbootstrap_executor / manifest_update_authority / rollback_policy / activation_orderの語句付きで記載されている
  • AC11: manifestとtrusted directoryが未installの状態では、launcherはgeneric allowせずfail-closedでauthorization_trust_root_missingを返す
  • AC12: scripts/trust-root/tests/test_trusted_hook_launcher.pyの実subprocess integration testが全tamperシナリオ(AC3, AC4, AC6-AC9, AC13-AC16相当)を含めてPASSする
  • AC13: .codex/hooks.jsonを削除・空化・別commandに変更した状態でも、scripts/trust-root/install_trust_root.shが生成するmanaged hook登録設定(/etc/codex/requirements.toml相当のfixture)を経由したlauncher起動シナリオではdenyが維持されることを実subprocess integration testで確認できる
  • AC14: HEADにmalicious componentをcommitし working tree のみ approved bytes に戻した状態(candidate_commit_component_mismatchシナリオ)でlauncherを起動すると、working tree検査ではなくlocal_oidのtree/blob検査によりdenyする
  • AC15: 全component一致時、launcherは元のBash commandをそのまま通さず、updatedInput.commandで絶対パス・--force-with-lease=<ref>:<expected-remote-oid>固定のtrusted publisher argvに置換する(fake rtk・PATH置換・HEAD movementの影響を受けない)ことをテストで確認できる
  • AC16: installer実行時のeuidがtrust root owner euidと同一の場合、installerがinstallationを拒否することをテストで確認できる

Verification Commands

# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k external_absolute_path_permission # AC1
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_manifest_schema.py -k manifest_atomic_binding # AC2
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k tamper_component_denied # AC3
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k integrity_check_removed_still_denied # AC4
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k trusted_copy_executed_not_candidate # AC5
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k symlink_and_missing_denied # AC6
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k origin_main_rewrite_ignored # AC7
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k refs_replace_ignored # AC8
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k fake_path_binaries_ignored # AC9
# baseline-expect: fail
$ rg -n "bootstrap_executor" docs/dev/hook-boundaries.md # AC10
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k trust_root_missing_denied # AC11
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py # AC12
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k managed_registration_survives_local_hook_removal # AC13
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k committed_malicious_working_tree_clean_denied # AC14
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k trusted_publisher_command_rewrite # AC15
# baseline-expect: fail
$ uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k installer_same_euid_rejected # AC16

Allowed Paths

  • scripts/trust-root/trusted_hook_launcher.py
  • scripts/trust-root/manifest_schema.py
  • scripts/trust-root/install_trust_root.sh
  • scripts/trust-root/tests/test_trusted_hook_launcher.py
  • scripts/trust-root/tests/test_manifest_schema.py
  • docs/dev/hook-boundaries.md
  • docs/dev/session-recording-policy.md
  • docs/dev/agent-runtime-ops.md
  • .github/ci/python-test-plan.json

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • .codex/hooks.jsonを本launcherへ実際に向ける本番切替が必要と判明した場合
  • privileged operatorによる実機へのinstall実行・managed hook登録の実実行を本Issue内で行う必要が生じた場合
  • Node/pnpm session-recording adapter自体の再実装が必要と判明した場合

Required Skills

  • Python / pytest
  • Bash installer script
  • Git、SHA検証、trust boundary設計
  • Codex PreToolUse / managed hook設定(requirements.toml)の仕様理解

Required Design References

Delivery Rule

Scope Delta(任意)

Activity

  1. squne121 commented on Jul 11, 2026

    @squne121
    OwnerAuthor

    create-issue transaction partial-failure

    Issue: #1454
    Failure stage: label-apply
    Message: label-apply failed

    Requested:

    Failure context: command=gh issue edit --repo squne121/loop-protocol 1454 --add-label phase/implementation,agent/implementer,enhancement,triage-required,security
    output=failed to update #1454: 'security' not found
    failed to update 1 issue
    matching_issue_numbers=[1454]
    issue_number=1454

    Recovery hint: stage 'label-apply' encountered an unexpected failure.
    Generic guidance: verify the issue state manually and re-run the transaction if safe.
    gh issue view 1454 --repo squne121/loop-protocol --json number,title,labels,state
    idempotent re-run: depends on the specific failure

    Please recover deterministically before re-running the create issue transaction.

  2. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    area/security
    on Jul 11, 2026
  3. squne121 commented on Jul 11, 2026

    @squne121
    OwnerAuthor

    判定:REQUEST_CHANGES

    Issue #1454 は、#1450 の前回レビューで指摘された「candidate-controlled verifier」「可変 working tree の検査後に別物を実行する TOCTOU」「origin/main や replace ref 依存」をかなり正確に取り込んでいます。外部 manifest、trusted copy のみの実行、fail-closed installer、Git 環境の除去という方向性は妥当です。

    ただし、現在の契約で証明できるのは主に**「外部コピーが改変されていないこと」**です。必要なのはそれより強い、次の end-to-end property です。

    管理下の hook が必ず起動し、実際に push される commit を検査し、検査済みの同一 OID を、検査済みの remote/ref に対して、trusted executable が競合安全に publish する。

    現状はこの連鎖が三か所で切れています。


    P1 Blocker 1:launcher の登録元が依然として candidate-controlled

    #1454 は external launcher を作りますが、実際の hook switch は #1450 に委譲し、hooks.managed_dir は明示的に Out of Scope です。現在の .codex/hooks.json は repository 内の composite を直接起動しており、制御面そのものが candidate 側にあります。

    Codex の公式仕様では、project-local hook は定義が変更されると再信頼されるまでスキップされ、ユーザーから無効化もできます。一方、system・MDM・requirements.toml 由来の managed hook は policy-trusted で無効化できません。したがって、repository 内の .codex/hooks.json を絶対パス launcher に変更するだけでは trust root になりません。([OpenAI Developers]1)

    必要な修正

    • Phase A の範囲に system-managed hook registration を追加する。
    • Unix/WSL では /etc/codex/requirements.toml に managed PreToolUse hook を登録する。
    • [features].hooks = true を管理設定で固定する。
    • hooks.managed_dir から root/admin-owned launcher を起動する。
    • allow_managed_hooks_only = true は既存 hook を全停止するため、移行完了までは必須ではない。ただし、security-critical な判定は managed hook 一つで完結させる。

    requirements.toml はユーザーが上書きできない admin-enforced 設定であり、Unix の system location は /etc/codex/requirements.toml です。([ChatGPT学習サイト]2)

    追加すべき negative test:

    • .codex/hooks.json を削除・空化・別 command に変更しても managed launcher が deny する。
    • project-local hook が未信頼状態でも managed launcher が作動する。
    • user config で [features].hooks = false を指定しても managed requirement が勝つ。

    P1 Blocker 2:「owner-only」は agent-nonwritable を意味しない

    Issue は「任意の external absolute directory」「owner-only permission」を要件にしていますが、installer owner と agent runtime が同一 UID なら、そのプロセスは自分が所有するファイルの mode を変更できます。Linux では effective UID が owner と一致すれば chmod が許可されます。([man7.org]3)

    また、ファイル自身が root-owned でも、親ディレクトリが agent-writable なら directory entry を unlink・rename して別 inode に置き換えられます。削除・rename の権限は対象ファイルではなく、主に包含ディレクトリの write permission で決まります。([man7.org]4)

    必要な修正

    agent-nonwritable を曖昧な形容ではなく、機械判定可能な invariant にしてください。

    trust_root_filesystem_contract:
      installer_euid: 0
      runtime_euid_must_differ_from_owner: true
      owner_uid: 0
      owner_gid: 0
      regular_file_mode_max: "0555"
      directory_mode_max: "0755"
      runtime_uid_write_on_any_ancestor: forbidden
      group_or_other_write_on_any_ancestor: forbidden
      symlink_in_path_components: forbidden
      writable_mount_or_overlay_substitution: forbidden

    少なくとも /opt/loop-protocol/trust-root のような root-owned anchor を既定値とし、「任意 directory」は削除すべきです。WSL 上で agent と operator が同じ Linux user の場合、chmod 700 や chmod 600 は保護ではありません。

    追加すべき test:

    • runtime UID と owner UID が同じ場合 installer が拒否する。
    • root-owned file を user-writable parent 下に置いた構成を拒否する。
    • ancestor の一つだけが group-writable の場合も拒否する。
    • CI 内の mode-bit mock だけで完了扱いせず、privileged smoke を別 artifact として要求する。

    P1 Blocker 3:working tree の digest は、push される commit の証明にならない

    現在の設計は candidate path を lstat し、raw bytes の SHA-256 を manifest と比較します。しかし publish lane が送る対象は working tree ではなく HEAD です。既存契約も rtk git push origin HEAD:refs/heads/<active-branch> を許可対象としています。

    したがって、次の攻撃が成立します。

    1. 悪意ある policy/adapter を commit する。
    2. working tree 上だけ approved bytes に戻す。
    3. launcher の path digest 検査を通す。
    4. 悪意ある tree を持つ HEAD を publish する。

    これは AC3 の「candidate file tamper」試験では検出できません。

    必要な修正

    • candidate working-tree path を authorization の正本にしない。
    • push 対象として確定した local_oid の tree/blob を検査する。
    • <local_oid>:<component-path> の blob bytes を trusted Git invocation で読み、その SHA-256 を manifest と比較する。
    • critical path に uncommitted change があれば、原則 candidate_tree_ambiguous で deny。
    • manifest の component digest も trusted_commit_oid の tree から installer が生成し、任意の手元ファイルから生成できないようにする。

    必須 negative test:

    HEAD: malicious policy
    working tree: approved policy
    expected: candidate_commit_component_mismatch
    

    P1 Blocker 4:検査後に実行される rtk・HEAD・remote state が固定されていない

    現在の adapter は policy が allow を返すと null を返し、元の Bash command をそのまま通します。

    つまり trusted policy が認可するのは文字列としての

    rtk git push origin HEAD:refs/heads/<branch>

    ですが、その後に shell が解決する rtk は PATH、shell function、alias、login-shell 環境などの影響を受けます。AC9 は fake python3・git・node を対象にしていますが、実際の先頭 executable である fake rtk を閉じていません。

    さらに検査後、実コマンドの開始前に別 process が HEAD を移動できます。

    必要な修正

    allow 時に元 command を通すのではなく、managed launcher が updatedInput.command を返し、次のような trusted publisher に置換してください。Codex の PreToolUse は Bash command の書換えを公式にサポートしています。([OpenAI Developers]1)

    /opt/loop-protocol/trust-root/publish \
      --local-oid <40-hex> \
      --expected-remote-oid <40-hex-or-absent> \
      --remote origin \
      --target refs/heads/<validated-branch>
    

    publisher 自身が絶対パスの Git を argv 配列で起動し、少なくとも次を固定します。

    /usr/bin/git push \
      --force-with-lease=refs/heads/<branch>:<expected-remote-oid> \
      origin \
      <local-oid>:refs/heads/<branch>

    Git は <src> に明示的 object expression を指定できます。また、expected value を明記した --force-with-lease=<ref>:<expect> は remote ref がその値でなければ失敗し、empty expect は ref 不在を要求します。([Git]5)

    policy 側で fast-forward/allowed-paths/head binding を確認したうえで、publisher が同一 OID と lease を使う形にすれば、次を同時に閉じられます。

    • fake rtk
    • PATH substitution
    • HEAD movement
    • remote head race
    • check と execution の分離

    P1 Blocker 5:transitive TCB が manifest の component 集合を超えている

    Issue は composite、adapter、policy、analyzer を主要 component としています。しかし現在の adapter は module load 時点で、少なくとも次の三ファイルを静的 import しています。

    • write-codex-session-manifest.mjs
    • codex-metadata-scan.mjs
    • codex-postrun-verifier.mjs

    さらに candidate policy/analyzer を path 解決し、PATH 上の python3 を起動しています。

    外部に adapter だけコピーすると import が失敗し、依存を全部コピーすれば TCB が暗黙に拡大します。現状の authorization_runtime_untrusted reason code だけでは component closure を証明できません。

    推奨変更

    security-critical path を session-recording adapter から分離してください。

    • managed PreToolUse 専用の self-contained Python launcher。
    • Node/pnpm/composite/session-manifest producer を authorization TCB から排除。
    • 可能なら stdlib-only single file。
    • Python は固定 absolute path かつ isolated mode で実行。
    • Python -I は user site、script directory、全 PYTHON* 環境変数を import path から排除します。([Python documentation]6)

    Node を残す場合は少なくとも NODE_OPTIONS、NODE_PATH、global module search を閉じる必要があります。NODE_OPTIONS は --require を注入でき、NODE_PATH は module search path を前置できます。([Node.js]7)


    P1 Blocker 6:sanitized environment と現在の evidence protocol が矛盾している

    現在の policy は authorization input の大部分を環境変数から読みます。

    • LOOP_PUBLISH_EXPECTED_REMOTE_HEAD
    • LOOP_PUBLISH_CURRENT_REMOTE_HEAD
    • LOOP_PUBLISH_DECLARED_PUBLISH_HEAD
    • LOOP_PUBLISH_VERIFIED_HEAD
    • LOOP_PUBLISH_ALLOWED_PATHS_GATE_*

    さらに canonical repository pattern と default branch まで environment override が可能です。

    したがって「environment を sanitize する」だけでは不十分です。

    • 全消去すると必要な evidence が失われる。
    • LOOP_* を継承すると self-asserted evidence が残る。
    • test override と production override が区別されていない。

    Git 自体も GIT_CONFIG_COUNT、GIT_DIR、GIT_OBJECT_DIRECTORY、GIT_ALTERNATE_OBJECT_DIRECTORIES、GIT_SSH_COMMAND、config file location など多数の環境入力で動作が変わります。([Git]8)

    必要な修正

    • blacklist ではなく env -i 相当の allowlist 構築。
    • publish evidence は inherited env ではなく、trusted verifier が生成した versioned JSON/FD で渡す。
    • evidence に session_id、turn_id、tool_use_id、local_oid、remote_oid、issue_number、nonce/expiry を bind。
    • LOOP_CANONICAL_REPO_URL_PATTERN、LOOP_DEFAULT_BRANCH は production では無効化し、test-only dependency injection に移す。
    • Git subprocess には固定 PATH、専用 HOME、GIT_CONFIG_GLOBAL=/dev/null、GIT_CONFIG_SYSTEM=/dev/null、GIT_CONFIG_NOSYSTEM=1 等を明示。
    • credential transport は別の明示契約にする。暗黙の $HOME/.gitconfig や GIT_SSH_COMMAND 継承に依存しない。

    P2 High findings

    7. Manifest は trusted_commit_oid と component digest の関係を証明していない

    現行 schema では、operator が無関係な commit OID と任意 bytes の digest を同じ manifest に書けます。issued_by も単なる文字列で、認証情報ではありません。

    必要なのは schema validation ではなく provenance contract です。

    • installer が exact trusted_commit_oid の blobs から components を抽出する。
    • component path の必須集合は launcher 側に hard-code する。
    • issued_by は audit metadata と明記し、authenticity の根拠にしない。
    • generation または monotonic release epoch を追加し、意図しない rollback を拒否する。
    • manifest digest を install receipt に記録する。

    8. Rotation は file-by-file atomic ではなく release 単位で atomic にする

    manifest、launcher、trusted components を個別に置換すると、crash 時に世代が混在します。rename() は同一 filesystem 上の既存 pathname を atomic に置換できるため、staging release を完全検証してから active descriptor を一回だけ rename する構成が適切です。([man7.org]9)

    推奨 layout:

    /opt/loop-protocol/trust-root/
      dispatcher.py
      active.json
      releases/
        000001-<manifest-digest>/
          manifest.json
          authorization.py
    
    • dispatcher.py は小さく固定。
    • release directory は immutable。
    • active.json.tmp を fsync 後に rename。
    • activation 失敗時は旧 active.json を維持。
    • rollback は明示的な privileged operation とし、generation downgrade を通常拒否。

    9. path check は全 component と ancestor を対象にする

    最終 path の lstat だけでは、途中の symlink や path-resolution race を閉じられません。Linux では openat2() の RESOLVE_NO_SYMLINKS で全 path component の symlink 解決を拒否でき、RESOLVE_BENEATH で trusted root 外への escape を防げます。([man7.org]10)

    Python から直接 openat2 を使わない場合も、

    • trusted root の directory FD を開く
    • component ごとに openat(..., O_NOFOLLOW)
    • fstat した同じ FD の bytes を hash・executeする

    という descriptor-based contract が必要です。

    10. Hook 間の順序依存を明示的に禁止する

    Codex は同一 event の matching command hooks を並行起動し、一つの hook が他の起動を止めることはできません。リポジトリ自身の SSOT も実行順序・short-circuit・handler 間依存がないと記載しています。([OpenAI Developers]1)

    したがって trusted launcher は、次を他 hook に委譲してはいけません。

    • destination guard
    • Allowed Paths
    • default branch block
    • secret-safe output
    • canonical origin verification
    • evidence completeness

    security-critical な判断は managed launcher/publisher 内で完結させる必要があります。

    11. 「security boundary」の表現を修正する

    Codex 公式仕様は PreToolUse を完全な enforcement boundary ではなく guardrail と明記しており、shell interception も完全ではありません。リポジトリの hook-boundaries.md と .codex/config.toml も同じ制限を明示しています。([OpenAI Developers]1)

    Issue の Outcome は次のように限定すべきです。

    managed PreToolUse が捕捉した exact publish lane に対する local authorization TCB。

    リポジトリ全体の remote-write security boundary と表現してはいけません。最終防御は引き続き GitHub permissions、branch protection、server-side rules に置く必要があります。


    推奨する修正版アーキテクチャ

    /etc/codex/requirements.toml
      └─ managed PreToolUse
           └─ /usr/bin/python3 -I /opt/.../dispatcher.py
                ├─ root-owned active release を descriptor-based open
                ├─ hook input を構造解析
                ├─ exact local_oid の blobs を manifest と照合
                ├─ live remote head / allowed paths / destination を検証
                └─ updatedInput で absolute trusted publisher に置換
                      └─ /usr/bin/git
                           --force-with-lease=<ref>:<expected>
                           <local_oid>:<exact-destination>
    

    この形なら trust chain は次の一方向になります。

    admin-managed registration
    → protected dispatcher
    → immutable release
    → exact candidate commit blobs
    → trusted publisher argv
    → server-side compare-and-swap
    → post-push live readback
    

    Issue #1454 に追加すべき最低限の AC

    1. Managed registration
      repo-local hook の削除・変更・未信頼化・local feature disable 後も、system-managed launcher が作動する。

    2. Different-owner boundary
      installer owner と runtime EUID が同一なら installation を拒否する。全 ancestor が runtime-nonwritable。

    3. Exact commit binding
      working tree ではなく、publish 対象 local_oid の component blobs が manifest digest と一致する。

    4. Committed-malicious/working-tree-clean test
      悪意ある HEAD+approved working tree を必ず deny する。

    5. Trusted execution rewrite
      allow 時に元の rtk git push ... を通さず、absolute trusted publisher に updatedInput で置換する。

    6. Exact source OID and lease
      publisher は HEAD ではなく local_oid を refspec source にし、remote expected OID を lease に使う。

    7. Executable substitution resistance
      fake rtk、fake Git、PATH、shell function、alias、BASH_ENV、NODE_OPTIONS、PYTHONPATH を注入しても trusted executable のみが使われる。

    8. Evidence provenance
      inherited LOOP_* だけでは allow されず、trusted evidence envelope と hook invocation ID の一致が必要。

    9. Transitive TCB closure
      実行時に load/exec される全コード・interpreter・external binary が manifest または system trust に列挙される。

    10. Atomic generation activation
      crash injection の全地点で旧世代か新世代のどちらかだけが見え、混成状態にならない。

    11. Concurrent hook independence
      他の repository-local hook を削除・遅延・失敗させても、managed launcher の判定が変わらない。

    12. Scope wording
      PreToolUse の interception limitation と server-side enforcement 依存を normative documentation に明記する。


    総括

    #1454 は前回の self-verifying hash pinning より大幅に改善されています。しかし、現契約では external launcher を作っても、

    • launcher を呼ばない
    • clean working tree を見せて malicious HEAD を送る
    • allow 後に fake rtk または別 HEAD を実行する

    という三経路が残ります。

    特に managed hook registration、exact commit blob binding、trusted publisher への command rewrite は #1454 自身の In Scope に戻すべきです。この三点を #1450 や後続 Issue に送ると、#1454 単体は「外部ファイル配布機構」にはなっても、publish lane の trust root にはなりません。

  4. squne121 commented on Jul 11, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-11T10:01:54Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1454
      body_sha256: "sha256:e25e5ba6d0954e39e2816c2bef291ec5e7d856167db66dd559d3e78480f3a9f7"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight:
          decision: pass
          classifications: [{"ac":"AC1","line":2,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k external_absolute_path_permission","command_hash":"sha256:a67bef447c64e624ee7000d6d89bca44709f26051119dd29fd40a14dbfa2bd09","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":145,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":1,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC2","line":4,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_manifest_schema.py -k manifest_atomic_binding","command_hash":"sha256:b0bf4ad64613ea4ce913d7606fa76d7e6bc8ce3349238b4af9834aca94dd5249","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_manifest_schema.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":159,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":3,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC3","line":6,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k tamper_component_denied","command_hash":"sha256:60ec7c935237ddda11d05d7ff45aac50d5827435edc33b02758e1e8a1a1f03a4","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":146,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":5,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC4","line":8,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k integrity_check_removed_still_denied","command_hash":"sha256:9c33ee18ce6dcb1da62bb7d77dde26248fad8d839d58eca3bd21c7918a04195e","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":130,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":7,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC5","line":10,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k trusted_copy_executed_not_candidate","command_hash":"sha256:fc1f0b4f4c28a84033bf3978e82d79a2388f2acccc2dfd2979f88ffc975c85e4","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":137,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":9,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC6","line":12,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k symlink_and_missing_denied","command_hash":"sha256:582264f90798f9f43f7115ab4c8a876652422e2647c9c1870f52e3212aa78c63","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":133,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":11,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC7","line":14,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k origin_main_rewrite_ignored","command_hash":"sha256:5f01aaa42e23bbc420c9a9d1a4e4cc4b0e3abc526c2fe7e20fdbf180d6b651e5","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":132,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":13,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC8","line":16,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k refs_replace_ignored","command_hash":"sha256:c08412d7b143358b5d1c2028493c11082bb6ba4ce0acd0005895f2178c0bcdf5","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":129,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":15,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC9","line":18,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k fake_path_binaries_ignored","command_hash":"sha256:43bbea9b9611d4ce181e0f41f601a4aaed64100bd888fae75a753dd288208fd0","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":131,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":17,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC10","line":20,"raw_command":"rg -n \"bootstrap_executor\" docs/dev/hook-boundaries.md","command_hash":"sha256:ff237b3bf8b26a195c36546070d33803c1e615851588c7304c685eaa32dda14b","runner":"exec","exit_code":1,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":2,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":19,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC11","line":22,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k trust_root_missing_denied","command_hash":"sha256:31059205c12fd5b7ff11032f6c7aa61df282a98433777c1f3cf559af62a91c18","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":135,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":21,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC12","line":24,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py","command_hash":"sha256:68a7dcf93c099c4ee65ead7ed893ffe3ace6475993a4f2fdd69b2fd1873138dc","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":133,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":23,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC13","line":26,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k managed_registration_survives_local_hook_removal","command_hash":"sha256:c4f99d27ae8a234ab25c8a997a1b88430a7bd10b9ff68336f5ac99c1a4d21674","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":127,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":25,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC14","line":28,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k committed_malicious_working_tree_clean_denied","command_hash":"sha256:70823e200c3992e6bc656c7c743f8200701dbdce7818594857fb06625eb6aae7","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":134,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":27,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC15","line":30,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k trusted_publisher_command_rewrite","command_hash":"sha256:85f8d2ded6c43194310aa7b3fc500be917a7e475c89a22df5dc196e64379d406","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":128,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":29,"raw":"# baseline-expect: fail"},"strict":null,"repair":null},{"ac":"AC16","line":32,"raw_command":"uv run --locked pytest scripts/trust-root/tests/test_trusted_hook_launcher.py -k installer_same_euid_rejected","command_hash":"sha256:0ff910c1fb06cd1ec12ea1472fe33c9da15e9c32eaf1ca19e4b2af87c17726d4","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["============================= test session starts ==============================","platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0","rootdir: /home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/agent-a36ffb7e0327e643b","configfile: pyproject.toml","plugins: xdist-3.8.0","collected 0 items","============================ no tests ran in 0.00s ============================="],"stdout_truncated":false,"stdout_original_line_count":9,"stderr_head":["ERROR: file or directory not found: scripts/trust-root/tests/test_trusted_hook_launcher.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":129,"fix_hint":null,"annotations":{"baseline_expect":"fail","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":31,"raw":"# baseline-expect: fail"},"strict":null,"repair":null}]
      source: ensure_contract_snapshot_auto
  5. squne121 commented on Jul 11, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: https://github.com/squne121/loop-protocol/issues/1454#issuecomment-4944662920
        generated_at: '2026-07-11T09:59:44Z'
        body_sha256: sha256:e25e5ba6d0954e39e2816c2bef291ec5e7d856167db66dd559d3e78480f3a9f7
      metadata:
        title_prefix_ready: true
        phase_label_ready: true
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: '2026-07-11T09:59:44Z'
      checked_body_sha256: sha256:e25e5ba6d0954e39e2816c2bef291ec5e7d856167db66dd559d3e78480f3a9f7
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  6. squne121 commented on Jul 11, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了

    • PR: feat: publish lane authorization の external trust root を確立する #1457
    • Worktree: .claude/worktrees/issue-1454-trust-root
    • Branch: worktree-issue-1454-trust-root
    • Verification: pytest 31/31 PASS(scripts/trust-root/tests/)、ruff PASS、typecheck/lint/lint:md/lint:prose PASS
    • 全 16 AC 相当のシナリオを実 subprocess 統合テストで検証済み(SKIP 不使用)
    • follow-up: .github/ci/python-test-plan.json への scripts/trust-root/tests/ 登録が必要(Allowed Paths 外のため本 PR では未変更。PR 本文 Notes に記載)
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
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/implementerarea/securityenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions