ci(claude): allow fork-PR authors to trigger Claude review#932
ci(claude): allow fork-PR authors to trigger Claude review#932kovtcharov wants to merge 1 commit intomainfrom
Conversation
The claude-code-action gates execution on the actor's repo permission. Fork PR authors only have read, so the action exits with "Actor does not have write permissions to the repository" before ever calling Anthropic. Setting allowed_non_write_users: "*" on pr-review and issue-handler bypasses that gate so external contributors get the same auto-review maintainers do, without having to maintain a username allowlist. Skipped pr-comment (already filtered to non-fork PRs) and release-notes (only fires from a maintainer-owned tag push). Header comment documents the residual prompt-injection risk and the action's built-in mitigations (subprocess secret scrubbing, pinned bun, hardened PATH) so future-us knows what to tighten if a real exfiltration attempt lands.
SummarySurgical 3-hunk change adding Issues Found🟡 Important —
|
Summary
The
claude-code-actiongates execution on the actor's repo permission. Fork-PR authors only haveread, so the action exits with"Actor does not have write permissions to the repository"before ever calling Anthropic — which is why PR #924 from@theonlychant(and any future fork PR) gets a 5-second red ❌ on the Claude AI Assistant check. Settingallowed_non_write_users: "*"onpr-reviewandissue-handlerbypasses that gate so external contributors get the same auto-review maintainers do, with no username allowlist to maintain.Threads
pr-review+issue-handlergetallowed_non_write_users: "*"— these are the two jobs that take input from non-maintainers (fork-PR diffs,@claudementions on issues / PR conversations).pr-commentandrelease-notesleft alone —pr-commentis already filtered to non-fork PRs (head.repo.full_name == github.repository), andrelease-notesonly fires from a maintainer-owned tag push viaworkflow_run. The actor on those is always a write user, so the gate is a no-op there.Bashin--allowedToolsand access toANTHROPIC_API_KEY+GITHUB_TOKEN. Prompt injection in the diff could try to coerce Claude into running an exfiltration command. The action's built-in mitigations (subprocess secret scrubbing viaCLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1auto-set when this input is non-empty, pinned bun binary, hardened PATH) reduce — but don't eliminate — the surface. Future-us reading the header knows what to tighten if a real attempt lands (swap*for a literal username list — verified upstream insrc/github/validation/permissions.tsthatallowed_non_write_usersonly takes literal usernames or*, notauthor_associationvalues likeCONTRIBUTOR).Test plan
pull_request_targetuses the workflow frommain, not the PR head, so this PR can't validate itself. The verification path is post-merge:main⚠️ SECURITY WARNING: Bypassing write permission check for theonlychant due to allowed_non_write_users configuration(the action emits this when the bypass takes effect)pr-comment(non-fork-only) still works on a maintainer's@claudereview-comment reply