Comprehensive application security audit skill. Use this whenever a user asks to: audit, review, check, scan, or assess the security of their code or application; find vulnerabilities, security issues, or attack vectors; harden their app; implement authentication, authorization, rate limiting, or CORS; check for exposed ports, open endpoints, or insecure configurations; review Docker/compose setups for security; check dependency safety; or asks anything like "is my app secure?", "how do I protect my API?", "what are the security risks in my code?". Covers Python, FastAPI, React, Streamlit, Docker, and general network/infrastructure security. Always use this skill proactively when the user shares code and security could be a concern — even if they didn't explicitly ask for a security review.
You are performing a structured, thorough security audit. Follow this skill fully — do not skip sections relevant to the user's stack.
Before diving in, identify:
Load the relevant reference files based on the stack detected:
| Stack component | Reference file |
|---|---|
| Python (general) | references/python-security.md |
| FastAPI | references/fastapi-security.md |
| Streamlit | references/streamlit-security.md |
| React / frontend | references/react-security.md |
| Network / ports / infra | references/network-security.md |
| Docker & containers | references/docker-security.md |
| Dependencies & supply chain | references/dependency-security.md |
Always load references/network-security.md regardless of stack — port exposure and network hygiene apply universally.
Run the audit in this exact order. Each phase feeds into the next.
This is always first. Leaked credentials are the most common and most critical issue.
.env files — are they in .gitignore?# Run if you have filesystem access
grep -rn --include="*.py" --include="*.ts" --include="*.tsx" --include="*.js" \
-E "(password|secret|api_key|token|private_key)\s*=\s*['\"][^'\"]{6,}" .
grep -rn "os.environ.get" . --include="*.py" | grep -v ".env"
alg: none), expiry, secret strengthsubprocess, os.system with user input?Always run this. Read references/network-security.md for the full checklist.
Key items:
* allowed on authenticated endpoints?Load and apply the relevant reference files. Each has a detailed checklist.
Read references/dependency-security.md. Key checks:
pip audit / npm audit / safety checkStructure your audit report as follows:
## Security Audit Report
### 🔴 Critical (fix immediately)
[Issues that allow auth bypass, RCE, data exfiltration]
### 🟠 High (fix before production)
[Issues that significantly raise attack surface]
### 🟡 Medium (fix in next sprint)
[Defense-in-depth improvements, hardening]
### 🟢 Low / Best Practices
[Nice-to-haves, logging improvements, minor hygiene]
### ✅ What's already good
[Acknowledge secure patterns already in place]
### 📋 Remediation Checklist
[Prioritized, copy-paste-ready action items]
For each finding, provide:
| Severity | Examples |
|---|---|
| 🔴 Critical | Hardcoded secrets, auth bypass, SQLi, RCE, open DB to internet |
| 🟠 High | Missing auth on sensitive endpoints, weak JWT, CORS * on auth'd routes, no rate limiting on login |
| 🟡 Medium | Missing HTTPS redirect, verbose error responses, no CSP, session without HttpOnly |
| 🟢 Low | Missing security headers, overly permissive file permissions, no dependency pinning |
After the audit, always include a Hardening Roadmap section covering:
references/network-security.md)references/python-security.md — Bandit rules, dangerous functions, async pitfalls, deserializationreferences/fastapi-security.md — Middleware stack, OAuth2, rate limiting, CORS, background tasksreferences/streamlit-security.md — Auth patterns, secrets, iframe risks, multipage appsreferences/react-security.md — XSS, dangerouslySetInnerHTML, token storage, CSP, dependency auditreferences/network-security.md — Port exposure, firewall rules, Docker networking, reverse proxy configreferences/docker-security.md — Non-root users, image scanning, secrets, resource limitsreferences/dependency-security.md — pip audit, npm audit, SBOM, supply chain hardening