From 08875b51d45afdc99d09414d696d8e0daed8b2d1 Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Thu, 6 Aug 2026 18:55:37 -0500 Subject: [PATCH] Fix claude-code-review.yml trust gate: check PR author, not head repo owner github.event.pull_request.head.repo.owner.login only identifies who owns the fork for fork-headed PRs. For an upstream-branch-headed PR (base and head both live in this repo, as required by gh stack, or just what gh pr create produces without a fork), head.repo.owner.login is always this repo's own org, never the actual PR author -- so the gate silently skipped review on every such PR regardless of who opened it. Check github.event.pull_request.user.login instead: it identifies the PR author directly, can't be spoofed by a third party any more than head repo owner can, and works for both fork-headed and upstream-branch-headed PRs. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/claude-code-review.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index b530389..524f53d 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -21,19 +21,19 @@ concurrency: jobs: claude-review: - # Trusted fork only, and skip drafts (don't spend API/CI on unfinished PRs). - # To add more trusted owners, extend the head-owner check. + # Trusted author only, and skip drafts (don't spend API/CI on unfinished PRs). + # To add more trusted authors, extend the author check. # - # SECURITY-CRITICAL: this owner check is the ONLY thing that makes + # SECURITY-CRITICAL: this author check is the ONLY thing that makes # `allow-unsafe-pr-checkout: true` below acceptable. Without it, this # pull_request_target job would check out and let Claude act on # arbitrary fork code while holding base-repo secrets/token — a "pwn # request". Do not remove or loosen this condition (e.g. drop the - # owner check, or allow non-owner forks) without re-evaluating the + # author check, or allow untrusted authors) without re-evaluating the # fork-checkout step's safety. if: >- github.event.pull_request.draft == false && - github.event.pull_request.head.repo.owner.login == 'jnasbyupgrade' + github.event.pull_request.user.login == 'jnasbyupgrade' runs-on: ubuntu-latest timeout-minutes: 60 permissions: