| name | security-audit |
| description | Audit code and infrastructure for security vulnerabilities. Use when performing security reviews, checking for OWASP Top 10 issues, auditing dependencies, or hardening applications. |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| tags | ["security","audit","vulnerabilities","owasp","xss","sql-injection","authentication","secrets"] |
| platforms | ["Claude","ChatGPT","Gemini"] |
| author | locusai |
Security Audit
When to use this skill
- Auditing a codebase for security vulnerabilities
- Reviewing authentication and authorization
- Checking for exposed secrets or credentials
- Assessing dependency security
- Hardening an application before deployment
- Responding to security alerts
Step 1: Secrets and credentials scan
grep -rn "password\s*=\|api_key\s*=\|secret\s*=\|token\s*=" --include="*.ts" --include="*.py" --include="*.js" --include="*.env" .
grep -rn "AKIA[0-9A-Z]\{16\}" .
grep -rn "sk-[a-zA-Z0-9]\{20,\}" .
grep -rn "ghp_[a-zA-Z0-9]\{36\}" .
git ls-files | grep -i "\.env"
cat .gitignore | grep -i "env\|secret\|key\|credential"
Findings to flag:
- Any credential in source code (even in comments)
.env files tracked by git
- Missing
.gitignore entries for sensitive files
Step 2: Input validation (Injection attacks)
SQL Injection
grep -rn "query(\`\|query(f\"\|execute(f\"\|\.raw(" --include="*.ts" --include="*.py" --include="*.js" .
grep -rn "\$\{.*\}" --include="*.sql" .
db.query(`SELECT * FROM users WHERE id = ${userId}`);
db.query('SELECT * FROM users WHERE id = $1', [userId]);
XSS (Cross-Site Scripting)
grep -rn "innerHTML\|dangerouslySetInnerHTML\|v-html\|\|html(" --include="*.tsx" --include="*.jsx" --include="*.vue" --include="*.html" .
element.innerHTML = userInput;
<div dangerouslySetInnerHTML={{ __html: userContent }} />
element.textContent = userInput;
Command Injection
grep -rn "exec(\|spawn(\|execSync(\|child_process\|subprocess\|os\.system\|os\.popen" --include="*.ts" --include="*.py" --include="*.js" .
exec(`git log --author="${userInput}"`);
execFile('git', ['log', `--author=${userInput}`]);
Path Traversal
grep -rn "readFile\|readFileSync\|open(\|Path\|sendFile\|serve_file" --include="*.ts" --include="*.py" --include="*.js" . | grep -v node_modules
app.get('/file', (req, res) => {
res.sendFile(path.join('/uploads', req.query.name));
});
const safePath = path.resolve('/uploads', req.query.name);
if (!safePath.startsWith('/uploads/')) {
return res.status(403).send('Access denied');
}
Step 3: Authentication and authorization
grep -rn "authenticate\|authorize\|isAdmin\|checkPermission\|jwt\|session\|cookie" --include="*.ts" --include="*.py" --include="*.js" -l .
grep -rn "app\.\(get\|post\|put\|delete\|patch\)" --include="*.ts" --include="*.js" .
Check for:
Step 4: Dependency audit
npm audit
npm audit --json | jq '.vulnerabilities | to_entries[] | select(.value.severity == "critical" or .value.severity == "high") | {name: .key, severity: .value.severity}'
pip-audit
safety check
npx is-my-node-vulnerable
Step 5: Configuration security
grep -rn "DEBUG\s*=\s*True\|NODE_ENV.*development" --include="*.py" --include="*.ts" --include="*.env" .
grep -rn "cors\|Access-Control\|origin.*\*" --include="*.ts" --include="*.py" --include="*.js" .
grep -rn "origin:\s*['\"]?\*['\"]?" --include="*.ts" --include="*.js" .
Check for:
Step 6: Data protection
Audit report format
## Security Audit Summary
**Scope**: [what was reviewed]
**Date**: [date]
**Risk Level**: [Critical / High / Medium / Low]
### Critical Findings
1. **[Title]** — [description, location, impact, fix]
### High Findings
1. **[Title]** — [description, location, impact, fix]
### Medium Findings
1. ...
### Recommendations
- [Prioritized list of improvements]
Checklist