Conversation
Code Review: Claude Code GitHub WorkflowThank you for adding Claude Code integration! Here's my analysis based on the repository's standards and best practices: ✅ Strengths
🔍 Code Quality & Best Practicesclaude-code-review.yml (.github/workflows/claude-code-review.yml:1)Positive aspects:
Suggestions:
claude.yml (.github/workflows/claude.yml:1)Positive aspects:
Suggestions:
|
|
@claude The job runs whenever a comment/body contains @claude, but there is no check on author_association or any other trust signal. That means in a public repo any external commenter can trigger a workflow that uses CLAUDE_CODE_OAUTH_TOKEN, which conflicts with the intended “only users with write access can trigger” behavior and exposes the token to untrusted triggering (cost/abuse risk). Consider gating the if on author_association (e.g., MEMBER, OWNER, COLLABORATOR) or on a pull_request_target/label-based allowlist. Open a PR to restrict this workflow to be triggered only by human users with write permission on the repository, such as owners, members and collaborators. |
|
Claude finished @simonheimlicher's task in 55s —— View job Security Fix: Restrict Workflow to Authorized UsersI've identified the security issue and understand what needs to be fixed. However, I'm unable to modify workflow files directly due to GitHub App permissions. Todo List:
The Security IssueYou're absolutely correct - the current workflows have a critical security vulnerability:
Required ChangesI cannot modify workflow files due to GitHub App permissions, but here's exactly what needs to be changed: 1. Fix
|
SECURITY FIX: Addresses critical vulnerability where any external user could trigger Claude workflows using CLAUDE_CODE_OAUTH_TOKEN. Changes: - Add author_association checks to claude.yml (OWNER, MEMBER, COLLABORATOR only) - Add author_association checks to claude-code-review.yml - Add concurrency controls to prevent workflow spam Resolves: #1 (comment)
…ariables Extract repeated configuration values into GitHub Actions variables with sensible defaults, enabling runtime configuration without code changes. Configuration variables: - CLAUDE_AUTHORIZED_ROLES: Control who can trigger workflows - CLAUDE_MENTION_TRIGGER: Customize trigger word (default: @claude) - CLAUDE_CONCURRENCY_CANCEL: Enable canceling in-progress runs - CLAUDE_ALLOWED_TOOLS: Restrict tool access - CLAUDE_CUSTOM_PROMPT: Override default prompts - CLAUDE_REVIEW_*: Separate configuration for code review workflow Benefits: - DRY: Single source of truth for authorization roles (was repeated 5x) - Flexibility: Change behavior via repo settings without editing workflows - Security: Easily adjust authorization without touching code - Documentation: Comprehensive guide in .github/CLAUDE_WORKFLOWS.md Related: #1 (comment)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0de1cfaee2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 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'))) |
There was a problem hiding this comment.
Restrict @claude triggers to trusted actors
This job runs for any issue/PR comment containing @claude without checking author association, which means in a public repo any external user can trigger the workflow and consume the CLAUDE_CODE_OAUTH_TOKEN quota (and potentially prompt the assistant to act on their behalf). That is a security/rate‑limit exposure because it enables untrusted users to burn API credits or spam the automation. Consider gating on github.event.*.author_association (e.g., MEMBER, COLLABORATOR) or otherwise restricting who can invoke the workflow before using the secret.
Useful? React with 👍 / 👎.
…#2) * fix(workflows): add authorization checks to prevent token abuse SECURITY FIX: Addresses critical vulnerability where any external user could trigger Claude workflows using CLAUDE_CODE_OAUTH_TOKEN. Changes: - Add author_association checks to claude.yml (OWNER, MEMBER, COLLABORATOR only) - Add author_association checks to claude-code-review.yml - Add concurrency controls to prevent workflow spam Resolves: #1 (comment) * refactor(workflows): parameterize configuration with GitHub Actions variables Extract repeated configuration values into GitHub Actions variables with sensible defaults, enabling runtime configuration without code changes. Configuration variables: - CLAUDE_AUTHORIZED_ROLES: Control who can trigger workflows - CLAUDE_MENTION_TRIGGER: Customize trigger word (default: @claude) - CLAUDE_CONCURRENCY_CANCEL: Enable canceling in-progress runs - CLAUDE_ALLOWED_TOOLS: Restrict tool access - CLAUDE_CUSTOM_PROMPT: Override default prompts - CLAUDE_REVIEW_*: Separate configuration for code review workflow Benefits: - DRY: Single source of truth for authorization roles (was repeated 5x) - Flexibility: Change behavior via repo settings without editing workflows - Security: Easily adjust authorization without touching code - Documentation: Comprehensive guide in .github/CLAUDE_WORKFLOWS.md Related: #1 (comment) * fix(workflows): use correct author_association field for issues event Fix critical bug where issues event used github.event.sender.author_association instead of github.event.issue.author_association. The sender object does not have author_association for issues events, causing the check to always fail. This completely broke @claude mentions in issues (opened, assigned events). Fixes: #2 (comment)
🤖 Installing Claude Code GitHub App
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
What is Claude Code?
Claude Code is an AI coding agent that can help with:
How it works
Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
Important Notes
Security
There's more information in the Claude Code action repo.
After merging this PR, let's try mentioning @claude in a comment on any PR to get started!