|
| 1 | +--- |
| 2 | +name: security-scan |
| 3 | +description: Run a multi-tool security scan — AgentShield for Claude config, zizmor for GitHub Actions, and optionally Socket CLI for dependency scanning. Produces an A-F graded security report. |
| 4 | +--- |
| 5 | + |
| 6 | +# Security Scan |
| 7 | + |
| 8 | +Multi-tool security scanning pipeline for the repository. |
| 9 | + |
| 10 | +## When to Use |
| 11 | + |
| 12 | +- After modifying `.claude/` config, settings, hooks, or agent definitions |
| 13 | +- After modifying GitHub Actions workflows |
| 14 | +- Before releases (called as a gate by the release pipeline) |
| 15 | +- Periodic security hygiene checks |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +See `_shared/security-tools.md` for tool detection and installation. |
| 20 | + |
| 21 | +## Process |
| 22 | + |
| 23 | +### Phase 1: Environment Check |
| 24 | + |
| 25 | +Follow `_shared/env-check.md`. Initialize a queue run entry for `security-scan`. |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +### Phase 2: AgentShield Scan |
| 30 | + |
| 31 | +Scan Claude Code configuration for security issues: |
| 32 | + |
| 33 | +```bash |
| 34 | +pnpm exec agentshield scan |
| 35 | +``` |
| 36 | + |
| 37 | +Checks `.claude/` for: |
| 38 | +- Hardcoded secrets in CLAUDE.md and settings |
| 39 | +- Overly permissive tool allow lists (e.g. `Bash(*)`) |
| 40 | +- Prompt injection patterns in agent definitions |
| 41 | +- Command injection risks in hooks |
| 42 | +- Risky MCP server configurations |
| 43 | + |
| 44 | +Capture the grade and findings count. |
| 45 | + |
| 46 | +Update queue: `current_phase: agentshield` → `completed_phases: [env-check, agentshield]` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +### Phase 3: Zizmor Scan |
| 51 | + |
| 52 | +Scan GitHub Actions workflows for security issues. |
| 53 | + |
| 54 | +See `_shared/security-tools.md` for zizmor detection. If not installed, skip with a warning. |
| 55 | + |
| 56 | +```bash |
| 57 | +zizmor .github/ |
| 58 | +``` |
| 59 | + |
| 60 | +Checks for: |
| 61 | +- Unpinned actions (must use full SHA, not tags) |
| 62 | +- Secrets used outside `env:` blocks |
| 63 | +- Injection risks from untrusted inputs (template injection) |
| 64 | +- Overly permissive permissions |
| 65 | + |
| 66 | +Capture findings. Update queue phase. |
| 67 | + |
| 68 | +--- |
| 69 | + |
| 70 | +### Phase 4: Grade + Report |
| 71 | + |
| 72 | +Spawn the `security-reviewer` agent (see `agents/security-reviewer.md`) with the combined output from AgentShield and zizmor. |
| 73 | + |
| 74 | +The agent: |
| 75 | +1. Applies CLAUDE.md security rules to evaluate the findings |
| 76 | +2. Calculates an A-F grade per `_shared/report-format.md` |
| 77 | +3. Generates a prioritized report (CRITICAL first) |
| 78 | +4. Suggests fixes for HIGH and CRITICAL findings |
| 79 | + |
| 80 | +Output a HANDOFF block per `_shared/report-format.md` for pipeline chaining. |
| 81 | + |
| 82 | +Update queue: `status: done`, write `findings_count` and final grade. |
0 commit comments