Skip to content

fix(ci): restrict Claude workflow mentions - #4817

Open
FanouZeng-TT wants to merge 1 commit into
modelcontextprotocol:mainfrom
FanouZeng-TT:fix-claude-workflow-trusted-actors
Open

FanouZeng-TT wants to merge 1 commit into
modelcontextprotocol:mainfrom
FanouZeng-TT:fix-claude-workflow-trusted-actors

Conversation

@FanouZeng-TT

Copy link
Copy Markdown

Description

Fixes #4795.

Restricts the Claude Code workflow so @claude mention triggers from comments, review comments, reviews, and newly opened issues only run for trusted repository actors: OWNER, MEMBER, or COLLABORATOR.

The existing explicit issues.assigned trigger for assigning the issue to claude is kept separately, so maintainers can still start the workflow through assignment.

Publishing Your Server

Not applicable; this does not add or publish a server.

Server Details

  • Server: N/A — GitHub Actions workflow
  • Changes to: .github/workflows/claude.yml trigger gating

Motivation and Context

The workflow previously checked only whether the event body/title contained @claude. That allowed any GitHub user to trigger a privileged workflow run with the repository's Claude Code action configuration.

Adding author_association checks keeps the mention-based workflow path available for trusted repository actors while blocking untrusted external comments from starting the job.

This is separate from #4807: that PR hardens the README confirmation gate in readme-pr-check.yml; this one hardens the Claude Code workflow trigger in claude.yml.

How Has This Been Tested?

  • Parsed .github/workflows/claude.yml with Ruby's YAML parser.
  • Verified the workflow condition contains trusted-actor checks for comment, review-comment, review, and newly opened issue triggers.
  • Ran git diff --check.

Breaking Changes

No breaking changes for MCP servers or clients. The only behavior change is that untrusted external @claude mentions no longer start the Claude Code workflow.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

README and LLM-client testing are not applicable because this PR only changes a GitHub Actions workflow condition.

🤖 Generated with Claude Code

Co-Authored-By: Claude Code <noreply@anthropic.com>
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.

Workflow "Claude Code" can be triggered by any GitHub user commenting "@​claude"

1 participant