Security Audit
Phased security scan. Each phase is independent — skip phases that do not apply
to the codebase.
Phase 1: Scope
- Identify the attack surface: what accepts external input? (HTTP endpoints,
CLI args, file uploads, WebSocket messages, IPC, environment variables)
- Identify trust boundaries: where does data cross from untrusted to trusted?
- List authentication and authorization mechanisms in use
- Note the deployment model (server, serverless, desktop, CLI)
Phase 2: Input Validation
For each entry point identified in Phase 1:
- Is user input validated and sanitized before use?
- Are SQL queries parameterized (not string-interpolated)?
- Is HTML output escaped to prevent XSS?
- Are file paths validated to prevent path traversal?
- Are file uploads constrained by type and size?
- Is deserialization of untrusted data avoided or sandboxed?
Phase 3: Auth and Session
- Are all protected routes/endpoints checked for authentication?
- Is authorization checked per-resource, not just per-route?
- Are session tokens generated with sufficient entropy?
- Are tokens stored securely (httpOnly, secure, sameSite)?
- Is there rate limiting on login/auth endpoints?
- Are password reset flows safe from enumeration?
Phase 4: Secrets
grep -r for common secret patterns in source (API keys, tokens, passwords,
connection strings) — exclude node_modules, .git, lock files
- Check
git log --all -p -S "password\|secret\|api_key\|token" for secrets
that were committed and later removed (they are still in history)
- Verify
.gitignore covers .env, credential files, and key material
- Check that secrets are not logged, included in error responses, or exposed
in client-side bundles
Phase 5: Dependencies
- Check for known vulnerabilities:
npm audit / pip audit / equivalent
- Look for unmaintained dependencies (no updates in 2+ years)
- Check that lockfiles are committed and dependencies are pinned
Phase 6: CI/CD
If CI/CD config exists (.github/workflows/, .gitlab-ci.yml, etc.):
- Are third-party actions/images pinned to SHA, not floating tags?
- Does
pull_request_target grant write access to untrusted PRs?
- Are secrets available only to the workflows that need them?
- Can a malicious PR modify CI config to exfiltrate secrets?
Phase 7: STRIDE Threat Model
For each component identified in Phase 1, evaluate:
- Spoofing — Can an attacker impersonate a legitimate user or service?
- Tampering — Can data be modified in transit or at rest without detection?
- Repudiation — Are security-relevant actions logged with enough detail for audit?
- Information Disclosure — Can sensitive data leak through errors, logs, or side channels?
- Denial of Service — Are there unbounded operations an attacker can trigger?
- Elevation of Privilege — Can a low-privilege user reach admin functionality?
Phase 8: Report
For each finding:
- Severity: Critical / High / Medium / Low / Informational
- Location: file path and line range
- Description: what the vulnerability is
- Impact: what an attacker could do
- Recommendation: specific fix, not generic advice
Rules
- Only report findings you can point to in the code — no hypotheticals
- If a finding requires a specific runtime condition to exploit, state the condition
- Do not report style issues, linting violations, or non-security code quality as security findings
- Distinguish between confirmed vulnerabilities and potential risks
1---2name: security-audit3description: Security audit skill. Use when asked to "audit security", "check for vulnerabilities", "security review", "pentest", or when evaluating code that handles auth, user input, secrets, or external data. Runs a phased scan covering OWASP Top 10 and STRIDE threat modeling.4---56# Security Audit78Phased security scan. Each phase is independent — skip phases that do not apply9to the codebase.1011## Phase 1: Scope12131. Identify the attack surface: what accepts external input? (HTTP endpoints,14 CLI args, file uploads, WebSocket messages, IPC, environment variables)152. Identify trust boundaries: where does data cross from untrusted to trusted?163. List authentication and authorization mechanisms in use174. Note the deployment model (server, serverless, desktop, CLI)1819## Phase 2: Input Validation2021For each entry point identified in Phase 1:2223- Is user input validated and sanitized before use?24- Are SQL queries parameterized (not string-interpolated)?25- Is HTML output escaped to prevent XSS?26- Are file paths validated to prevent path traversal?27- Are file uploads constrained by type and size?28- Is deserialization of untrusted data avoided or sandboxed?2930## Phase 3: Auth and Session3132- Are all protected routes/endpoints checked for authentication?33- Is authorization checked per-resource, not just per-route?34- Are session tokens generated with sufficient entropy?35- Are tokens stored securely (httpOnly, secure, sameSite)?36- Is there rate limiting on login/auth endpoints?37- Are password reset flows safe from enumeration?3839## Phase 4: Secrets40411. `grep -r` for common secret patterns in source (API keys, tokens, passwords,42 connection strings) — exclude `node_modules`, `.git`, lock files432. Check `git log --all -p -S "password\|secret\|api_key\|token"` for secrets44 that were committed and later removed (they are still in history)453. Verify `.gitignore` covers `.env`, credential files, and key material464. Check that secrets are not logged, included in error responses, or exposed47 in client-side bundles4849## Phase 5: Dependencies50511. Check for known vulnerabilities: `npm audit` / `pip audit` / equivalent522. Look for unmaintained dependencies (no updates in 2+ years)533. Check that lockfiles are committed and dependencies are pinned5455## Phase 6: CI/CD5657If CI/CD config exists (`.github/workflows/`, `.gitlab-ci.yml`, etc.):5859- Are third-party actions/images pinned to SHA, not floating tags?60- Does `pull_request_target` grant write access to untrusted PRs?61- Are secrets available only to the workflows that need them?62- Can a malicious PR modify CI config to exfiltrate secrets?6364## Phase 7: STRIDE Threat Model6566For each component identified in Phase 1, evaluate:6768- **Spoofing** — Can an attacker impersonate a legitimate user or service?69- **Tampering** — Can data be modified in transit or at rest without detection?70- **Repudiation** — Are security-relevant actions logged with enough detail for audit?71- **Information Disclosure** — Can sensitive data leak through errors, logs, or side channels?72- **Denial of Service** — Are there unbounded operations an attacker can trigger?73- **Elevation of Privilege** — Can a low-privilege user reach admin functionality?7475## Phase 8: Report7677For each finding:78791. **Severity**: Critical / High / Medium / Low / Informational802. **Location**: file path and line range813. **Description**: what the vulnerability is824. **Impact**: what an attacker could do835. **Recommendation**: specific fix, not generic advice8485## Rules8687- Only report findings you can point to in the code — no hypotheticals88- If a finding requires a specific runtime condition to exploit, state the condition89- Do not report style issues, linting violations, or non-security code quality as security findings90- Distinguish between confirmed vulnerabilities and potential risks