# Claude Security plugin on GitHub pull requests: setup, the setting that blocks merges, and cost

> Add one workflow file and an API key, make the job a required check, and Claude Security fails PRs with HIGH or CRITICAL findings. It needs the API, not a Claude plan.

Published 2026-12-01 · https://smarterthanus.ai/claude-security-github-action-block-merges/

## TL;DR

- The Claude Security plugin now runs as a GitHub Action: it scans a pull request's change, posts a review with suggested fixes, and **fails the job on any HIGH or CRITICAL finding** by default.
- The failed job only blocks the merge if you make it a **required status check** in your branch rules.
- It can't sign in with a Claude Pro or Max plan: it needs a **Claude API key** (or Bedrock, Google Cloud or Foundry) and a GitHub-hosted Linux runner on GitHub.com.
- The default model is Fable, at **$8/$40 per million tokens** in and out; Anthropic says Fable costs several times as much as Opus for whole-repository scans.

To scan pull requests with Claude Security, you add one workflow file to `.github/workflows/`, save a **Claude API key** as a repository secret, and then make the job a required status check. After that, most pull requests get an AI security review with suggested fixes (drafts, Dependabot and fork pull requests are exceptions, covered below). By default, any finding rated HIGH or CRITICAL fails the check and blocks the merge. You can't use a Claude Pro or Max subscription for this, the scan only runs on GitHub-hosted Linux runners, and pull requests from forks fail unless you change a setting.

The [Claude Code docs](https://code.claude.com/docs/en/claude-security) describe a GitHub Actions job for the Claude Security plugin that scans pull requests. The [plugin's page](https://claude.com/plugins/claude-security) says it can review pull requests with a GitHub Action and that it's still in beta. Everything below comes from the [plugin docs](https://code.claude.com/docs/en/claude-security) and its [GitHub Actions guide, CI.md](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/CI.md). We haven't run it ourselves.

## What it does on a pull request

The job scans only the **pull request's change**. Several agents look for flaws, other agents check each finding independently, and the job then posts one comment review. That review never approves a pull request and never requests changes. A line under its heading says whether the check passed and why.

With the sample workflow, a second job posts suggested fixes later. On a small pull request that takes **about 9 to 13 minutes** after the first review. AI agents write the fixes, so read each one before you commit it. A scan takes minutes to tens of minutes depending on how big the pull request is. The job's time limit is 240 minutes.

You can also add a second workflow that scans the **whole repository** on a schedule. That catches flaws in code merged before you installed the action. It writes a report to the job summary but suggests no fixes, and it can take hours.

The plugin is separate from Anthropic's [Code Review](https://code.claude.com/docs/en/code-review.md), which reviews pull requests for correctness and security on the Team and Enterprise plans. It's also separate from the managed Claude Security product on the Enterprise plan. If you're deciding between paying per seat and paying per review, we compared the two models in [AI code review pricing: $24 a seat vs $1 a review](https://smarterthanus.ai/ai-code-review-pricing-seat-vs-credit/).

## Before you add it: three checks

1. **Everyone who can push must be trusted.** CI.md is blunt about this: text in a pull request can steer the scan, the scan can run the pull request's code, and anyone who can push can edit the workflow and use its model credential.
2. **Public repos can leak live vulnerabilities.** The review, the job summary and the report artifact are visible to anyone who can see the repo. To keep findings private, scan in your own Claude Code session instead (`/claude-security scan my branch`).
3. **Your setup has to be supported.** That means GitHub.com with GitHub-hosted Linux runners. GHE.com, GitHub Enterprise Server, merge queues and `push` triggers aren't supported.

## Set it up in four steps

**1. Create a scoped API key.** In the [Claude Console](https://platform.claude.com/docs/en/get-api-key), create a workspace for this job alone, set a **monthly spend limit** on it, and create a key scoped to that workspace. CI.md warns that unscoped keys fail with HTTP 400. Save the key as the repository secret `ANTHROPIC_API_KEY` (Settings → Secrets and variables → Actions). The guide also covers keyless workload identity federation, Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry.

**2. Allow the actions.** If your organization only allows listed actions, add `anthropics/claude-code-action`, `oven-sh/setup-bun` and `actions/upload-artifact`.

**3. Add the workflow.** Save it as `.github/workflows/claude-security.yml`. Below is a shortened version of the sample in CI.md: it keeps the essentials and drops the second job that posts suggested fixes. Copy the full file from CI.md if you want fixes in a separate job.

```yaml
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:   # make this job the required status check
    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@<full-commit-sha>
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          # fail_on: high          # the default; see the table below
      - name: Receipt ${{ steps.claude-security.outputs.receipt }}
        if: always()
        run: "true"
```

Pin the action to a full commit SHA, not a branch. CI.md warns that the action runs with `sudo`. The Claude Code docs give `d0d514288960e7a78e1a76e4a3ec694416458726` as the commit for version 0.13.0, so check the plugin's docs page for the latest one. Keep the Receipt step: without it, "Re-run all jobs" posts the review a second time.

**4. Test it, then require it.** Open a pull request (not a draft) that adds the file. To see the check fail, CI.md suggests adding an obvious flaw to code your product actually runs, such as a shell command built from a request parameter. A flaw in unused code may not be reported. Remove the flaw before merging. Then add `claude-security` as a required status check in your branch protection rules or ruleset. Without that step, a failed scan is only a red X, and anyone can still merge.

## Which setting blocks the merge

`fail_on` decides which findings fail the job:

| `fail_on` | Fails the job on |
| --- | --- |
| `confident-high` | CRITICAL or HIGH findings with high confidence |
| `high` (default) | any CRITICAL or HIGH finding |
| `medium` | any CRITICAL, HIGH or MEDIUM finding |
| `any` | any finding |
| `never` | no finding |

Most teams should keep `high`. `medium` catches more flaws but blocks more merges. `confident-high` lets a real HIGH finding through if the agents aren't sure about it. AI agents assign both severity and confidence, and CI.md says **both can change between runs**. The docs also say two scans of the same code can find different things.

The job also fails when the scan itself goes wrong. An unverified report, or a scan that lost agents, fails the job at every level except `never`. A scan that fails outright, or leaves no complete report, fails it even under `never`.

## What passes without a scan

Know these gaps before you rely on the check:

- **Drafts** pass with no scan until they're marked ready for review. Set `scan_drafts: "true"` to scan them anyway.
- **Dependabot** pull requests from your own repository pass with no scan, so review them yourself.
- **Forks** fail by default. `dangerously_scan_external_branches: true` changes that, and CI.md advises against it. Keep "Send secrets to workflows from pull requests" turned off.
- **Skipped runs count as passing.** Don't add your own `if:` condition that skips external branches, or fork pull requests will get through unchecked.
- A required check can turn green on a commit whose scan failed, for example after a manual run. Keep scheduled scans in a separate workflow with a different job name.

The scan itself runs in a sandbox with no network access and no job token. It also doesn't load your repository's Claude Code settings, hooks, skills or MCP servers. A clean review doesn't prove the code has no flaws.

## What it costs

Anthropic lists no charge for the plugin itself. You pay for the model tokens it uses, billed to whichever account owns the job's credential. Anthropic publishes **no per-scan price**, and the docs only say a scan "may use a significant number of tokens." Claude API prices, checked 1 December 2026:

| Model (action `model` input) | Input per million tokens | Output per million tokens |
| --- | --- | --- |
| Fable 5.2 (`fable`, the default) | $8 | $40 |
| Opus 5.5 (`opus`) | $4 | $20 |
| Sonnet 5.5 | $2 | $10 |

Source: [Claude API pricing](https://platform.claude.com/docs/en/about-claude/pricing). Anthropic recommends Fable but says Sonnet 5.5 or Opus 5.5 "also performs well on smaller pull-request scans." It also suggests a final Fable scan before merging. For a whole-repository scan, CI.md says Fable "costs several times as much as Opus," which is why its scheduled sample uses `model: opus`. `fast_mode: "true"` runs the same model faster at about twice the price per token.

To keep the bill in check:

- set a spend limit on the workspace the key belongs to;
- keep `change_scan_effort` at `low` (the default);
- try `model: opus` on everyday pull requests;
- check how long your first runs take, and what they cost, in the Console.

For how these API rates compare with Claude's subscription plans, see [Claude pricing 2026](https://smarterthanus.ai/claude-pricing-2026-plans-api-claude-code/).

## Optional: send findings to GitHub code scanning

Each scan also writes its findings as a SARIF 2.1.0 file, classified by CWE. To see them as code scanning alerts, add `security-events: write` to the workflow's permissions. Then add the two steps from CI.md's "Code scanning" section: one finds the report, and one uploads it with `github/codeql-action/upload-sarif@v4`.

Related on Smarter Than Us: [Copilot code review's new tiers](https://smarterthanus.ai/copilot-code-review-lite-balanced-max-tiers/).

## Sources

- [Scan your codebase for vulnerabilities (Claude Code docs)](https://code.claude.com/docs/en/claude-security)
- [Claude Security plugin: CI.md, the GitHub Actions guide](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/CI.md)
- [Claude Security plugin: action.yml (inputs and defaults)](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/action.yml)
- [Claude Security plugin: README](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/claude-security)
- [Claude Security plugin page (Claude plugins)](https://claude.com/plugins/claude-security)
- [Claude API pricing](https://platform.claude.com/docs/en/about-claude/pricing)
