AI News Daily한국어
← AI tool tips
Claude Code✓ Confirmed in official docsAdded Dec 1

How to auto-scan GitHub PRs for vulnerabilities with the Claude Code Claude Security plugin

Add the Claude Security plugin to GitHub Actions and it scans each pull request's changes when the PR opens or gets new commits, then posts a review with suggested fixes. It can also block the merge on serious findings. The method is in the Claude Code docs as of plugin 0.13.0, released November 24. Unlike /claude-security, which you run by hand, it runs on every PR.

Check these conditions first.

  • Use it only in a repository where you trust everyone who can push. Text in a PR can steer the scan, and the scan can run the PR's code.
  • By default, a PR from a fork fails the job.
  • It runs only on GitHub-hosted Linux runners on GitHub.com. It can't sign in with a paid plan, so you need a Claude API key or a third-party provider such as Bedrock or Foundry.
  1. In the Claude Console, create a workspace for this job alone with a monthly spend limit, then create an API key scoped to that workspace. Unscoped keys fail the job (HTTP 400). Save the key as the repository secret ANTHROPIC_API_KEY under Settings → Secrets and variables → Actions.

  2. Create .github/workflows/claude-security.yml. This is the official sample with the second suggested-fixes job removed, so the first job drafts the fixes itself. After the @ in the uses line, put the 0.13.0 commit given in the docs.

name: Claude Security plugin

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review, edited]

permissions:
  actions: read
  contents: read
  pull-requests: write

concurrency:
  group: claude-security-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.event.action != 'edited' || github.event.changes.base != null }}

jobs:
  claude-security:
    if: >-
      github.event_name != 'merge_group'
      && (github.actor != 'dependabot[bot]'
      || github.event.pull_request.head.repo.full_name != github.repository)
    runs-on: ubuntu-24.04
    timeout-minutes: 240
    steps:
      - uses: actions/checkout@v5
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
          persist-credentials: false

      - id: claude-security
        uses: anthropics/claude-plugins-official/plugins/claude-security@d0d514288960e7a78e1a76e4a3ec694416458726
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          # fail_on: medium

      # Without this step, "Re-run all jobs" posts the comments again.
      - name: Receipt ${{ steps.claude-security.outputs.receipt }}
        if: always()
        run: "true"
  1. Open a PR, not a draft, that adds the workflow file. When the scan ends, it posts one comment review (never an approval or a request for changes). The line under the review's heading says whether the check passes, and why.

  2. To block merges, make the claude-security job a required status check. The default fail_on: high fails on any CRITICAL or HIGH finding. medium also catches MEDIUM, confident-high only high-confidence CRITICAL or HIGH, and never doesn't fail on findings alone.

Draft PRs are scanned only when marked Ready for review, and Dependabot PRs pass with no scan, so review those yourself. To scan the whole repository on a schedule, add the guide's scheduled workflow as a separate file with a different job name. A full scan can take hours and cost much more than a PR review. On a public repository, a review comment can disclose a vulnerability that isn't fixed yet.

Get notified when a new tip lands

Tip alerts only go out in the app. Install it and turn notifications on.

Get the app

All tips →