← cc-guard

Anthropic's Security Review + cc-guard Hooks: Layered Defense

April 21, 2026 · 4 min read

Anthropic released claude-code-security-review — a GitHub Action that uses Claude to scan PRs for security vulnerabilities. It catches SQL injection, XSS, hardcoded secrets, and other OWASP Top 10 issues before code merges.

That's Layer 1: pre-merge defense. But what about the commands Claude Code runs right now, in your terminal, at 3am during an autonomous session?

That's where Layer 2: runtime hooks come in.

The Two Layers

Layer 1: Anthropic Security Review

PR submitted → Claude scans diff → blocks vulnerable code before merge

Layer 2: cc-guard Hooks

Command about to execute → hook inspects → blocks dangerous commands in real-time
AspectSecurity Review (Layer 1)cc-guard Hooks (Layer 2)
WhenAt PR timeAt execution time (real-time)
What it catchesCode vulnerabilities (SQLi, XSS, secrets in code)Dangerous commands (rm -rf, force-push, credential deletion)
What it missesRuntime actions, file deletion, git operationsStatic code vulnerabilities, logic flaws
SpeedMinutes (full PR scan)Milliseconds (pattern match)
ScopeCode changes onlyAll terminal commands + file writes
Token costUses Claude API per reviewZero (bash scripts, no API calls)

What Layer 1 Doesn't Catch

The security review Action is excellent at finding code-level vulnerabilities. But 90 documented incidents show that most Claude Code disasters aren't code vulnerabilities — they're operational actions:

No PR review catches these — they happen in the terminal, between PRs, during autonomous sessions.

Setting Up Both Layers

Layer 1 — Add the official Action to your repo:

# .github/workflows/security-review.yml
name: Security Review
on: [pull_request]
jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: anthropics/claude-code-security-review@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Layer 2 — Install runtime hooks (30 seconds):

npx @gaebalai/cc-guard

That's it. Layer 1 reviews your PRs. Layer 2 blocks dangerous commands in real-time. They don't conflict — they complement.

Why Both Matter

A Stanford/MIT study found 14.3% of AI-generated code contains security vulnerabilities. Layer 1 catches those before merge. But the remaining 85.7% of "safe" code can still be deployed via git push --force to production at 3am — and Layer 2 is the only thing that stops it.

Neither layer alone is enough. Together, they provide defense-in-depth: one guards the code, the other guards the execution.

Get Both Layers

Layer 1: anthropics/claude-code-security-review (official)

Layer 2: npx @gaebalai/cc-guard

Test your Layer 2 — paste your settings.json, see what survives 10 real attacks