Skip to content

Update Claude Code Review workflow to include checkout#1247

Merged
sbryngelson merged 1 commit intoMFlowCode:masterfrom
sbryngelson:claude-fix-4
Feb 22, 2026
Merged

Update Claude Code Review workflow to include checkout#1247
sbryngelson merged 1 commit intoMFlowCode:masterfrom
sbryngelson:claude-fix-4

Conversation

@sbryngelson
Copy link
Copy Markdown
Member

@sbryngelson sbryngelson commented Feb 22, 2026

User description

Description

Summarize your changes and the motivation behind them.

Fixes #(issue)

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other: describe

Testing

How did you test your changes?

Checklist

  • I added or updated tests for new behavior
  • I updated documentation if user-facing behavior changed

See the developer guide for full coding standards.

GPU changes (expand if you modified src/simulation/)
  • GPU results match CPU results
  • Tested on NVIDIA GPU or AMD GPU

CodeAnt-AI Description

Allow Claude Code Review to checkout PR head and access repository files

What Changed

  • The workflow now checks out the pull request head commit so the Claude review action can read the PR's repository files
  • The checkout uses the PR head SHA and a shallow fetch to ensure the review runs against the latest commit from the contributor's branch (including forks)
  • Claude Code Review is given read access to actions/CI results and the repository contents so reviews include actual code and CI context

Impact

✅ Claude can read PR files
✅ Reviews run against the latest PR commit
✅ Reviews include CI context and repository contents

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Copilot AI review requested due to automatic review settings February 22, 2026 22:09
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Feb 22, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 22, 2026

Warning

Rate limit exceeded

@sbryngelson has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sbryngelson sbryngelson merged commit b310c43 into MFlowCode:master Feb 22, 2026
24 checks passed
@sbryngelson sbryngelson deleted the claude-fix-4 branch February 22, 2026 22:10
@codeant-ai codeant-ai bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Feb 22, 2026
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Feb 22, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modifies the Claude Code Review GitHub Actions workflow to add a checkout step for the PR head, removing an explicit security warning comment that previously stated "IMPORTANT: no checkout for pull_request_target (fork-safe)". The change also removes some workaround comments about the GitHub App token exchange and CI results.

Changes:

  • Adds checkout step to pull_request_target workflow, checking out untrusted PR code with access to repository secrets
  • Removes security warning comment about not using checkout with pull_request_target
  • Removes explanatory comments about workarounds and optional features

Comment on lines +18 to +23
- name: Checkout PR head (fork)
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1

Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces a critical security vulnerability. The workflow uses pull_request_target which runs in the context of the base repository with access to secrets (like CLAUDE_CODE_OAUTH_TOKEN), but now checks out untrusted code from the PR head (potentially from a fork).

The original comment "# IMPORTANT: no checkout for pull_request_target (fork-safe)" was removed, which explicitly warned against this exact security issue. An attacker could create a malicious PR that:

  1. Checks out their malicious code into the workflow runner
  2. Executes arbitrary code with access to repository secrets
  3. Compromises the repository or exfiltrates secrets

The pull_request_target event is designed to run workflows from the base branch to prevent untrusted code execution. If the claude-code-action needs access to the PR code, it should either:

  • Use the pull_request event instead (which doesn't have write permissions or access to secrets from forks)
  • Fetch the PR code through the GitHub API without checking it out
  • Use a two-job approach where one job with pull_request_target handles secrets and another with pull_request handles code

Please revert this change and consult with the claude-code-action maintainers about the correct way to provide PR context without compromising security.

Suggested change
- name: Checkout PR head (fork)
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
# IMPORTANT: no checkout for pull_request_target (fork-safe)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 2/5

  • There is a high-risk security concern: .github/workflows/claude-code-review.yml uses pull_request_target with untrusted fork code, which can expose base-repo secrets to prompt injection or malicious changes.
  • This is likely to be user-impacting and security-sensitive, so the merge risk is high until the workflow is hardened or the trigger changed.
  • Pay close attention to .github/workflows/claude-code-review.yml - pull_request_target with secrets and write permissions can be exploited by forked PRs.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/claude-code-review.yml">

<violation number="1" location=".github/workflows/claude-code-review.yml:18">
P0: **Security: Checking out untrusted fork code in a `pull_request_target` workflow exposes secrets to prompt injection attacks.**

The `pull_request_target` trigger runs with the base repo's secrets and write permissions. By checking out the fork's HEAD, untrusted code (including potential `CLAUDE.md` prompt injection files) becomes available to `claude-code-action`, which is an AI agent capable of executing shell commands and reading files. A malicious PR could craft prompt injections that exfiltrate `CLAUDE_CODE_OAUTH_TOKEN` or abuse the `github.token`'s write access.

The previous workflow deliberately avoided checkout with the comment *"IMPORTANT: no checkout for pull_request_target (fork-safe)"*. This security measure should not be removed. If checkout is needed for the action to function, consider restricting to non-fork PRs:
```yaml
- name: Checkout PR head (non-fork only)
  if: github.event.pull_request.head.repo.full_name == github.repository
  uses: actions/checkout@v4
  with:
    ref: ${{ github.event.pull_request.head.sha }}
    fetch-depth: 1
```</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +18 to +22
- name: Checkout PR head (fork)
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: Security: Checking out untrusted fork code in a pull_request_target workflow exposes secrets to prompt injection attacks.

The pull_request_target trigger runs with the base repo's secrets and write permissions. By checking out the fork's HEAD, untrusted code (including potential CLAUDE.md prompt injection files) becomes available to claude-code-action, which is an AI agent capable of executing shell commands and reading files. A malicious PR could craft prompt injections that exfiltrate CLAUDE_CODE_OAUTH_TOKEN or abuse the github.token's write access.

The previous workflow deliberately avoided checkout with the comment "IMPORTANT: no checkout for pull_request_target (fork-safe)". This security measure should not be removed. If checkout is needed for the action to function, consider restricting to non-fork PRs:

- name: Checkout PR head (non-fork only)
  if: github.event.pull_request.head.repo.full_name == github.repository
  uses: actions/checkout@v4
  with:
    ref: ${{ github.event.pull_request.head.sha }}
    fetch-depth: 1
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/claude-code-review.yml, line 18:

<comment>**Security: Checking out untrusted fork code in a `pull_request_target` workflow exposes secrets to prompt injection attacks.**

The `pull_request_target` trigger runs with the base repo's secrets and write permissions. By checking out the fork's HEAD, untrusted code (including potential `CLAUDE.md` prompt injection files) becomes available to `claude-code-action`, which is an AI agent capable of executing shell commands and reading files. A malicious PR could craft prompt injections that exfiltrate `CLAUDE_CODE_OAUTH_TOKEN` or abuse the `github.token`'s write access.

The previous workflow deliberately avoided checkout with the comment *"IMPORTANT: no checkout for pull_request_target (fork-safe)"*. This security measure should not be removed. If checkout is needed for the action to function, consider restricting to non-fork PRs:
```yaml
- name: Checkout PR head (non-fork only)
  if: github.event.pull_request.head.repo.full_name == github.repository
  uses: actions/checkout@v4
  with:
    ref: ${{ github.event.pull_request.head.sha }}
    fetch-depth: 1
```</comment>

<file context>
@@ -15,20 +15,21 @@ jobs:
 
     steps:
-      # IMPORTANT: no checkout for pull_request_target (fork-safe)
+      - name: Checkout PR head (fork)
+        uses: actions/checkout@v4
+        with:
</file context>
Suggested change
- name: Checkout PR head (fork)
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
- name: Checkout PR head (non-fork only)
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Development

Successfully merging this pull request may close these issues.

2 participants