{"slug": "claude-security-github-action-scan-pull-requests-before-merge", "title": "Claude Security GitHub Action: Scan Pull Requests Before Merge", "summary": "Anthropic's Claude Security plugin now includes a GitHub Actions workflow that scans pull request diffs, posts security review comments, and can block merges when findings exceed a configurable `fail_on` severity threshold, per documentation refreshed November 30 and surfaced December 1, 2026. The workflow triggers on `pull_request` events (opened, synchronize, reopened, ready_for_review, edited), runs on `ubuntu-24.04` with a 240-minute timeout, authenticates via an `ANTHROPIC_API_KEY` repository secret, and fails by default on fork PRs, with API usage billed to the secret owner. Anthropic's docs warn that text on the PR branch can steer the scan and the scan may execute branch code, so anyone who can push can also edit the workflow and spend the API key.", "body_md": "**Anthropic's Claude Security plugin now ships a GitHub Actions workflow that scans pull request changes, posts a security review, and can block merges when findings exceed your threshold.** Official instructions live in [Scan your codebase for vulnerabilities](https://code.claude.com/docs/en/claude-security?ref=explainx) on Claude Code Docs and in [plugins/claude-security/CI.md](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/claude-security/CI.md?ref=explainx) inside [anthropics/claude-plugins-official](https://github.com/anthropics/claude-plugins-official?ref=explainx).\n\nThis is **not** the standalone Claude Mythos enterprise monitoring product. It is the **open plugin** developers install with `/plugin install claude-security@claude-plugins-official` and can mirror in CI.\n\n## TL;DR\n\n| Question | Answer | \n|---|---|\n| **Trigger** | `pull_request` types opened, synchronize, reopened, ready_for_review, edited | \n| **Runner** | `ubuntu-24.04` GitHub-hosted Linux | \n| **Credential** | `ANTHROPIC_API_KEY` repository secret | \n| **Action source** | `anthropics/claude-plugins-official/plugins/claude-security` | \n| **Fork PRs** | Fail by default | \n| **Merge block** | Set `fail_on` and make the job a required check | \n| **Billing** | API usage on the secret owner | \n\nRisk gauge illustrates severity gates for Claude Security pull request scans\n\n*Image: Library illustration · security severity framing*\n\n## What Anthropic added for CI\n\nClaude Security already ran **multi-agent hunts** inside a **Claude Code session**. The **November 30 documentation refresh** (surfaced widely December 1, 2026) adds a **first-class GitHub Actions path** with:\n\n- \n**Pull request review mode** — scans**only the PR diff** , posts review comments, optional**suggested patches** in a follow-up job when`suggest_patches: later` .\n- \n**Scheduled full-repo scan** — optional second mode for**baseline hunts** ; PR mode is what most product teams adopt first.\n\nAnthropic's docs emphasize **trust boundaries**: text on the PR branch can **steer** the scan, and the scan may **execute** code from the branch. **Anyone who can push** can also edit the workflow and spend the **API key**.\n\n## Official workflow skeleton\n\nSave `.github/workflows/claude-security.yml` per CI.md. Critical defaults:\n\n```\nname: Claude Security plugin\n\non:\n  pull_request:\n    types: [opened, synchronize, reopened, ready_for_review, edited]\n\npermissions:\n  actions: read\n  contents: read\n  pull-requests: write\n\njobs:\n  claude-security:\n  # Anthropic recipe skips merge_group and some dependabot cases — keep upstream conditions.\n    runs-on: ubuntu-24.04\n    timeout-minutes: 240\n    steps:\n      - uses: actions/checkout@v5\n        with:\n          ref: ${{ github.event.pull_request.head.sha }}\n          fetch-depth: 0\n          persist-credentials: false\n\n      - id: claude-security\n        uses: anthropics/claude-plugins-official/plugins/claude-security\n        with:\n          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}\n          suggest_patches: later\n```\n\n**Concurrency** groups in the official file cancel overlapping runs on the same PR except when the base branch changes — copy the full block from CI.md when you ship.\n\n## fail_on and merge gates\n\nCI.md documents **`fail_on`** severity gates:\n\n| Value | Behavior | \n|---|---|\n| **high** (default) | Fails on any CRITICAL or HIGH | \n| **confident-high** | CRITICAL or HIGH with high confidence only | \n| **medium** | Includes MEDIUM | \n| **any** | Any finding fails | \n| **never** | Findings never fail the job | \n\nTo **block merges**, turn the job into a **required status check** in GitHub branch protection after you trust the false-positive rate.\n\nTeams already running **[parallel Claude Code QA agents](https://explainx.ai/blog/mobile-agent-testers-claude-code-github-actions-parallel-qa-november-2026)** can stack this job **after** unit tests but **before** human security review.\n\n## Limits and warnings you must read\n\nAnthropic lists hard limits in CI.md and the security doc page:\n\n- \n**No merge queue support** — uncomment merge_group skip; queued merges count as pass when skipped.\n- \n**No push-event scans** in the PR workflow — use scheduled scan mode for default-branch baselines.\n- \n**Prompt injection** — the older[claude-code-security-review](https://github.com/anthropics/claude-code-security-review?ref=explainx) README states the action is**not hardened** against injection; only scan**trusted PRs** .\n- \n**Public repo disclosure** — job summaries may leak**actionable vulns** ; run locally for zero-disclosure needs.\n- \n**Draft PRs** — pass with**no scan** until marked ready; Dependabot PRs may also skip per sample workflow comments.\n\nThese constraints align with **[Anthropic siren honeypot lessons](https://explainx.ai/blog/anthropic-siren-honeypot-agent-sandbox-escape-november-2026)**: agents follow **plausible malicious context** unless your **harness** contains them.\n\nJailbreak lock pick motif highlights untrusted pull request prompt-injection risk\n\n*Image: Library illustration · exploit review metaphor*\n\n## How this fits other Claude security layers\n\nAnthropic documents **three layers**:\n\n1. \n**Security guidance plugin** — nudges while Claude writes code.\n2. \n**Code Review** — human-oriented PR commentary inside Claude Code.\n3. \n**Claude Security** — multi-agent vuln hunt with**independent verification** before reporting.\n\nThis GitHub Action is **layer three in CI**, not a replacement for **[MCP server hardening](https://explainx.ai/blog/what-is-mcp-model-context-protocol-guide)** or **[AgentBeam-style agent monitoring](https://agentbeam.com/blog/ai-agent-security-monitoring-coding-agents?ref=explainx)** when agents touch production.\n\nCompare with **[OpenAI Codex security open sourcing](https://explainx.ai/blog/openai-codex-security-cli-sdk-open-source-july-2026)** for a different vendor pattern: OpenAI shipped CLI tooling; Anthropic ships a **marketplace plugin** with **Actions glue**.\n\n## Setup checklist for platform teams\n\n1. \n**Create a dedicated API key** with spend caps for CI — not a developer laptop key.\n2. \n**Pin the marketplace commit** CI.md references when you need reproducibility (`d0d514288960e7a78e1a76e4a3ec694416458726` appears in docs for v0.13.0 migrations).\n3. \n**Require approval for outside contributors** on public repos so fork PRs never hit the scanner with untrusted payloads.\n4. \n**Start with `fail_on: never`** for two weeks; collect precision metrics, then tighten.\n5. \n**Log findings** to your SIEM; GitHub comments alone do not satisfy**[SOC-style retention](https://explainx.ai/blog/nist-nsa-cisa-ten-practices-si-control-incident-rogue-agents-evidence-no-retention-clock-2026)** requirements.\n6. \nPair with **[stacked PR workflows](https://explainx.ai/blog/github-stacked-pull-requests-public-preview-july-2026)** carefully — each stack layer triggers another scan; use concurrency rules.\n\n## Cost and performance expectations\n\nDocs quote **minutes to tens of minutes** per PR depending on diff size, and **hours** for full-repo scheduled scans. `timeout-minutes: 240` in the sample workflow is intentional.\n\nAPI spend scales with:\n\n- \n**Diff size** (more files, more agent rounds).\n- \n**`change_scan_effort: high`** optional input for deeper search.\n- \n**Patch suggestion second job** when enabled.\n\nFinance leads should treat this like **another CI bot**, not a **seat on Claude Max**.\n\n## Threat model for AI-on-AI reviews\n\nAttackers may embed **prompt injection** in:\n\n- \nSource comments newly added in the PR.\n- \nTest fixtures interpreted as instructions.\n- \nMalicious **build scripts** executed if the scan runs them.\n\nMitigations from Anthropic plus standard AppSec hygiene:\n\n- \n**Restrict who can trigger workflows** on forks.\n- \n**Run in isolated runners** without production secrets.\n- \n**Never** mount cloud credentials into Claude Security jobs on external contributor PRs.\n\nOur **[Railway engineer agent probe story](https://explainx.ai/blog/railway-engineer-ai-agents-primcloud-port-scan-secrets-request-claimed-vs-verified-2026)** shows how quickly **agent tools** jump from **lint** to **recon** when prompts go off-script.\n\n## Enterprise vs consumer paths\n\nAnthropic notes that **managed Claude Security on Mythos** targets **Enterprise** buyers who want **vendor-operated monitoring**, while the **plugin plus GitHub Action** targets **teams that already run Claude Code** and own their **API billing**.\n\nIf your organization standardizes on **Microsoft Copilot Studio** for low-code automation but lets engineering use **Claude Code**, place this Action **only on application repos**, not on workflow repos business users edit without security review.\n\nLegal should also read **[Anthropic commercial terms](https://www.anthropic.com/legal/commercial-terms?ref=explainx)** for **data retention** on API calls triggered by CI. Session scans and Actions scans may fall under **different subprocessors** than **Chat consumer** accounts.\n\n## Scheduled scans vs pull request scans\n\nCI.md contrasts modes:\n\n| Mode | Scope | Output | \n|---|---|---|\n| **Pull request review** | Diff only | PR review comments plus optional patches | \n| **Scheduled scan** | Whole repository | Job summary report | \n\nMost teams start with **PR mode** to catch **regressions** before merge, then add **weekly scheduled** jobs on **main** to find **legacy debt**. Scheduled jobs take **longer** and cost more tokens because agents **map architecture** from scratch.\n\nWhen you adopt both, **deduplicate findings** in your tracker so developers do not ignore **duplicate comments** across modes.\n\n## Second job for suggested patches\n\nWhen `suggest_patches: later`, the workflow can spawn a **follow-up job** that consumes the **report artifact** from the first job and posts **patch proposals**. Anthropic separates jobs so you can **fail fast** on discovery without waiting for **patch generation**.\n\nPlatform tip: store the **report JSON** as an artifact even if you disable patch suggestions, so security engineers can **replay** findings after incidents.\n\n## When not to use the Action\n\nSkip or delay CI deployment when:\n\n- \nYou cannot **trust every pusher** (open source with drive-by PRs).\n- \n**Disclosure** of a finding in a public Actions log is**unacceptable** .\n- \nYou are on **GitHub Enterprise Server** — unsupported.\n- \nYou need **merge queue** scanning — not supported yet.\n\nLocal `/security-review` inside Claude Code remains the **private** path docs recommend for **embargoed** fixes.\n\n## Permissions block in the sample workflow\n\nAnthropic keeps **permissions** narrow on purpose:\n\n- \n`pull-requests: write` lets the job**post review comments** .\n- \n`contents: read` avoids granting**write** unless a patch job needs it.\n- \n`actions: read` supports**artifact** retrieval between jobs.\n\nDo **not** widen to `contents: write` on the discovery job; patch application should stay **human-approved** or in a **separate hardened job** with **CODEOWNERS** gates.\n\n## Pairing with Claude Code locally\n\nTeams often run **three passes** on risky features:\n\n1. \n**Security guidance plugin** while authoring.\n2. \n**Local `/security-review`** before pushing.\n3. \n**GitHub Action** on the PR.\n\nDocument that sequence in your **contributing.md** so junior developers know **which step blocks merge**. Link your internal runbook to Anthropic's [support article on automated security reviews](https://support.claude.com/en/articles/11932705-automated-security-reviews-in-claude-code?ref=explainx).\n\n## Version migration note\n\nDocs mention pinning **`anthropics/claude-plugins-official`** at commit **` d0d514288960e7a78e1a76e4a3ec694416458726`** when moving to plugin **0.13.0**. Platform teams should **bump intentionally**: each marketplace update can change **default graders** inside the plugin.\n\nAfter upgrades, replay a **known vulnerable test branch** to confirm **fail_on** still triggers.\n\n## Draft pull requests and ready_for_review\n\nAnthropic includes **`ready_for_review`** in the trigger list so **draft PRs** do not burn tokens until authors mark them ready. Product teams using **draft-first** culture should document that **security scans start only after ready**, avoiding noisy comments on WIP branches.\n\nIf you use **GitHub's converted-to-draft** flow during incident response, expect **another scan** when the PR returns to ready — budget API spend accordingly.\n\nSecurity champions should paste the official **warning block** from CI.md into internal docs so contractors know **fork PRs fail by design**, not because the pipeline is broken.\n\n## Related reading on explainx.ai\n\n*Workflow fields, version pins, and trust warnings reflect Anthropic documentation checked December 1, 2026.*", "url": "https://wpnews.pro/news/claude-security-github-action-scan-pull-requests-before-merge", "canonical_source": "https://explainx.ai/blog/claude-security-github-action-pull-request-scan-december-2026?utm_source=rss&utm_medium=feed&utm_campaign=blog", "published_at": "2026-12-01 00:00:00+00:00", "updated_at": "2026-12-01 02:12:49.753507+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-safety"], "entities": ["Anthropic", "Claude Security", "GitHub Actions", "Claude Code", "anthropics/claude-plugins-official", "Claude Mythos"], "also_reported_by": [], "takeaway": "Install the claude-security plugin's GitHub Actions workflow with `fail_on` set to `high` (the default) or `confident-high`, then make the job a required status check in branch protection to block merges on CRITICAL or HIGH findings.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/claude-security-github-action-scan-pull-requests-before-merge", "markdown": "https://wpnews.pro/news/claude-security-github-action-scan-pull-requests-before-merge.md", "text": "https://wpnews.pro/news/claude-security-github-action-scan-pull-requests-before-merge.txt", "jsonld": "https://wpnews.pro/news/claude-security-github-action-scan-pull-requests-before-merge.jsonld"}}