Skip to content

Restrict Claude workflow to trusted actors via author_association checks#224

Closed
Copilot wants to merge 2 commits intofix-claude-ghafrom
copilot/sub-pr-222
Closed

Restrict Claude workflow to trusted actors via author_association checks#224
Copilot wants to merge 2 commits intofix-claude-ghafrom
copilot/sub-pr-222

Conversation

Copy link

Copilot AI commented Mar 17, 2026

Any external GitHub user could trigger the Claude Code workflow by mentioning @claude in a comment or issue, causing it to run with contents/pull-requests/issues: write — a clear privilege-escalation path.

Changes

  • author_association allowlist: The workflow if condition now gates execution on the triggering user having an association of OWNER, MEMBER, COLLABORATOR, or CONTRIBUTOR. NONE, FIRST_TIMER, and FIRST_TIME_CONTRIBUTOR are blocked.
  • Bot exclusion: Added github.event.sender.type != 'Bot' guard.
  • fromJSON + contains pattern: Used for clean, maintainable allowlist checks across all four event types.
if: |
  (github.event.sender.type != 'Bot') &&
  (
    (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR","CONTRIBUTOR"]'), github.event.comment.author_association)) ||
    ...
  )

The write permissions (pull-requests, issues, contents) are retained — they're required for Claude to post comments and push code changes.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…hecks

Co-authored-by: chrisghill <15616541+chrisghill@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on Claude's write permission for PR comments Restrict Claude workflow to trusted actors via author_association checks Mar 17, 2026
Copilot AI requested a review from chrisghill March 17, 2026 21:25
@chrisghill chrisghill closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants