modelcontextprotocol / modelcontextprotocol/servers

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

Open
#4,795 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Description

The claude job in .github/workflows/claude.yml (lines 15-19) is triggered
solely by a comment/issue containing the substring @​claude, with no check on
who wrote it:

if: |
  (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@​claude')) ||
  (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@​claude')) ||
  (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@​claude')) ||
  (github.event_name == 'issues' && (contains(github.event.issue.body, '@​claude') || contains(github.event.issue.title, '@​claude')))

Any GitHub user can therefore start the job by commenting @​claude ... on an
issue, PR, or review. The job then runs with:

  • secrets.ANTHROPIC_API_KEY (line 37) — the API key is exposed to the run
  • --allowedTools "Bash,mcp__mcp-docs,WebFetch" (line 48) — the agent gets a
    shell on the runner
  • permissions: id-token: write (line 25) — OIDC token minting
  • actions: read (line 26), plus the third-party
    anthropics/claude-code-action@v1 pinned to a mutable tag

Because the triggering comment's text flows into the LLM agent's context, this
is the classic "prompt injection into a privileged CI agent" surface: an
untrusted commenter can spend the project's API quota on arbitrary agent runs,
and malicious instructions in the comment can steer an agent that holds Bash
access, the API key, and OIDC capabilities.

Trigger scenario

  1. Anyone opens an issue, comments on an issue/PR, or submits a PR review and
    includes @​claude plus arbitrary instructions in the text.
  2. The workflow runs on ubuntu-latest with the permissions above, regardless
    of the commenter's role (no author_association check).
  3. The comment text is processed by the agent with Bash access.

Impact

  • Unauthorized use of the ANTHROPIC_API_KEY on agent runs (billable).
  • Prompt-injection-driven actions within the runner's permissions (repository
    contents read, PR/issue read, OIDC token, actions metadata).
  • Abuse of repository CI resources.

Suggested fix

Gate the job on trusted actors, e.g.:

if: |
  (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@​claude') && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
  ...

Additionally: restrict the tools exposed to externally-triggered runs (or drop
Bash), remove id-token: write if it is not actually used, and pin
anthropics/claude-code-action to a full commit SHA.

I'd be happy to open a PR implementing the author_association gate (and any
of the other hardening bits) if that's welcome. Thanks for maintaining the
reference servers!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the claude job and its if condition in .github/workflows/claude.yml, then review the listed permissions, tools, secret use, and action reference. Add the trusted-actor gate and determine which other hardening changes are in scope. Done means untrusted comments cannot trigger the privileged job while trusted associations retain the intended behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.