Skip to content

実装: Allowed Paths boundary audit を unprivileged pull_request の CI required check として追加する #759

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "557"
goal_ref: "GitHub Actions の unprivileged pull_request で git diff --name-only base...head × Allowed Paths を評価する boundary audit を required check として追加し、privileged context での untrusted checkout を避ける"
change_kind: ci

Parent Issue

#557(design + parent)

Parent Goal Ref

  • Goal: Allowed Paths boundary audit を CI required check として独立させ、手順書依存でなく機械的に enforce する defense-in-depth を加える。
  • Desired Destination: review subagent gate(child B)に加え、CI でも PR の changed files × Allowed Paths を検査する二重化。

Current Validated Scope

  • .github/workflows/ に、pull_request(unprivileged)で git diff --name-only <base>...<head> の changed files を linked issue の Allowed Paths と照合する workflow を追加する。
  • 照合ロジックは child B の評価スクリプト(allowed_paths_review_gate.py)を CLI 再利用する。
  • pull_request_target 等の privileged context で untrusted PR code を checkout/実行しない。

Remaining Parent Gaps

  • worker-side hook 配線(child A spike → A-impl)。
  • review-subagent gate 本体(child B)。

Outcome

PR ごとに GitHub Actions の pull_request(unprivileged)trigger で git diff --name-only <base>...<head> の changed files が linked issue の Allowed Paths snapshot と機械照合され、逸脱があれば check が fail する required boundary audit が存在する。workflow は pull_request_target 等の privileged context で untrusted PR code を checkout/実行せず、CodeQL の untrusted-checkout guidance に沿う。

In Scope

  • .github/workflows/allowed-paths-boundary-audit.yml(新規)を追加し、pull_request で changed files × Allowed Paths を評価する。
  • 評価は child B の allowed_paths_review_gate.py を CLI として呼ぶ(ロジック二重実装を避ける)。
  • workflow は unprivileged で動作し、untrusted code を privileged に checkout しない。

Out of Scope

  • worker-side PreToolUse hook(child A/A-impl)。
  • review-subagent gate スクリプト本体の実装(child B。本 child はその CLI を再利用するのみ)。
  • branch protection の required check 登録設定(リポジトリ管理者の手動操作。本 child は workflow の追加まで)。
  • production game code(src/**)の変更。

Acceptance Criteria

  • AC1: .github/workflows/allowed-paths-boundary-audit.yml が追加され、on: pull_request で trigger される
  • AC2: workflow が git diff --name-only の changed files を Allowed Paths と照合する step を含む
  • AC3: workflow が pull_request_target を使わず、untrusted PR code を privileged context で checkout しない
  • AC4: workflow が child B の allowed_paths_review_gate.py を CLI として再利用する(照合ロジックを二重実装しない)

Verification Commands

# AC1
$ grep -qE "^on:|pull_request" .github/workflows/allowed-paths-boundary-audit.yml
# AC2
$ grep -q "git diff --name-only" .github/workflows/allowed-paths-boundary-audit.yml
# AC3
$ ! grep -q "pull_request_target" .github/workflows/allowed-paths-boundary-audit.yml
# AC4
$ grep -q "allowed_paths_review_gate.py" .github/workflows/allowed-paths-boundary-audit.yml

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • child B の allowed_paths_review_gate.py がまだ存在せず CLI 再利用できない場合(child B 完了を待つ依存)
  • 新規 Issue の起票(スコープ分割)が必要と判断した場合
  • privileged workflow が不可避と判明した場合(人間判断へ差し戻し)
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存 workflow 大規模改変が必要になった場合

Required Skills

なし

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue の AC は workflow YAML の静的検証(grep / actionlint)で完結する。workflow の実 trigger 挙動は PR の Checks タブで人間が確認するが、それは本 Issue の AC ではない。

Allowed Paths

  • .github/workflows/allowed-paths-boundary-audit.yml

Scope Delta(任意)

N/A

Delivery Rule

  • 1 Issue = 1 PR
  • 専用 worktree で作業し、Draft PR を既定とする
  • production game code(src/**)には触れない

Notes for Reviewer

Activity

  1. added
    phase/implementation
    agent/implementer
    kind/implementation
    area/ai-ops
    on Jun 7, 2026
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/ai-opskind/implementationphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions