Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1408"
goal_ref: "PR #1442(Issue #1408の実装)への人間の敵対的セキュリティレビュー(https://github.com/squne121/loop-protocol/pull/1442#issuecomment-4941989903)で指摘されたP1 Blocker「authorization code自体が、認可対象の作業worktreeから読み込まれる(自己署名型authorization)」を解消する。Issue #1454(Phase A: external trust root)はPR #1457としてmerge済み(commit ce8e417b)。しかしIssue #1450自身への直近の敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1450#issuecomment-4945979261)により、旧AC(candidate側adapterがtrusted launcherへevidenceを委譲する設計、`.codex/hooks.json`の二重entrypoint化、publisher実行のGit config逃脱耐性欠如)では信頼境界が成立しないと判定され、本Issueは『managed hookを唯一のentrypointとし、candidate codeをevidence発行・publish実行から除外する』契約へ全面的に再スコープする。nonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationはIssue #1468へ切り出す"
change_kind: codeParent Issue
Parent Goal Ref
- Goal: Issue #1408のpublish lane approval bridgeが、検証済み証跡に基づいてrtk git pushを許可しつつ、危険・不一致なpushをdenyし続ける状態を確立する
- Desired Destination: PR #1442のmerge blockerとして指摘された「publishしようとしている差分自身が、そのpublishを許可するpolicyも同時に変更できる」という自己署名型authorizationの問題を、candidate codeを認可経路(evidence発行・publish実行)から完全に除外する形で解消する
- Dependency: 本Issueは以下 2 件のmergeを前提として着手する Phase B である。
- Issue 実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454(Phase A: external trust root。PR #1457としてMERGED、commit ce8e417)
- Issue 実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468(trust-root hardening follow-up: nonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestation)
- 上記のうちIssue #1468が未mergeの間、および対象環境でdeployment attestation(実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468 AC5)が生成されていない間は、本Issueの実装(
.codex/hooks.jsonの切替やcandidate側integration実装)に着手しない
Current Validated Scope
- Issue 実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454(Phase A)はPR #1457としてmerge済みで、
scripts/trust-root/配下にtrusted_hook_launcher.py・manifest_schema.py・install_trust_root.shが存在する - Codex PreToolUse hookはproject-local
.codex/hooks.jsonとsystem-managed hookの両方を実行しうる構成であり、単純に.codex/hooks.jsonをtrusted launcherへ向けるだけでは、managed launcherとproject-local launcherの二重起動(同一evidence/nonceへの競合)が発生することが敵対的レビューで指摘された - session-recording compositeは同じcheckout内のscripts/session-recording/codex-hook-adapter.mjsを直接importし、codex-hook-adapter.mjsはscripts/agent-guards/git_mutation_command_policy.pyを実行する構成であり、この2ファイルはcandidate側で改変可能である
- Issue #1450への直近の敵対的レビュー(OWNER, https://github.com/squne121/loop-protocol/issues/1450#issuecomment-4945979261)により、旧設計(candidate adapterがcommand payload・component実体をtrusted launcherへ「委譲」し、launcherがそれをtrusted evidenceとして扱う)は、candidate側が攻撃者管理下という前提と矛盾し信頼モデルとして成立しないと判定された
- 同レビューにより、publish実行コマンド文字列(
updatedInput)が通常shell環境で実行される限り、remote.origin.pushurl/url.*.pushInsteadOf/core.hooksPathによるGit config経由の迂回が可能であることも指摘された。この修正(trusted publisher wrapperの実装)はIssue #1468へ切り出した - nonce runtime stateの権限モデル不整合、installerのrelease rotation非atomic性、launcherのcwd/git-dir解決がnested/linked worktreeに対応していない点も同レビューで指摘され、Issue #1468の対象とした
Remaining Parent Gaps
- Codex hooks.managed_dirへの実移行(admin-enforced領域へのhook配置)は本Issueでも扱わない。将来のfollow-upとする
- privileged operatorによる実機へのtrust root install実行・deployment attestationの生成はIssue #1468の範囲であり、本Issueでは扱わない(本Issueは#1468のmerge済み成果物とdeployment attestationが存在する前提で着手する)
- PR #1442のレビューで指摘された他のP1 Blocker(fetch_then_show_refとgithub_branch_apiの証跡真正性、新規branch初回publishのatomic create lane)は本Issueでは扱わない
- privileged broker(trusted evidence issuer)自体の新規実装が必要と判明した場合は、本Issューの対象に含めず別途follow-up Issueを起票する
- P2/P3指摘(originのpush先repository検証、main/master/trunk destination guard、実bare remoteを使うintegration test拡充)は本Issueの対象外で、必要なら別途follow-up Issueを起票する
Outcome
Issue #1454(Phase A、merge済み)およびIssue #1468(trust-root hardening、merge・deployment attestation生成済み)で確立されたexternal trust rootに対し、system-managed PreToolUse hook一つだけがpublish認可を担当する状態になっている。candidate repository内のscripts/session-recording/codex-hook-adapter.mjs・scripts/agent-guards/git_mutation_command_policy.py・.codex/hooks.jsonは、allow決定・evidence発行・publisher実行のいずれにも関与しない。trusted launcherは、candidate側から受け取ったevidenceではなく、launcher自身が保持するtrusted copyのpolicy/analyzerを実行して認可判定を行い、Allowed Paths契約・issue番号・base/head SHA・verified_head・tool-use bindingへ紐付いた one-shot grant(PUBLISH_AUTHORIZATION_GRANT_V1)を発行する。全component一致時は既存publish laneのpositive/negative regressionがtrusted launcher(および#1468のtrusted publisher wrapper)経由で動作し、未mergeのpolicy/adapter変更を使ったbootstrap publishはfail-closedでdenyされる。対応する実subprocess integration testが追加されPASSしている状態。
In Scope
.codex/hooks.jsonから、candidate worktree内のcomposite/adapterによるpublish allow経路を削除する(project-local hookはrecording/advisory用途に限定し、publish allowを返さない設定へ変更する)- system-managed hookとして登録されたtrusted launcherが、同一Bash invocationに対し一度だけ起動されることを保証する(project-local側との二重起動を排除する)
scripts/session-recording/codex-hook-adapter.mjsとscripts/agent-guards/git_mutation_command_policy.pyを、authorization判定・evidence発行のいずれも行わないtelemetry/advisory専用のintegration点として再構成する- trusted launcher(
scripts/trust-root/)が、candidateから受け取ったevidenceに依存せず、launcher自身が保持するtrusted copyのpolicy/analyzerロジックを実行して認可判定を行うよう変更する - trusted launcherが発行するgrantを、Allowed Paths gate status・対象issue番号・base/head SHA・verified_head・declared_publish_head・tool_use binding(session_id/turn_id/tool_use_id/command_sha256)へ紐付け、改変・再利用・expiry超過・別tool callへの転用をdenyする
- publish実行を、Issue #1468で実装されたtrusted publisher wrapperへ委譲するよう変更する
- 全component一致時、既存publish laneのpositive/negative regressionが、trusted launcher(および#1468のtrusted publisher wrapper)経由の実行経路で動作することを実subprocess integration testで検証する
- 未mergeのpolicy/adapter変更を使った「同じPR自身のbootstrap publish」が、trusted launcher経由でdenyされることを検証するテストを追加する
- docsに「publish lane trust boundary」という語句で、Phase A(実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454)・trust-root hardening(実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468)・Phase B(本Issue)の関係、および単一managed entrypoint設計を明記する
Out of Scope
- candidate repository外のtrusted hook launcher・trust manifest schemaそのものの新規実装(Issue 実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454 Phase Aの対象)
- nonce runtime state分離、trusted publisher wrapperのGit config隔離実装、release rotationのatomic化、cwd/git-dir解決のnested/linked worktree対応、deployment attestation生成(いずれもIssue #1468の対象)
- privileged broker(trusted evidence issuer)自体の新規実装(必要性が判明した場合は別途Issueを起票する)
- Codex hooks.managed_dirへの実移行(admin-enforced領域へのhook配置)
- fetch_then_show_ref、github_branch_apiの証跡真正性改善(別Issue)
- 新規branch初回publish用のatomic create lane(別Issue、実装: publish laneに新規branch初回publish用のatomicなbranch作成laneを追加する #1449。#1449は本Issueに
blocked_byとして依存する) - originのpush先repository検証、main/master/trunk destination guard
- Codex runtime本体のapproval policy変更
Runtime Verification Applicability
decision: immediate
applicable_acs:
- AC1
- AC2
- AC3
- AC4
- AC5
- AC6
execution_environment:
cli_tools:
- python3
- uv
- node
- git
auth_required: false
network_required: false
skip_conditions:
- "Issue #1468(trust-root hardening follow-up)がmainへmergeされていない場合はSKIPではなくenvironment blockedとして扱う"
- "対象環境でdeployment attestation(#1468 AC5)が生成されていない場合はSKIPではなくenvironment blockedとして扱う"
fallback_policy:
fallback_success_is_pass: false
notes: "fallback経由の成功をPASSに変換しない。trusted launcherおよびtrusted publisherを経由しないfixtureのみの検証はAC4/AC5/AC6のPASS判定に使わない"
artifact_requirements:
- "temporary candidate worktree + temporary external trusted directoryを用いたpytest実subprocess integration testのoutput"
- ".codex/hooks.jsonの切替設定を反映したテスト実行ログ"本Issueの検証は、project-local hookを削除・改変してもmanaged hookのdeny判定が変わらないこと、candidate側component改変時にtrusted launcher経由でもfail-closedでdenyされること、既存publish laneのregressionがtrusted launcher・trusted publisher経由の実プロセス実行で動作することを含む。関数へfixtureを渡すunit testだけでは「候補側の改変がtrusted launcher経由の実行経路で実際にdenyされる」ことを証明できないため、temporary candidate worktree + Issue #1454/#1468で確立されたtrusted launcher・trusted publisher実体(テスト用configurationでinstallしたもの)+ 実subprocess実行を用いた統合テストで検証する。
Acceptance Criteria
- AC1: project-local
.codex/hooks.jsonを削除・改変しても、managed hookによるpublish authorizationのdeny判定が変わらないことをテストで確認できる - AC2: 同一Bash invocationに対し、security-critical launcherの起動回数が1回であり、project-local launcherとの二重起動が発生しないことをテストで確認できる
- AC3: candidate側の
scripts/session-recording/codex-hook-adapter.mjsとscripts/agent-guards/git_mutation_command_policy.pyを削除・改変しても、trusted launcher側のtrusted copyによる判定結果が変わらず、allowにならないことをテストで確認できる - AC4: trusted launcherが発行するgrant(
PUBLISH_AUTHORIZATION_GRANT_V1)が、Allowed Paths gate status・issue番号・base/head SHA・verified_head・tool_use bindingに紐付いており、改変・再利用・expiry超過・別tool callへの転用がdenyされることをテストで確認できる - AC5: 全component一致時、既存publish laneのpositive/negative regressionが、trusted launcherおよびIssue #1468のtrusted publisher wrapper経由の実行経路で実subprocess integration testとしてPASSすることを確認できる
- AC6: 未mergeのpolicy/adapter変更を使ったbootstrap publish(policy/adapter自身の未merge変更を使った自己publish)が、trusted launcher経由でdenyされることをテストで確認できる
- AC7: docsに「publish lane trust boundary」という語句で、Phase A(実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454)・trust-root hardening(実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468)・Phase B(本Issue)の関係および単一managed entrypoint設計が明記されている
Verification Commands
# baseline-expect: fail
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py -k local_hooks_json_removal_does_not_change_managed_deny # AC1
# baseline-expect: fail
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py -k single_launcher_invocation_per_bash_call # AC2
# baseline-expect: fail
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py -k candidate_adapter_deletion_does_not_flip_to_allow # AC3
# baseline-expect: fail
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py -k grant_bound_to_allowed_paths_issue_base_head_tool_use # AC4
# baseline-expect: fail
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py -k publish_lane_regression_via_trusted_launcher_and_publisher # AC5
# baseline-expect: fail
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py -k bootstrap_publish_denied_via_trusted_launcher # AC6
# baseline-expect: fail
$ rg -n "publish lane trust boundary" docs/dev/session-recording-policy.md docs/dev/hook-boundaries.md docs/dev/agent-runtime-ops.md # AC7Allowed Paths
- .codex/hooks.json
- scripts/agent-guards/git_mutation_command_policy.py
- scripts/agent-guards/tests/test_git_mutation_command_policy.py
- scripts/agent-guards/tests/test_publish_lane_trust_root_integration.py
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
- scripts/trust-root/trusted_hook_launcher.py
- scripts/trust-root/tests/test_trust_root_hardening.py
- docs/dev/session-recording-policy.md
- docs/dev/hook-boundaries.md
- docs/dev/agent-runtime-ops.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- Codex hooks.managed_dirへの実移行が必要と判明した場合
- privileged broker(trusted evidence issuer)の新規実装が必要と判明した場合
- Issue #1454またはIssue #1468が未mergeの状態で本Issueの実装に着手する必要が生じた場合(両方のmerge完了を待つ)
- 対象環境でdeployment attestation(実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468 AC5)が生成されていない状態で本Issueの実装に着手する必要が生じた場合
- Issue 実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454/#1468側のtrust root設計(manifest schema、launcher絶対パス方針、digest契約)に変更が必要と判明した場合
Required Skills
- Python / pytest
- JavaScript / Node.js hook adapter
- Git、SHA検証、trust boundary設計
Required Design References
- docs/dev/session-recording-policy.md
- docs/dev/hook-boundaries.md
- docs/dev/agent-runtime-ops.md
- Issue #1408の本文とPR #1442の敵対的レビューコメント(https://github.com/squne121/loop-protocol/pull/1442#issuecomment-4941989903)
- Issue #1450への敵対的レビューコメント(実装: publish laneのauthorization code(policy/adapter)の信頼境界をhash pinningでcandidate worktree外に確立する #1450 (comment) 、https://github.com/squne121/loop-protocol/issues/1450#issuecomment-4945979261)
- Issue 実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454(Phase A: external trust root、PR feat: publish lane authorization の external trust root を確立する #1457 MERGED)
- Issue 実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468(trust-root hardening follow-up)
Delivery Rule
- 1 Issue = 1 PR
- Dedicated worktreeを作成して実装する
- Draft PR既定
- 本Issueの着手はIssue 実装: publish lane authorization codeの信頼起点となるexternal trust root(trusted hook launcher・manifest・bootstrap/rotation手順)を確立する #1454(merge済み)およびIssue 実装: publish lane trust root(#1454 Phase A)にnonce runtime state分離・trusted publisher wrapper・atomic rotation・worktree cwd解決・deployment attestationを追加する #1468(trust-root hardening follow-up)のmerge後とする
- scripts/trust-root/**を同時に変更するIssue #1468と並行実装しない。先にマージされた側のmain反映後に、もう一方がrebaseしてから着手する
- scripts/agent-guards/git_mutation_command_policy.pyを同時に変更する他follow-up Issue(実装: publish laneに新規branch初回publish用のatomicなbranch作成laneを追加する #1449: 新規branch初回publish用のatomic create lane)と並行実装しない。先にマージされた側のmain反映後に、もう一方がrebaseしてから着手する
Scope Delta(任意)
scope_delta:
source: "https://github.com/squne121/loop-protocol/issues/1450#issuecomment-4945979261"
author_association: OWNER
summary: "OWNERによる敵対的レビューで、旧設計(candidate側evidence委譲・.codex/hooks.json二重entrypoint・publisher実行のGit config逃脱耐性欠如)が信頼モデルとして成立しないと判定された。nonce runtime state分離・trusted publisher wrapper・atomic rotation・cwd解決・deployment attestationをIssue #1468へ切り出し、本Issueは単一managed entrypoint + trusted-copy判定 + grant bindingへ全面的に再スコープした"
allowed_paths_change: replace
new_dependency: "#1468"
Activity
squne121 commentedon Jul 11, 2026
相互参照: Issue #1449(新規branch初回publishのatomic create lane実装)が、本Issue(#1450)に
blocked_byとして依存します(OWNER裁定 https://github.com/squne121/loop-protocol/issues/1449#issuecomment-4942998354)。#1449 の実装開始条件は以下の通りで、本Issue #1450 のスコープ・Allowed Paths・Acceptance Criteriaを変更するものではありません。
本コメントは情報共有のみを目的とし、#1450 本文のスコープ変更は行いません。
squne121 commentedon Jul 11, 2026
以下が敵対的レビュー結果です。GitHubへのコメント投稿や Issue 更新は行っていません。
Issue #1450 敵対的レビュー
判定
REQUEST_CHANGES — 現在の契約では、ACをすべて満たしても「candidate worktree 外の信頼境界」は成立しません。
Issue は、PR #1442 の authorization code が自分自身の publish を許可できる「自己署名型 authorization」を正しく問題化しています。また、未マージの policy 変更では同じ PR を bootstrap publish できず、別の privileged executor が必要になる点も認識しています。
しかし、現在の In Scope と Allowed Paths では、hash を検証する処理も candidate worktree 内の adapter または policy に置くしかありません。改変対象自身に「自分が改変されていないこと」を判定させても、信頼の起点にはなりません。
P1 Blocker 1: hash verifier 自体が candidate-controlled になる
現在の実行経路は次です。
.codex/hooks.jsonは現在の checkout 配下の composite を実行し、composite は同じ checkout の adapter を直接 importします。adapter もrepoRoot配下の policy を実行します。したがって、次のような実装は防御になりません。
agent はこの
if自体を削除できます。同様に adapter 側で検証しても、adapter 自身を no-op にできます。必須修正
hash verification を行う entrypoint は、candidate repository の外に置かなければなりません。
推奨構成は、管理者所有ディレクトリの managed hook が直接 payload を受け取り、外部 manifest と candidate の digest を照合する方式です。Codex の
hooks.managed_dirは、管理者が強制する lifecycle hook 用で、macOS/Linuxでは存在する絶対パスを指定する契約です。([OpenAI開発者]1)hooks.managed_dir移行を Out of Scope に維持するなら、少なくとも以下の小さな外部コンポーネントは In Scope に戻す必要があります。外部 verifier または managed entrypoint を追加しない限り、Issue の Outcome は技術的に達成不能です。
P1 Blocker 2: pinning 対象が実際の TCB を網羅していない
Issue が照合対象としているのは、主に次の2ファイルです。
しかし、実際の authorization path には少なくとも以下も含まれます。
特に adapter は、最初に candidate worktree の
shell_command_analysis.pyを呼び、そこで push が検出された場合にだけ policy を実行します。analyzer が「push なし」を返せば、policy は呼ばれません。具体的には、agent が analyzer を次のように改変できます。
{ "schema": "SHELL_COMMAND_ANALYSIS_V1", "status": "ok", "commands": [], "reason_code": "parsed" }adapter/policy の hash が正しくても、remote write 判定そのものを迂回できます。
composite を空実装にするだけでも adapter まで到達しません。
必須修正
次のどちらかが必要です。
前者を推奨します。個別ファイルを後追いで pinning すると、依存ファイルが増えるたびに新しい迂回路が発生します。
P1 Blocker 3:
origin/mainは trusted reference ではないIssue は trusted 参照の例として、環境変数の hash と
git show origin/main:<path>を同列に扱っています。しかし、
origin/mainは candidate repository 内の可変な remote-tracking refです。ローカル ref、object database、Git 設定、環境変数を candidate 側で操作できるなら、これは外部の信頼点ではありません。Git は replacement ref を多くのコマンドで既定利用し、
--no-replace-objectsまたはGIT_NO_REPLACE_OBJECTSで無効化する必要があります。([Git]2) また、GIT_DIR、GIT_COMMON_DIR、GIT_OBJECT_DIRECTORY、GIT_ALTERNATE_OBJECT_DIRECTORIESは参照する repository や object store を変更できます。([Git]3)GIT_CONFIG_COUNT等も runtime の設定値を注入できます。(Git)必須修正
trusted source は一つに固定してください。推奨は次です。
この manifest は repository 外に置き、agent が書き込めない ownership/mode にします。
Git object を参照する方式を採用する場合でも、少なくとも以下が必要です。
git rev-parse --verify <oid>^{commit} --end-of-optionsにより、full OIDが commit として解決できることを検査できます。(Git)P1 Blocker 4: check-then-execute の TOCTOU が未考慮
仮に外部 verifier が candidate ファイルを hash 化しても、その後 candidate path を実行すると次の競合が残ります。
symlink の付け替えや rename でも同様です。
必須修正
照合後に candidate の実体を実行してはいけません。
安全な流れは次です。
candidate file の一致は「承認済み policy version と repository 宣言が一致していること」の確認に使用し、authorization decision は trusted copy が行うべきです。
P1 Blocker 5: Runtime Verification を
not_applicableにできないIssue は pytest の unit test と docs grep だけで検証可能として、runtime verification を対象外にしています。
しかし今回扱うのは、以下を含む runtime trust boundary です。
関数へ fixture を渡す unit testだけでは、「candidate verifierを消してもdenyされる」ことを証明できません。
必須修正
最低限、実 entrypoint から次の改変試験を行う必要があります。
P1 Blocker 6: Allowed Paths が安全な実装を禁止している
現在の Allowed Paths は repository 内の policy、adapter、tests、docs に限定されています。
外部 launcher、managed hook 設定、installer、trust manifest のいずれも変更対象にありません。そのため、実装者は必然的に candidate-controlled ファイルの中へ verifier を置くことになります。
必須修正
Issue を少なくとも次の2段階に分けるべきです。
repository PR だけで外部配置まで自動化できない場合、repository側では installer/template を配布し、OWNER が privileged step を実行する契約にしてください。
P2 High: bootstrap と manifest rotation の手順が未定義
#1450 は、未mergeの policy/adapter を使った自己publishを禁止します。一方、その policy/adapter の実装元である PR #1442 はまだ candidate branch 上にあります。
さらに #1449 は #1450 を明示的な
blocked_byとし、#1450 の trust boundary 上で atomic create lane を実装する前提です。この状態では、以下の順序を明文化しないと運用が停止します。
必要な契約は以下です。
bootstrap executor を Out of Scope にすること自体は可能ですが、その手順と責任主体まで未定義にしてはいけません。
P2 High: digest 契約が曖昧
「内容またはSHA256を比較する」だけでは実装間で意味がずれます。
最低限、次を固定してください。
failure reason も区別すべきです。
すべて generic allow ではなく、
remote_write_requires_approval相当へ fail-closed させます。修正版 Outcome
修正版 Acceptance Criteria
authorization_component_digest_mismatchでdenyする。origin/mainや candidate repository内のremote-tracking refを単独のtrusted sourceとして受理しない。python3/git/nodeがauthorization runtimeへ影響しない。最小 merge 条件
origin/mainを trusted source の例から削除するか、外部read-only object storeとfull OID方式へ限定する。immediateに変更する。最終判断
#1450 は問題設定自体は正しいものの、現在の設計は hash pinning の対象を定義しているだけで、hash pinning を信用できる主体を定義していません。
このまま実装すると、テスト上は
authorization_code_integrity_mismatchを返せても、攻撃者はその検査へ到達する前の composite、adapter、analyzer、または verifier 自体を変更できます。したがって、現契約のままの実装・mergeは推奨しません。#1449 が依存するセキュリティ境界として使用するには、external trust root を先に契約へ組み込む必要があります。
中心的な修正点は、「candidate codeをhashする」から「candidate外のtrusted launcherがhashし、trusted codeだけを実行する」へ変更することです。
squne121 commentedon Jul 11, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jul 11, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
feat: publish lane authorization の external trust root を確立する (#1457)
squne121 commentedon Jul 11, 2026
GitHubへのコメント投稿・Issue更新は行っていません。現行Issueと、マージ済みのPhase A実装を前提に再評価しました。
Issue #1450 敵対的レビュー
判定:REQUEST_CHANGES — 現契約のまま実装着手不可
#1450 は、前回指摘した「candidate-controlled verifierでは信頼境界にならない」という問題を受け、#1454をPhase A、#1450をPhase Bへ分離した点は妥当です。#1454/PR #1457では、外部trust root、manifest、
local_oidのblob照合、managed hook、updatedInputによるコマンド置換まで実装されました。しかし、マージされたPhase A実装を読むと、#1450には以下の問題が残っています。
現在のAC1〜AC4がすべてPASSしても、end-to-endの認可特性は証明できません。
P0 Blocker 1:trusted evidenceのproducer・配送経路が未定義
trusted_hook_launcher.pyは、managed hookのstdinとは別に、--evidence-fileでPUBLISH_EVIDENCE_V1を必須入力とします。そこにはtool_use_id、command digest、local_oid、remote_oid、ref、nonce、expiryなどが必要です。Phase Aのコードと文書は、そのファイルをtrusted verifierが生成することだけを規定し、具体的な生成・受け渡し方法を#1450へ明示的に先送りしています。一方、#1450のAC2はcandidate側adapter/policyを「command payloadとcomponent実体をlauncherへ渡すintegration点」としています。これは信頼モデルとして成立しません。candidate側コードは攻撃者管理下と仮定しているため、trusted evidenceのissuerにもtransportにもできません。
さらに、既存publish lane policyが確認していた以下の事実が、現在のlauncher入力には含まれていません。
allowed_paths_gate_statusverified_headdeclared_publish_head既存policyはこれらを認可条件にしていますが、Phase A launcherは
issue_numberをparseするだけで、branch・Allowed Paths契約・review evidenceとの対応を評価していません。必須修正
candidate adapterからlauncherへ「委譲」する設計を削除し、次のいずれかへ変更してください。
tool_use_idをキーに取得する。推奨契約は次です。
issued_byのような自己申告metadataではなく、candidateが生成できないMAC、privileged broker、またはroot-owned one-shot storeが必要です。P0 Blocker 2:Phase Aは「マージ済み」だが「実機で稼働済み」ではない
PR #1457は、installerと登録手順を配布しただけで、privileged operatorによる実機installや
/etc/codex/requirements.toml登録を実行していません。PR本文でも明示されています。対して#1450は、「merge済みtrust rootが既に稼働している」ことを前提とし、実機installをOut of Scopeにしています。
この二つの間に、実行環境の状態を証明するゲートがありません。リポジトリ内のintegration testがPASSしても、実機ではmanaged hookが未登録、古いgeneration、誤owner、誤modeという可能性があります。
OpenAIの公式仕様上、project-local hookは未信頼ならskip可能ですが、
requirements.toml由来のmanaged hookはpolicy-trustedでユーザーから無効化できません。したがって、実際のmanaged registrationがセキュリティ特性の前提です。([OpenAI Developers]1)必須修正
#1450に着手前ゲートを追加してください。
temporary directory上のpytestだけでなく、対象WSL環境でoperatorが生成した証跡を必須にすべきです。
P0 Blocker 3:AC1の
.codex/hooks.json切替は二重起動を作る#1450 AC1は、project-local
.codex/hooks.jsonをtrusted launcherへ向けることを要求しています。しかしPhase Aは既に、system-managed
PreToolUseとして同launcherを登録する設計です。Codexは複数hook sourceについて、上位設定で下位設定を置換せず、一致した全hookを並列起動します。([OpenAI Developers]1)したがってAC1を実装すると、少なくとも以下が発生します。
updatedInputが返る場合の統合契約が未定義現在の
.codex/hooks.jsonにも既存composite、branch guard、worktree guardなど複数のBashPreToolUsehookがあります。必須修正
AC1を反転してください。
OpenAI公式仕様でも、managed hookを強制しつつ他sourceを無効化する場合は
allow_managed_hooks_onlyが用意されています。少なくともsecurity-critical matcherについて、単一entrypointを保証する必要があります。([OpenAI Developers]1)P0 Blocker 4:rewritten commandはtrusted publisherではない
launcherはrepository identityを
remote.origin.urlで確認した後、次のコマンドを返します。問題は、認可時のrestricted Git環境ではなく、後からCodexの通常shell環境でこの文字列が実行されることです。
updatedInputは置換後のcommand文字列を実行する仕組みであり、launcherのenvやopen済みdescriptorは引き継ぎません。([OpenAI Developers]1)Gitでは以下が有効です。
remote.origin.pushurlがある場合、pushにはremote.origin.urlではなくpushurlが使われる。url.*.pushInsteadOfでpush先URLを書き換えられる。core.hooksPathでcandidate-controlledなpre-pushhookを起動できる。git pushは既定でpre-pushhookを実行する。([Git]2)つまり、
remote.origin.urlが正規GitHub URLでも、実際には別repositoryへ送信したり、push直前に任意処理を実行したりできます。検査後に.git/configを変更するTOCTOUも残ります。必須修正
updatedInput.commandはGitそのものではなく、外部trust root内のpublisher wrapperを指す必要があります。publisher内部で次を固定します。
Gitの明示的な
--force-with-lease=<ref>:<expect>は、remote refが期待値と一致しない限り失敗するため、この形自体は維持して構いません。([Git]3)必須negative test:
P0 Blocker 5:nonce storeが権限契約上書き込めない
launcherは「runtime UIDとtrust root owner UIDが異なること」を必須にしています。その一方で、nonce消費時には次を行います。
installerはtrust rootをowner-controlledにし、release filesを
0444、release directoryを0555にしますが、runtime UID向けのwritable nonce directoryやACLを作成していません。したがって既定のproduction permission modelでは、runtime userは
nonces/を作れず、正常なpublishもauthorization_runtime_untrustedで停止します。PR #1457のテストでも、異なる実UIDを使ったprivileged正常系は環境制約によりSKIPされています。
必須修正
immutable trust rootとmutable runtime stateを分離してください。
より安全なのは、unprivileged launcher自身にmarkerを書かせず、privileged brokerへone-shot consumeを依頼する方式です。
少なくとも次の検証が必要です。
この問題は#1450だけでは修正できず、#1454のfollow-upまたはreopenが必要です。
P1 Blocker 6:session cwdをrepository rootと誤認している
OpenAI公式仕様ではhook commandはsessionの
cwdで実行され、Codexはrepositoryのsubdirectoryから開始される場合があります。([OpenAI Developers]1)launcherはevidenceの
candidate_repo_dirをそのまま使い、Git directoryを次のように構築します。cwdがsrc/やdocs/の場合は.gitが存在せず、正当なpublishがfail-closedになります。必須修正
固定Git binaryとsanitized envで、次を実行してrepository root/common dirを確定してください。
そのうえで、
cwdがroot配下であることを検証します。
必須テスト:
P1 Blocker 7:rotationがrelease単位で原子的ではない
installerは次の順に別々のrenameを行います。
active.jsontrusted_hook_launcher.pymanifest_schema.py各renameは個別にはatomicですが、3ファイルの組としてはatomicではありません。rotation中のhookは、例えば「新manifest+旧launcher+旧schema」という混成状態を観測できます。
必須修正
固定パスには小さなimmutable dispatcherだけを置き、dispatcherが
active.jsonを一度だけ読み、同じrelease directory内のlauncher/schema/manifestを使用する構成にしてください。rotation中に多数のhook subprocessを並列起動するテストも必要です。
P2 High:Issue契約とタイトルが実装実態に合っていない
現在のタイトルは「policy/adapterのhash pinning」ですが、必要なセキュリティ特性はhash pinningではありません。
必要なのは次の一連のend-to-end propertyです。
candidate component digestはその一部にすぎません。
推奨タイトル
修正版Issue契約の最小要件
Outcome
必須AC
pushurl、insteadOf、pushInsteadOf、core.hooksPath、ambient Git envの影響を受けない。Allowed Paths
現在のAllowed Pathsでは修正不能です。少なくとも次への拡張が必要です。
ただし、
.codex/hooks.jsonの変更目的はlauncher追加ではなく、candidate側publish allow経路の削除またはtelemetry限定化です。推奨実施順序
現状の#1450を先に実装すると、テスト上はgreenでも、実機では全denyになるか、Git config経由で別destinationへpushできる構成になります。
この判定では、#1450の実装を止め、#1454の修正follow-upを先行させるのが妥当です。
squne121 commentedon Jul 11, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 11, 2026
クローズ判断: not planned
本Issueは #1468(trust-root hardening follow-up: privileged broker・nonce runtime state分離・trusted publisher wrapper・atomic rotation・deployment attestation)のmergeを前提として着手する設計でした。#1468 は以下の理由でnot plannedとしてクローズしました。
本Issueが対策しようとしていた「self-signed authorization」問題(publishしようとしている差分自身が、そのpublishを許可するpolicyも同時に変更できる)についても、以下の理由で追加対策は不要と判断しました。
今後の方針
scripts/trust-root/(#1454で導入済み)は本Issueのクローズにより実質的に利用されないコードとして残ります。将来的なcleanup対象として認識しておきます。chore: 未配線の external trust root(scripts/trust-root/)を削除する (#1469) (#1471