Security Verify — Verification Workflows
Run security verification checks: pattern scanning, OWASP compliance, and vulnerability assessment.
Usage
/security-verify # Default: run scan mode
/security-verify scan [path] # Pattern-based security scanning (SAST)
/security-verify dast <url> # Dynamic testing against running app (DAST)
/security-verify owasp # OWASP Top 10 compliance check
/security-verify assess # Vulnerability CVSS scoring + remediation
/security-verify audit # Adversarial logic-level code review (CWE + CVSS + exploit)
/security-verify full # scan + audit combined (use for /health or manual deep check)
Mode: scan
Run pattern-based security scanning against the codebase.
What It Checks
- Secret Detection — Hardcoded credentials, API keys, private keys
- SQL Injection — String interpolation in queries, raw SQL
- XSS — Disabled auto-escaping, innerHTML, unsafe template filters
- Command Injection — Unsafe subprocess/exec patterns
- Insecure Deserialization — Unsafe deserializers
- Weak Cryptography — MD5, SHA1, weak random for security use
- Multi-Tenant Violations — tenant_id from request, missing tenant filters
- Cookie Issues — Missing __Host- prefix, missing samesite
Scan Execution
Run the scanner script against target path:
# Full scan — manual usage, scans entire directory
bash "$HOME/.claude/skills/security-verify/lib/scanner-runner.sh" "${TARGET_PATH:-.}"
# Staged-only scan — pre-commit context, scans only git-staged files
bash "$HOME/.claude/skills/security-verify/lib/scanner-runner.sh" --staged
Use --staged when invoked from /pre-commit to limit scope to the current commit's changes.
Full-path scanning is for standalone audits.
Review findings, assess severity, and provide fix recommendations.
Dependency Audit
After pattern scan, check for known CVEs:
# Use filtered requirements file to audit only public packages.
if command -v uv &>/dev/null && ([ -f uv.lock ] || [ -f pyproject.toml ]); then
if uv export --no-hashes --frozen > /tmp/raw-reqs.txt 2>/dev/null; then :; else
uv run pip freeze > /tmp/raw-reqs.txt 2>/dev/null || true
fi
uv run --with pip-audit pip-audit -r /tmp/pip-audit-reqs.txt 2>/dev/null || true
elif command -v pip-audit &>/dev/null; then
pip-audit --local 2>/dev/null || true
else
echo "pip-audit not installed"
fi
npm audit --production 2>/dev/null || echo "No package.json"
Report Format
Generate a markdown report with severity counts, findings with file:line references, and fix recommendations.
Mode: dast
Dynamic Application Security Testing against a running application. Tests live HTTP endpoints rather than reading source files.
Prerequisites
- Application must be running and accessible at the provided URL
curl (always available, zero extra deps)
nuclei (optional, for deeper template-based scanning): brew install nuclei
python3 (required if using --nuclei, for JSON parsing)
What It Checks
Tier 1 — curl-based (always runs):
| # |
Category |
What it checks |
Severity |
| 1 |
HTTP Security Headers |
HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy |
LOW–HIGH |
| 2 |
Cookie Security |
Secure, HttpOnly, SameSite flags |
MEDIUM–HIGH |
| 3 |
CORS |
Wildcard origins, evil origin reflection |
HIGH–CRITICAL |
| 4 |
TLS/SSL |
Protocol version (≥TLS 1.2), cert expiry |
MEDIUM–HIGH |
| 5 |
Information Disclosure |
Server version header, X-Powered-By, exposed paths (/.env, /.git, /debug, /admin) |
LOW–HIGH |
| 6 |
Open Redirects |
Redirect parameter injection test |
HIGH |
| 7 |
HTTP Methods |
TRACE enabled, OPTIONS enumeration |
LOW |
Tier 2 — nuclei (when installed):
| # |
Category |
What it checks |
| 8 |
CVE patterns |
Known vulnerability templates for http/, ssl/, misconfiguration/ |
| 9 |
Auth bypass |
Default credentials, auth misconfiguration templates |
DAST Execution
# Tier 1 only (curl-based, zero deps)
bash "$HOME/.claude/skills/security-verify/lib/dast-runner.sh" "http://localhost:8000"
# Tier 1 + Tier 2 (requires nuclei installed)
bash "$HOME/.claude/skills/security-verify/lib/dast-runner.sh" "http://localhost:8000" --nuclei
# Custom per-check timeout (default: 5s)
bash "$HOME/.claude/skills/security-verify/lib/dast-runner.sh" "http://localhost:8000" --timeout 3
Report Format — Active vs Potential
Findings are labelled to distinguish confidence level:
ACTIVE — Confirmed by server response. Remediate now. (e.g., server returned missing CSP header)
POTENTIAL — Suspicious behavior requiring manual verification. (e.g., redirect parameter exists but may validate destinations)
Exit codes: 0 = no critical/high findings, 1 = critical/high found, 2 = URL unreachable.
DAST vs SAST
|
SAST (scan) |
DAST (dast) |
| Input |
Source files |
Running server |
| Finds |
Potential vulnerabilities |
Active misconfigurations |
| Deps |
None (bash grep) |
curl + optional nuclei |
| When |
Any time |
App must be running |
| Pre-commit |
Yes (default) |
Optional (--dast <url>) |
Mode: owasp
Systematic OWASP Top 10 2021 compliance verification.
Categories
| ID |
Category |
Key Checks |
| A01 |
Broken Access Control |
Authorization on every endpoint, no IDOR, CORS config |
| A02 |
Cryptographic Failures |
TLS 1.2+, Argon2/bcrypt hashing, no weak algorithms |
| A03 |
Injection |
Parameterized SQL, safe subprocess usage |
| A04 |
Insecure Design |
Rate limiting, account lockout, threat model |
| A05 |
Security Misconfiguration |
Debug off, security headers, no defaults |
| A06 |
Vulnerable Components |
No critical CVEs, deps up to date |
| A07 |
Auth Failures |
Strong passwords, session timeout, MFA |
| A08 |
Integrity Failures |
Safe deserialization, yaml.safe_load |
| A09 |
Logging Failures |
Auth events logged, no PII in logs |
| A10 |
SSRF |
URL validation, private IPs blocked |
Verification Process
For each category:
- Run automated checks (grep patterns per category)
- Review findings
- Mark Pass/Partial/Fail with evidence
- Generate compliance report
Mode: assess
Deep vulnerability analysis with CVSS scoring and remediation strategies.
Assessment Workflow
- Classify vulnerability type (injection, auth, data exposure, XSS, etc.)
- Evaluate exploitability (Easy/Medium/Hard based on attack vector, complexity, privileges)
- Assess impact (Confidentiality/Integrity/Availability: None/Low/High)
- Calculate CVSS v3.1 score using base metrics
- Prioritize using risk matrix (severity x exploitability -> P0-P3)
- Recommend remediation with code examples
CVSS Score Ranges
| Score |
Severity |
| 0.0 |
None |
| 0.1-3.9 |
Low |
| 4.0-6.9 |
Medium |
| 7.0-8.9 |
High |
| 9.0-10.0 |
Critical |
Priority SLAs
| Priority |
SLA |
Criteria |
| P0 |
24 hours |
Critical+Easy or High+Easy |
| P1 |
7 days |
Critical+Hard or High+Medium |
| P2 |
30 days |
Medium or High+Hard |
| P3 |
90 days |
Low severity |
Mode: audit
Adversarial logic-level code review. Reads code deeply to find vulnerabilities that grep-based SAST misses — auth bypass, IDOR, race conditions, session fixation, missing ownership checks.
Run as a focused subagent (spawn fresh context to avoid polluting the main conversation with large finding sets). When invoked, spawn an Agent with subagent_type: general-purpose, model: sonnet, and pass the target scope.
Mindset
Assume the code is hostile until proven otherwise. Find vulnerabilities a real attacker would exploit. "If you can't write the exploit scenario in one sentence, downgrade severity."
- Injection: trace user-controlled input → all SQL sinks (raw
text(), op.execute(), f-strings in queries). Alembic rule: each op.execute() must be a single statement — two statements separated by ; fail on asyncpg.
- Auth: check every route for
Depends(get_current_user) or equivalent. Routes missing auth on sensitive operations (write, delete, admin functions) are CRITICAL.
- IDOR: for every endpoint accepting an object ID (company_id, person_id, job_id), verify ownership check: does the handler confirm the object belongs to the authenticated user/tenant?
- Race conditions: check background job handlers and Celery tasks for TOCTOU patterns on shared resources.
General checks (adapt to target):
- Sensitive data exposure: PII in logs, cleartext credentials in source, debug endpoints accessible in prod
- Input validation: Pydantic model field constraints present at API boundaries (length, range, format)
- CSRF: state-changing endpoints behind Traefik — session cookie
SameSite set?
- Insecure deserialization: no
yaml.load() without Loader=yaml.SafeLoader; no unsafe deserialization of untrusted binary data
- Security misconfiguration: debug mode off,
ALLOWED_HOSTS not *, verbose error messages suppressed
Report Format
Each finding must include:
- ID:
SEC-NNN (sequential)
- CWE:
CWE-XXX — Name (e.g., CWE-89 — SQL Injection)
- Severity:
CRITICAL / HIGH / MEDIUM / LOW with CVSS-ish reasoning
- Location:
file.py:line
- Exploit scenario: one sentence describing the attack
- Fix: concrete code-level remediation
When to use
- Manual deep audit before major releases
- After
/health security (scan passes but audit finds logic flaws)
- When security-sensitive PR touches auth, session, IDOR-prone endpoints
NOT for pre-commit — use scan there. audit takes minutes; scan takes seconds.
Mode: full
Runs scan + audit sequentially. Use for /health full or when you want complete security coverage in one command.
1. Run scan (SAST grep patterns + dependency audit)
2. Run audit (adversarial logic-level review)
3. Merge findings into unified report ordered by severity
Workflow Integration
Recommended security workflow:
- Implement →
/security [mode] — get implementation guidance
- Scan →
/security-verify scan — SAST: fast grep-based check (seconds, runs in pre-commit)
- Audit →
/security-verify audit — adversarial logic review (minutes, run manually or via /health)
- Dynamic →
/security-verify dast <url> — DAST: test running app (staging/local)
- Comply →
/security-verify owasp — verify OWASP Top 10 compliance
- Assess →
/security-verify assess — CVSS score and prioritize findings
- Full →
/security-verify full — scan + audit combined (use for /health full)
/security-verify scan is called by /pre-commit automatically. /security-verify dast is optional — use --dast <url> with /pre-commit when a local dev server is running. /security-verify audit and full are called by /health security and /health full.
Gotchas
- Bandit requires Python ≤3.13 — Python 3.14 removed
.s/.n AST attributes; bandit ≤1.8.x crashes on every file and silently reports 0 findings. Use python3.13 -m bandit (bandit 1.9.4 installed there).
scanner-runner.sh --staged requires bash 4+ (mapfile); macOS ships bash 3.2 — use full scan mode instead of --staged on macOS.
- False positives in
projects/ (JSONL session transcripts), .archive/, and .venv/ — assess as FP, do not report as real issues.
- JS dependency audit gates on CRITICAL only (
pnpm audit --audit-level=critical); HIGH vulns in transitive/dev deps (ReDoS in build tools, prototype pollution in bundlers) are noise, not runtime-exploitable — surface them informationally but do not block.
- Python
pip-audit runs with no severity threshold (all vulns surfaced + gated) — different ecosystem from JS, more conservative CVE scoring, smaller dep trees.
1---2name: security-verify3description: Run security verification — SAST pattern scanning, DAST against a running app, OWASP Top 10 compliance, CVSS assessment, and adversarial code audit. Use before commit/push or when checking code for vulnerabilities. Trigger on "security scan", "is this vulnerable", "OWASP check", "security verify", "scan for vulnerabilities".4---5
6# Security Verify — Verification Workflows
7
8Run security verification checks: pattern scanning, OWASP compliance, and vulnerability assessment.
9
10## Usage
11
12```
13/security-verify # Default: run scan mode
14/security-verify scan [path] # Pattern-based security scanning (SAST)
15/security-verify dast <url> # Dynamic testing against running app (DAST)
16/security-verify owasp # OWASP Top 10 compliance check
17/security-verify assess # Vulnerability CVSS scoring + remediation
18/security-verify audit # Adversarial logic-level code review (CWE + CVSS + exploit)
19/security-verify full # scan + audit combined (use for /health or manual deep check)
20```
21
22## Mode: scan
23
24Run pattern-based security scanning against the codebase.
25
26### What It Checks
27
281. **Secret Detection** — Hardcoded credentials, API keys, private keys
292. **SQL Injection** — String interpolation in queries, raw SQL
303. **XSS** — Disabled auto-escaping, innerHTML, unsafe template filters
314. **Command Injection** — Unsafe subprocess/exec patterns
325. **Insecure Deserialization** — Unsafe deserializers
336. **Weak Cryptography** — MD5, SHA1, weak random for security use
347. **Multi-Tenant Violations** — tenant_id from request, missing tenant filters
358. **Cookie Issues** — Missing \_\_Host- prefix, missing samesite
36
37### Scan Execution
38
39Run the scanner script against target path:
40
41```bash
42# Full scan — manual usage, scans entire directory
43bash "$HOME/.claude/skills/security-verify/lib/scanner-runner.sh" "${TARGET_PATH:-.}"
44
45# Staged-only scan — pre-commit context, scans only git-staged files
46bash "$HOME/.claude/skills/security-verify/lib/scanner-runner.sh" --staged
47```
48
49Use `--staged` when invoked from `/pre-commit` to limit scope to the current commit's changes.
50Full-path scanning is for standalone audits.
51
52Review findings, assess severity, and provide fix recommendations.
53
54### Dependency Audit
55
56After pattern scan, check for known CVEs:
57
58```bash
59# Use filtered requirements file to audit only public packages.
60if command -v uv &>/dev/null && ([ -f uv.lock ] || [ -f pyproject.toml ]); then
61 if uv export --no-hashes --frozen > /tmp/raw-reqs.txt 2>/dev/null; then :; else
62 uv run pip freeze > /tmp/raw-reqs.txt 2>/dev/null || true
63 fi
64 uv run --with pip-audit pip-audit -r /tmp/pip-audit-reqs.txt 2>/dev/null || true
65elif command -v pip-audit &>/dev/null; then
66 pip-audit --local 2>/dev/null || true
67else
68 echo "pip-audit not installed"
69fi
70npm audit --production 2>/dev/null || echo "No package.json"
71```
72
73### Report Format
74
75Generate a markdown report with severity counts, findings with file:line references, and fix recommendations.
76
77## Mode: dast
78
79Dynamic Application Security Testing against a running application. Tests live HTTP endpoints rather than reading source files.
80
81### Prerequisites
82
83- Application must be running and accessible at the provided URL
84- `curl` (always available, zero extra deps)
85- `nuclei` (optional, for deeper template-based scanning): `brew install nuclei`
86- `python3` (required if using `--nuclei`, for JSON parsing)
87
88### What It Checks
89
90**Tier 1 — curl-based (always runs):**
91
92| # | Category | What it checks | Severity |
93| --- | ---------------------- | --------------------------------------------------------------------------------------- | ------------- |
94| 1 | HTTP Security Headers | HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy | LOW–HIGH |
95| 2 | Cookie Security | Secure, HttpOnly, SameSite flags | MEDIUM–HIGH |
96| 3 | CORS | Wildcard origins, evil origin reflection | HIGH–CRITICAL |
97| 4 | TLS/SSL | Protocol version (≥TLS 1.2), cert expiry | MEDIUM–HIGH |
98| 5 | Information Disclosure | Server version header, X-Powered-By, exposed paths (/.env, /.git, /debug, /admin) | LOW–HIGH |
99| 6 | Open Redirects | Redirect parameter injection test | HIGH |
100| 7 | HTTP Methods | TRACE enabled, OPTIONS enumeration | LOW |
101
102**Tier 2 — nuclei (when installed):**
103
104| # | Category | What it checks |
105| --- | ------------ | ---------------------------------------------------------------- |
106| 8 | CVE patterns | Known vulnerability templates for http/, ssl/, misconfiguration/ |
107| 9 | Auth bypass | Default credentials, auth misconfiguration templates |
108
109### DAST Execution
110
111```bash
112# Tier 1 only (curl-based, zero deps)
113bash "$HOME/.claude/skills/security-verify/lib/dast-runner.sh" "http://localhost:8000"
114
115# Tier 1 + Tier 2 (requires nuclei installed)
116bash "$HOME/.claude/skills/security-verify/lib/dast-runner.sh" "http://localhost:8000" --nuclei
117
118# Custom per-check timeout (default: 5s)
119bash "$HOME/.claude/skills/security-verify/lib/dast-runner.sh" "http://localhost:8000" --timeout 3
120```
121
122### Report Format — Active vs Potential
123
124Findings are labelled to distinguish confidence level:
125
126- **`ACTIVE`** — Confirmed by server response. Remediate now. (e.g., server returned missing CSP header)
127- **`POTENTIAL`** — Suspicious behavior requiring manual verification. (e.g., redirect parameter exists but may validate destinations)
128
129Exit codes: `0` = no critical/high findings, `1` = critical/high found, `2` = URL unreachable.
130
131### DAST vs SAST
132
133| | SAST (`scan`) | DAST (`dast`) |
134| ---------- | ------------------------- | ------------------------- |
135| Input | Source files | Running server |
136| Finds | Potential vulnerabilities | Active misconfigurations |
137| Deps | None (bash grep) | curl + optional nuclei |
138| When | Any time | App must be running |
139| Pre-commit | Yes (default) | Optional (`--dast <url>`) |
140
141## Mode: owasp
142
143Systematic OWASP Top 10 2021 compliance verification.
144
145### Categories
146
147| ID | Category | Key Checks |
148| --- | ------------------------- | ----------------------------------------------------- |
149| A01 | Broken Access Control | Authorization on every endpoint, no IDOR, CORS config |
150| A02 | Cryptographic Failures | TLS 1.2+, Argon2/bcrypt hashing, no weak algorithms |
151| A03 | Injection | Parameterized SQL, safe subprocess usage |
152| A04 | Insecure Design | Rate limiting, account lockout, threat model |
153| A05 | Security Misconfiguration | Debug off, security headers, no defaults |
154| A06 | Vulnerable Components | No critical CVEs, deps up to date |
155| A07 | Auth Failures | Strong passwords, session timeout, MFA |
156| A08 | Integrity Failures | Safe deserialization, yaml.safe_load |
157| A09 | Logging Failures | Auth events logged, no PII in logs |
158| A10 | SSRF | URL validation, private IPs blocked |
159
160### Verification Process
161
162For each category:
163
1641. Run automated checks (grep patterns per category)
1652. Review findings
1663. Mark Pass/Partial/Fail with evidence
1674. Generate compliance report
168
169## Mode: assess
170
171Deep vulnerability analysis with CVSS scoring and remediation strategies.
172
173### Assessment Workflow
174
1751. **Classify** vulnerability type (injection, auth, data exposure, XSS, etc.)
1762. **Evaluate exploitability** (Easy/Medium/Hard based on attack vector, complexity, privileges)
1773. **Assess impact** (Confidentiality/Integrity/Availability: None/Low/High)
1784. **Calculate CVSS v3.1 score** using base metrics
1795. **Prioritize** using risk matrix (severity x exploitability -> P0-P3)
1806. **Recommend remediation** with code examples
181
182### CVSS Score Ranges
183
184| Score | Severity |
185| -------- | -------- |
186| 0.0 | None |
187| 0.1-3.9 | Low |
188| 4.0-6.9 | Medium |
189| 7.0-8.9 | High |
190| 9.0-10.0 | Critical |
191
192### Priority SLAs
193
194| Priority | SLA | Criteria |
195| -------- | -------- | ---------------------------- |
196| P0 | 24 hours | Critical+Easy or High+Easy |
197| P1 | 7 days | Critical+Hard or High+Medium |
198| P2 | 30 days | Medium or High+Hard |
199| P3 | 90 days | Low severity |
200
201## Mode: audit
202
203Adversarial logic-level code review. Reads code deeply to find vulnerabilities that grep-based SAST misses — auth bypass, IDOR, race conditions, session fixation, missing ownership checks.
204
205**Run as a focused subagent** (spawn fresh context to avoid polluting the main conversation with large finding sets). When invoked, spawn an Agent with `subagent_type: general-purpose`, `model: sonnet`, and pass the target scope.
206
207### Mindset
208
209Assume the code is hostile until proven otherwise. Find vulnerabilities a real attacker would exploit. "If you can't write the exploit scenario in one sentence, downgrade severity."
210
211
212
213- Injection: trace user-controlled input → all SQL sinks (raw `text()`, `op.execute()`, f-strings in queries). Alembic rule: each `op.execute()` must be a single statement — two statements separated by `;` fail on asyncpg.
214- Auth: check every route for `Depends(get_current_user)` or equivalent. Routes missing auth on sensitive operations (write, delete, admin functions) are CRITICAL.
215- IDOR: for every endpoint accepting an object ID (company_id, person_id, job_id), verify ownership check: does the handler confirm the object belongs to the authenticated user/tenant?
216- Race conditions: check background job handlers and Celery tasks for TOCTOU patterns on shared resources.
217
218**General checks (adapt to target):**
219
220- Sensitive data exposure: PII in logs, cleartext credentials in source, debug endpoints accessible in prod
221- Input validation: Pydantic model field constraints present at API boundaries (length, range, format)
222- CSRF: state-changing endpoints behind Traefik — session cookie `SameSite` set?
223- Insecure deserialization: no `yaml.load()` without `Loader=yaml.SafeLoader`; no unsafe deserialization of untrusted binary data
224- Security misconfiguration: debug mode off, `ALLOWED_HOSTS` not `*`, verbose error messages suppressed
225
226### Report Format
227
228Each finding must include:
229
230- **ID**: `SEC-NNN` (sequential)
231- **CWE**: `CWE-XXX — Name` (e.g., `CWE-89 — SQL Injection`)
232- **Severity**: `CRITICAL / HIGH / MEDIUM / LOW` with CVSS-ish reasoning
233- **Location**: `file.py:line`
234- **Exploit scenario**: one sentence describing the attack
235- **Fix**: concrete code-level remediation
236
237### When to use
238
239- Manual deep audit before major releases
240- After `/health security` (scan passes but audit finds logic flaws)
241- When security-sensitive PR touches auth, session, IDOR-prone endpoints
242
243**NOT for pre-commit** — use `scan` there. `audit` takes minutes; `scan` takes seconds.
244
245## Mode: full
246
247Runs `scan` + `audit` sequentially. Use for `/health full` or when you want complete security coverage in one command.
248
249```
2501. Run scan (SAST grep patterns + dependency audit)
2512. Run audit (adversarial logic-level review)
2523. Merge findings into unified report ordered by severity
253```
254
255## Workflow Integration
256
257Recommended security workflow:
258
2591. **Implement** → `/security [mode]` — get implementation guidance
2602. **Scan** → `/security-verify scan` — SAST: fast grep-based check (seconds, runs in pre-commit)
2613. **Audit** → `/security-verify audit` — adversarial logic review (minutes, run manually or via /health)
2624. **Dynamic** → `/security-verify dast <url>` — DAST: test running app (staging/local)
2635. **Comply** → `/security-verify owasp` — verify OWASP Top 10 compliance
2646. **Assess** → `/security-verify assess` — CVSS score and prioritize findings
2657. **Full** → `/security-verify full` — scan + audit combined (use for /health full)
266
267`/security-verify scan` is called by `/pre-commit` automatically. `/security-verify dast` is optional — use `--dast <url>` with `/pre-commit` when a local dev server is running. `/security-verify audit` and `full` are called by `/health security` and `/health full`.
268
269## Gotchas
270
271- Bandit requires Python ≤3.13 — Python 3.14 removed `.s`/`.n` AST attributes; bandit ≤1.8.x crashes on every file and silently reports 0 findings. Use `python3.13 -m bandit` (bandit 1.9.4 installed there).
272- `scanner-runner.sh --staged` requires bash 4+ (`mapfile`); macOS ships bash 3.2 — use full scan mode instead of `--staged` on macOS.
273- False positives in `projects/` (JSONL session transcripts), `.archive/`, and `.venv/` — assess as FP, do not report as real issues.
274- JS dependency audit gates on CRITICAL only (`pnpm audit --audit-level=critical`); HIGH vulns in transitive/dev deps (ReDoS in build tools, prototype pollution in bundlers) are noise, not runtime-exploitable — surface them informationally but do not block.
275- Python `pip-audit` runs with no severity threshold (all vulns surfaced + gated) — different ecosystem from JS, more conservative CVE scoring, smaller dep trees.