Skip to content

fix(workflows): require trusted author for @claude trigger#1503

Open
NickNojiri wants to merge 1 commit into
anthropics:mainfrom
NickNojiri:fix/trigger-workflow-author-guard
Open

fix(workflows): require trusted author for @claude trigger#1503
NickNojiri wants to merge 1 commit into
anthropics:mainfrom
NickNojiri:fix/trigger-workflow-author-guard

Conversation

@NickNojiri

Copy link
Copy Markdown
Contributor

Summary

Related to #1481 and #1445. While looking into those, I found the specific
files with the gap they describe: examples/claude.yml, examples/claude-wif.yml,
and this repo's own .github/workflows/claude.yml all gate the claude job
purely on trigger-phrase presence (contains(github.event.comment.body, '@claude')),
with no check on who authored the comment/review/issue.

Note: I checked docs/usage.md and the /install-github-app command mentioned
in #1481 — the former doesn't contain a trigger if: example, and the latter
lives in the separate claude-code CLI repo, so neither was in scope here. I
also confirmed the action's own runtime checks (checkHumanActor,
checkWritePermissions) already reject bot/non-writer actors before Claude
executes — so this isn't closing an exploit, it's a fail-fast improvement:
the job no longer spins up a runner at all for an untrusted trigger, and the
example templates people copy now demonstrate the safer pattern by default.

Changes

Add to the if: condition in all three files:

  • github.event.sender.type != 'Bot'
  • contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), <event>.author_association)
    per event type (comment/review/issue), matching the field each event
    actually populates

Testing

  • YAML syntax validated for all three files
  • bun test — 770 pass, 0 fail (no test changes needed; these are workflow configs)
  • bun run typecheck / bun run format:check — clean

The example workflows (examples/claude.yml, examples/claude-wif.yml)
and this repo's own CI workflow (.github/workflows/claude.yml) gate
on the trigger phrase alone: any actor whose comment, review, or
issue body contains "@claude" starts the job, regardless of who
posted it or whether it was a bot.

Add an author_association check (OWNER/MEMBER/COLLABORATOR) and
exclude bot senders, so the job itself does not start for untrusted
or automated triggers rather than relying solely on the checks
that run inside the action.
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.

1 participant