Skip to content

Commit 1e82577

Browse files
sarg3ntclaude
andauthored
ci: add anthropics/claude-code-security-review on every PR (#38)
Adds AI-driven security review to the existing static-analysis pipeline (CodeQL, gosec, Trivy, npm audit, gitleaks, Dependency Review, Scorecard). Claude reads the diff and flags auth/authz logic bugs, business-logic flaws, AI-class antipatterns, and prompt-injection vectors that pattern matchers can't catch. Posts inline review comments. Matches the repo's existing security-workflow style: - step-security/harden-runner with audit egress - permissions: {} at workflow level, scoped per-job - concurrency control - third-party actions SHA-pinned per OWASP CI/CD-SEC-2 The action has no tagged releases yet (May 2026), pinned to the head SHA at time of authoring. Bump when v1 is cut. One-time setup in repo settings (documented in the workflow header): 1. Add the CLAUDE_API_KEY repo secret (Anthropic API key with Claude Code entitlement). 2. Actions -> General -> "Require approval for all external contributors" on the fork-PR setting. The repo is PUBLIC and the action is not hardened against prompt injection in untrusted PR diffs. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2104960 commit 1e82577

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# AI-driven security review on every PR, complementing the existing static
2+
# tooling (CodeQL, gosec, Trivy, npm audit, gitleaks, Dependency Review,
3+
# Scorecard). Claude reviews the diff for auth/authz logic bugs, business-
4+
# logic flaws, prompt-injection, and the LLM-class antipatterns from
5+
# Arcanum-Sec/sec-context that pattern matchers can't catch.
6+
#
7+
# One-time setup in repo settings:
8+
# 1. Secrets and variables -> Actions -> New repository secret
9+
# Name: CLAUDE_API_KEY
10+
# Value: Anthropic API key with Claude API + Claude Code entitlement
11+
# (https://console.anthropic.com/settings/keys)
12+
# 2. Actions -> General -> "Fork pull request workflows from outside
13+
# contributors" -> Require approval for all external contributors.
14+
# This repo is PUBLIC -- the action is not hardened against prompt
15+
# injection in untrusted PR diffs, so external forks must be gated
16+
# on maintainer review before the workflow runs.
17+
#
18+
# The action has no tagged releases yet (May 2026); pinned to a SHA per
19+
# OWASP CI/CD-SEC-2. Bump when v1 is cut.
20+
21+
name: claude-security-review
22+
23+
on:
24+
pull_request:
25+
branches: [main]
26+
27+
concurrency:
28+
group: claude-sec-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
29+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
30+
31+
permissions: {}
32+
33+
jobs:
34+
review:
35+
name: Claude Security Review
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: read
39+
pull-requests: write # post inline review comments
40+
steps:
41+
- name: Harden runner
42+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2
43+
with:
44+
egress-policy: audit
45+
46+
- name: Checkout code
47+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
48+
with:
49+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
50+
fetch-depth: 2 # action diffs against the parent commit
51+
52+
- name: Claude Security Review
53+
uses: anthropics/claude-code-security-review@0c6a49f1fa56a1d472575da86a94dbc1edb78eda
54+
with:
55+
comment-pr: true
56+
claude-api-key: ${{ secrets.CLAUDE_API_KEY }}
57+
# Skip non-source paths the static scanners already cover, plus
58+
# generated Go files (templ output) where false positives are common.
59+
exclude-directories: "docs"

0 commit comments

Comments
 (0)