技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
security-audit【数据与研究】Scan code for security vulnerabilities, misconfigurations, and exposed secrets. Use when a user asks to audit security, find vulnerabilities, check for OWASP issues, scan for secrets, review dependencies for CVEs, detect SQL injection, find XSS vulnerabilities, or harden an application. Covers OWASP Top 10, dependency auditing, secrets detection, and…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Perform comprehensive security audits on codebases by scanning for OWASP Top 10 vulnerabilities, checking dependencies for known CVEs, detecting leaked secrets and API keys, and generating prioritized fix recommendations. This skill combines static analysis patterns with dependency auditing tools.
When a user asks you to audit their code for security issues, follow these steps:
Ask or infer what to audit:
Run the appropriate audit tool for the project:
# Node.js
npm audit --json 2>/dev/null || npx audit-ci --config /dev/null
# Python
pip-audit --format=json 2>/dev/null || pip install pip-audit && pip-audit --format=json
# General (if trivy is available)
trivy fs --security-checks vuln .
Parse results and categorize by severity (Critical, High, Medium, Low).
Search the codebase for common secret patterns:
# Check for common patterns
grep -rn --include="*.{js,ts,py,java,go,rb,env,yml,yaml,json,xml,conf}" \
-E "(password|secret|api_key|apikey|token|private_key|aws_access|stripe_sk|ghp_|gho_|sk-[a-zA-Z0-9]{20,})" \
--exclude-dir={node_modules,.git,dist,build,vendor,__pycache__} .
Also check for:
.env files committed to git: git ls-files | grep -i '\.env'grep -rn "BEGIN.*PRIVATE KEY" .Review source code for these critical patterns:
A01 — Broken Access Control:
* with credentialsA02 — Cryptographic Failures:
A03 — Injection:
# VULNERABLE — SQL injection
query = f"SELECT * FROM users WHERE id = {user_input}"
cursor.execute(query)
# SAFE — parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", (user_input,))
os.system, exec, child_process.exec)A05 — Security Misconfiguration:
A07 — Cross-Site Scripting (XSS):
dangerouslySetInnerHTML with user inputinnerHTML assignment without sanitizationv-html directive with untrusted dataProduce a structured report with findings grouped by severity:
# Security Audit Report
**Project:** project-name
**Date:** 2026-02-17
**Files scanned:** 142
**Issues found:** 8 (2 Critical, 3 High, 2 Medium, 1 Low)
## Critical
### [C1] SQL Injection in user query — src/db/users.py:45
- **Category:** A03 Injection
- **Description:** User input concatenated directly into SQL query
- **Fix:** Use parameterized queries with `cursor.execute(query, params)`
## High
### [H1] Hardcoded Stripe secret key — src/config.js:12
- **Category:** A02 Cryptographic Failures
- **Description:** `sk_live_EXAMPLE_ROTATE_IMMEDIATELY` found in source
- **Fix:** Move to environment variable, rotate the key immediately
For each finding, provide:
User request: "Run a security audit on this Express project"
Actions taken:
npm audit — found 3 vulnerabilities (1 critical in jsonwebtoken < 9.0.0)src/config/aws.js/api/admin/usersReport summary:
Issues found: 7 (1 Critical, 3 High, 2 Medium, 1 Low)
Critical:
- jsonwebtoken@8.5.1 has a signature bypass vulnerability (CVE-2022-23529)
Fix: npm install jsonwebtoken@9.0.2
High:
- AWS_SECRET_ACCESS_KEY hardcoded in src/config/aws.js:8
Fix: Move to .env, add .env to .gitignore, rotate the key
- /api/admin/users route missing authentication middleware
Fix: Add authMiddleware to route: router.get('/api/admin/users', authMiddleware, handler)
- No security headers configured
Fix: npm install helmet && app.use(helmet())
Medium:
- CORS allows all origins with credentials (src/app.js:15)
Fix: Specify allowed origins explicitly
- Error handler returns stack traces (src/middleware/error.js:8)
Fix: Only return stack traces when NODE_ENV !== 'production'
User request: "Check my Django app for leaked secrets and vulnerable packages"
Actions taken:
pip-audit — found 2 vulnerable packagesReport summary:
Issues found: 4 (1 Critical, 2 High, 1 Medium)
Critical:
- Django SECRET_KEY committed in settings.py:23
Value: 'django-insecure-x#k2!7...'
Fix: Use os.environ.get('DJANGO_SECRET_KEY') and generate a new key
High:
- Pillow==9.0.0 — CVE-2023-44271 (DoS via large TIFF)
Fix: pip install Pillow>=10.0.1
- Stripe secret key in views.py:67: sk_live_...
Fix: Move to environment variable, rotate key in Stripe dashboard
Medium:
- DEBUG = True in settings.py (check DJANGO_DEBUG env in production)
Fix: DEBUG = os.environ.get('DJANGO_DEBUG', 'False') == 'True'
.gitignore for missing entries (.env, *.pem, *.key).