Skip to content

ci: harden Claude workflows (gate @claude, skip-fork PR review)#15

Merged
atom2ueki merged 1 commit into
mainfrom
ci/harden-claude-workflows
Jun 11, 2026
Merged

ci: harden Claude workflows (gate @claude, skip-fork PR review)#15
atom2ueki merged 1 commit into
mainfrom
ci/harden-claude-workflows

Conversation

@atom2ueki

Copy link
Copy Markdown
Owner

Ports the CI hardening from mcp-server-synology to this repo. The workflows here were the same template and carried the same two issues.

1. claude.yml — restrict @claude to trusted users (HIGH)

@claude runs on issue_comment / pull_request_review_comment / pull_request_review / issuesprivileged events (default-branch context, secrets, contents: write, PR-head checkout) that are not covered by the fork-PR approval gate. The old if: only required sender != Bot + the text @claude, so any non-bot GitHub user could trigger a secrets-bearing, write-capable run.

Adds a per-event author-association gate (OWNER/MEMBER/COLLABORATOR), bound to the actor of the firing event. The binding is per-event on purpose: an issue_comment payload carries both comment and issue, so a blanket OR would let an untrusted commenter pass via the trusted issue author on a maintainer-owned issue/PR.

2. claude-review.yml — gate review to same-repo PRs

The review job now requires head.repo.full_name == github.repository, so fork PRs are skipped (no failing check, zero token spend, no secret exposure). Same-repo PRs auto-review; fork review is on-demand via the now-gated @claude.

Note on this PR's own check

The review check will 401 (Workflow validation failed) because this PR edits claude-review.yml — by-design anti-tampering, not a real failure; the message itself says to ignore it. Safe to merge despite that one red check.

🤖 Generated with Claude Code

Mirrors the hardening applied to mcp-server-synology:

- claude.yml: @claude ran on privileged comment/issue events (secrets,
  contents: write, PR-head checkout) gated only by sender != Bot + the text
  "@claude" — so ANY non-bot user could trigger it. Add a per-event
  author_association gate (OWNER/MEMBER/COLLABORATOR), bound to the actor of
  the firing event so an untrusted commenter can't pass via a trusted issue
  author on a maintainer-owned issue/PR.

- claude-review.yml: gate the review job to same-repo PRs
  (head.repo == this repo). Fork PRs are skipped — no failing check, zero
  token spend, no secret exposure. Fork review on demand via gated @claude.
@atom2ueki atom2ueki merged commit dc73f49 into main Jun 11, 2026
3 of 4 checks passed
@atom2ueki atom2ueki deleted the ci/harden-claude-workflows branch June 11, 2026 19:15
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