Harden Claude workflow permission gate - #32
Conversation
|
Warning Review limit reached
Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| if (context.eventName === 'issues') { | ||
| return context.payload.issue?.user?.login; | ||
| } |
There was a problem hiding this comment.
Assigned Issues Use Original Author
When an issues: assigned event fires, context.actor is the assigner but this branch makes the requester the original issue author. If a maintainer adds @claude or assigns an external user's issue to run Claude, the actor can pass while the requester check fails, so the workflow blocks a maintainer-triggered Claude run.
Context Used: CLAUDE.md (source)
Review: Harden Claude workflow permission gateOverview: Adds a new Strengths
Suggestions / minor issues
No test coverage exists for this logic (understandably, since it's a GitHub Actions script), but the PR description notes it was validated against a live positive/negative case in Overall this is a solid, well-reasoned hardening change with correct fail-safe semantics. |
| if (!(await hasWriteAccessFor(actor))) { | ||
| core.setOutput('authorized', 'false'); | ||
| core.setFailed(`Unable to run Claude because ${actor} does not have write/admin repository permission.`); | ||
| return; | ||
| } | ||
|
|
||
| if (!(await hasWriteAccessFor(requester))) { | ||
| core.setOutput('authorized', 'false'); | ||
| core.setFailed( | ||
| `Unable to run Claude because requester ${requester} does not have write/admin repository permission.` | ||
| ); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Minor: these two permission checks run sequentially (await hasWriteAccessFor(actor) then await hasWriteAccessFor(requester)). Not a real problem at this scale, but Promise.all([hasWriteAccessFor(actor), hasWriteAccessFor(requester)]) would save a round trip when actor !== requester.
| steps: | ||
| - name: Verify actor can run Claude | ||
| id: permission-gate | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 |
There was a problem hiding this comment.
Good practice pinning by full commit SHA rather than tag. Please double check this SHA actually resolves to actions/github-script v9 before merging — the # v9 suffix is just a comment and isn't validated by GitHub, and this workflow is specifically the security-hardening path where a wrong/stale pin would be easy to overlook.
Summary
authorize_claude_actorpermission gate before Claude Code runsChanged workflows
.github/workflows/claude.ymlValidation
actionlintpassed for the changed workflow file(s)Rollout context
This mirrors the verified gate from
shakacode/react_on_rails#4533.Positive path was exercised on
react_on_rails#4534; negative read-only actor attempts onreact_on_rails#4540blocked before the secret-bearing Claude job.