Skip to content
Back to skills

Security Audit

ASecurity

Comprehensive security audit with scored posture assessment

  • 7,588 stars
  • 0 votes
  • 0 copies
  • 9 views
  • Added May 27, 2026
developmentpythonrustgojavaphpbashnodegitapidatabase

Works with

  • claude code
  • api
  • mcp

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add FlorianBruniaux/claude-code-ultimate-guide --skill security-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Security Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Security Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/florianbruniaux-security-audit/badge)](https://www.skillsdirectory.com/skills/florianbruniaux-security-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: security-audit
description: Comprehensive security audit with scored posture assessment
argument-hint: "[path] [--owasp] [--verbose]"
effort: high
disable-model-invocation: true
---

# Security audit

Comprehensive security audit of your project AND Claude Code configuration. Analyzes secrets exposure, injection surfaces, dependencies, hook security, and produces a scored security posture assessment.

**Time**: 2-5 minutes | **Scope**: Full project + Claude Code config

> For a quick config-only check, use `/security-check` instead.

## Instructions

You are a senior application security engineer. Perform a 6-phase security audit and produce a scored report with prioritized remediation plan.

---

### Pre-Step: Establish audit context

**Before running any checks**, use `AskUserQuestion` to ask:

1. **Environment**: Is this code running in production, staging, or local development?
2. **Scope**: Full audit or specific areas to prioritize?

This is critical for accurate findings:
- **Local dev**: `DEBUG=True`, CORS `*`, HTTP without TLS, `.env` files, all normal. Do NOT flag as vulnerabilities. Mention in an "Before going to production" informational section instead.
- **Staging**: Configs should mirror production. Flag deviations as MEDIUM.
- **Production**: Any misconfiguration is a real finding with full severity.

If the user doesn't answer or is unsure, default to **production** (conservative).

---

### Phase 1: Configuration security (via /security-check)

Execute all checks from `/security-check` (the `examples/skills/security-check/SKILL.md` skill). This covers:
- MCP server audit against CVE database
- Skills & agents against known malicious entries
- Hook exfiltration patterns
- Memory poisoning detection
- Permissions & settings review
- Exposed secrets in Claude Code config

Record findings, as they contribute to the final score.

---

### Phase 2: Project secrets scan

Scan the entire project for exposed secrets and credentials.

**Never print secret values.** Keep the `cut` filters below so that only `file:line` reaches the transcript. If you open a match to confirm it, report the location and the secret type, and never quote the value.

```bash
# API keys and tokens
grep -rn --include="*.js" --include="*.ts" --include="*.py" --include="*.go" --include="*.java" --include="*.rb" --include="*.php" --include="*.yaml" --include="*.yml" --include="*.json" --include="*.toml" --include="*.env" --include="*.cfg" --include="*.ini" --include="*.conf" \
  -iE '(api[_-]?key|apikey|secret|password|passwd|token|bearer|auth)\s*[=:]\s*["'\''"][^"'\'']{8,}["'\''"]' \
  --exclude-dir={node_modules,vendor,.git,dist,build,target,__pycache__,.venv} . 2>/dev/null | cut -d: -f1,2 | head -30

# Known provider key patterns
grep -rn -E 'sk-[a-zA-Z0-9]{20,}|sk-ant-[a-zA-Z0-9]{20,}|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|xox[bps]-[a-zA-Z0-9\-]{20,}' \
  --exclude-dir={node_modules,vendor,.git,dist,build,target} . 2>/dev/null | cut -d: -f1,2 | head -20

# Private keys
grep -rn 'BEGIN.*PRIVATE KEY' --exclude-dir={node_modules,vendor,.git} . 2>/dev/null | cut -d: -f1,2

# .env files that might be committed
find . -name ".env*" -not -path "*/node_modules/*" -not -path "*/.git/*" -type f 2>/dev/null

# Check .gitignore coverage
[ -f ".gitignore" ] && {
  grep -q "\.env" .gitignore && echo "✅ .env in .gitignore" || echo "⚠️ .env NOT in .gitignore"
  grep -q "\.pem" .gitignore && echo "✅ .pem in .gitignore" || echo "⚠️ .pem NOT in .gitignore"
  grep -q "\.key" .gitignore && echo "✅ .key in .gitignore" || echo "⚠️ .key NOT in .gitignore"
}
```

**Anti-false-positive rule (MANDATORY before reporting any secret finding):**

Before raising a secrets finding, run these verification commands:

```bash
# 1. Verify .env is actually in .gitignore (if yes, local .env is NOT a finding)
grep -n '\.env' .gitignore 2>/dev/null || echo ".env NOT in .gitignore"

# 2. Verify secrets were actually committed, in any file type
#    (lists commits and file names only, never the values)
git log --all -i -G'(api[_-]?key|secret|password|passwd|token)["'\'']?[[:space:]]*[=:][[:space:]]*["'\'']?[^"'\''[:space:]]{8,}' \
  --format='commit %h' --name-only

# 3. Check git history for provider-specific patterns, anywhere on a line
git log --all -G'sk-[a-zA-Z0-9]{20,}|sk-ant-[a-zA-Z0-9_-]{20,}|AKIA[A-Z0-9]{16}|ghp_[a-zA-Z0-9]{36}' \
  --format='commit %h' --name-only
```

Report a committed secret only if you have **concrete proof from these commands**. Check each listed file without quoting the value. These patterns do not cover every secret format, so empty output does not clear a Phase 2 match in a tracked file: inspect that match. If a `git` command fails (not a repository, for example), mark the history check `NOT VERIFIED` and keep the Phase 2 matches. A `.env` file present locally is not a finding if it's in `.gitignore`. Never report "secrets may be exposed" based on pattern matching alone.

**Scoring:**
- 0 secrets found → +20 points
- 1-3 secrets → +10 points
- 4+ secrets → 0 points
- Private key committed → -10 points

---

### Phase 3: Prompt injection surface

Analyze markdown and config files for injection vectors:

```bash
# Zero-width characters (invisible instructions)
grep -rPn '[\x{200B}-\x{200D}\x{FEFF}]' --include="*.md" --include="*.yaml" --include="*.json" . 2>/dev/null

# Hidden HTML comments with instructions
grep -rn '<!--' --include="*.md" . 2>/dev/null | grep -i 'ignore\|system\|admin\|instruction\|override\|forget'

# Base64 in comments (potential hidden payloads)
grep -rn -E '[#;].*[A-Za-z0-9+/]{20,}={0,2}' --include="*.py" --include="*.js" --include="*.ts" --include="*.md" \
  --exclude-dir={node_modules,vendor,.git} . 2>/dev/null | head -10

# ANSI escape sequences
grep -rPn '\x1b\[|\x1b\]|\x1b\(' --exclude-dir={node_modules,vendor,.git} . 2>/dev/null | head -10

# Null bytes
grep -rPn '\x00' --exclude-dir={node_modules,vendor,.git,dist} . 2>/dev/null | head -5

# Nested command execution in markdown/config
grep -rn -E '\$\([^)]+\)|`[^`]+`' --include="*.md" --include="*.yaml" --include="*.json" \
  --exclude-dir={node_modules,vendor,.git} . 2>/dev/null | head -10
```

**Scoring:**
- 0 injection vectors → +15 points
- 1-2 vectors (likely false positives) → +10 points
- 3+ vectors → +5 points
- Confirmed injection in CLAUDE.md → 0 points

---

### Phase 4: Dependency audit

Run the appropriate package audit for the project:

```bash
# Report a missing, silent, or failing audit tool. Keep stderr: errors must stay visible.
run_audit() {
  command -v "${1}" >/dev/null 2>&1 || { echo "NOT RUN: ${1} is not installed"; return; }
  out=$("$@" 2>&1); rc=$?
  printf '%s\n' "$out" | tail -20
  echo "'$*' exit status: $rc"
  [ -n "$out" ] || { echo "NOT RUN: '$*' printed nothing"; return; }
  # A non-zero status means findings or a broken run: only a printed result tells them apart
  [ "$rc" -eq 0 ] || printf '%s\n' "$out" | grep -qE '(Found [0-9]+ known vulnerabilit|[0-9]+ vulnerabilit(y|ies) found|affected by [0-9]+ vulnerabilit)' ||
    echo "NOT RUN: '$*' failed without printing a vulnerability result"
}

# Node.js
[ -f "package-lock.json" ] && { npm audit --json | jq -e '.metadata.vulnerabilities // empty' || echo "NOT RUN: npm audit returned no vulnerability summary"; }

# Python
[ -f "requirements.txt" ] && run_audit pip-audit -r requirements.txt
[ -f "pyproject.toml" ] && run_audit pip-audit

# Rust
[ -f "Cargo.toml" ] && run_audit cargo audit

# Go
[ -f "go.mod" ] && run_audit govulncheck ./...
```

If no package manager detected, note it and skip (no penalty).

**A failed audit is not a clean one.** Count zero vulnerabilities only when an audit printed a result that says so. If a tool shows `NOT RUN`, prints an error instead of a result, or no command above covers a detected package manager (`yarn.lock` or `pnpm-lock.yaml` only, for example), mark Dependencies `NOT RUN` with the reason, award it no points, and report the total as partial, out of 80, with no grade.

**Scoring:**
- 0 vulnerabilities → +20 points
- 0 critical + 0 high → +15 points
- 1-3 high → +10 points
- Any critical → +5 points
- 10+ high or 3+ critical → 0 points

---

### Phase 5: Hook security assessment

Verify security hooks from `guide/security/security-hardening.md` are properly installed:

```bash
# Check for recommended security hooks
echo "=== Checking security hooks ==="

# Hooks are declared under the "hooks" key of settings files, not by file name
for f in .claude/settings.json .claude/settings.local.json ~/.claude/settings.json; do
  [ -f "$f" ] && echo "$f:" && jq -r '.hooks // {} | to_entries[] | "  \(.key): \(.value | length) matcher group(s)"' "$f" 2>/dev/null
done

# Hook scripts present on disk
find .claude/hooks ~/.claude/hooks -type f 2>/dev/null

# Look for a prompt injection detector or output scanner among them
find . -path "*/hooks/*injection*" -o -path "*/hooks/*security*" -o -path "*/hooks/*scanner*" 2>/dev/null
```

**Scoring:**
- PreToolUse security hooks declared in settings → +10 points
- PostToolUse output scanner declared in settings → +5 points
- Prompt injection detector hook → +5 points
- No hooks at all → 0 points

---

### Phase 6: Posture score & report

Calculate total score and generate report.

**Scoring Breakdown:**

| Category | Max Points | Source |
|----------|-----------|--------|
| Config Security (Phase 1) | 30 | /security-check results |
| Secrets Scan (Phase 2) | 20 | Secrets found in project |
| Injection Surface (Phase 3) | 15 | Injection vectors found |
| Dependencies (Phase 4) | 20 | Vulnerability audit |
| Hook Security (Phase 5) | 15 | Security hooks installed |
| **Total** | **100** | |

**Phase 1 scoring detail:**
- 0 CRITICAL findings → +15 points
- 0 HIGH findings → +10 points
- 0 MEDIUM findings → +5 points
- Any CRITICAL → 0 for that sub-score

**Grade Scale:**

| Score | Grade | Meaning |
|-------|-------|---------|
| 90-100 | A | Excellent: production-ready security posture |
| 75-89 | B | Good: minor improvements recommended |
| 60-74 | C | Acceptable: address HIGH issues before production |
| 40-59 | D | Poor: significant security gaps |
| 0-39 | F | Critical: do not deploy, address CRITICAL issues immediately |

## Output format

```
## 🛡️ Security Audit Report

**Date**: [timestamp]
**Project**: [directory name]
**Scope**: Full project + Claude Code configuration

### Security Posture Score: [XX]/100 (Grade [X])

[1-sentence assessment]

### Phase Results

| Phase | Score | Max | Key Finding |
|-------|-------|-----|-------------|
| 1. Config Security | XX | 30 | [summary] |
| 2. Secrets Scan | XX | 20 | [summary] |
| 3. Injection Surface | XX | 15 | [summary] |
| 4. Dependencies | XX | 20 | [summary] |
| 5. Hook Security | XX | 15 | [summary] |
| **Total** | **XX** | **100** | |

### 🔴 Critical Findings
[Each finding with location, description, and exact fix]

### 🟠 High Findings
[Each finding with location, description, and fix]

### 🟡 Medium Findings
[Each finding with location, description, and fix]

### 🔧 Remediation Plan (Priority Order)

| # | Action | Severity | Effort | Command/Steps |
|---|--------|----------|--------|---------------|
| 1 | [action] | CRITICAL | [time] | [how] |
| 2 | [action] | HIGH | [time] | [how] |
| ... | | | | |

### 📊 Benchmark

Your score vs security-hardening.md recommendations:
- [X] items from the guide are implemented
- [X] items are missing
- Top 3 missing items to implement next: [...]

### 📚 References
- Security hardening guide: guide/security/security-hardening.md
- Threat database: examples/commands/resources/threat-db.yaml
- Quick check: `/security-check`
- MCP scan tool: `uvx snyk-agent-scan@latest` (Snyk Agent Scan, formerly mcp-scan)
```

$ARGUMENTS

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.