Security Sweep
Run a comprehensive security scan of the codebase. This skill identifies vulnerabilities, hardcoded secrets, injection flaws, misconfigurations, and attack surfaces across web and mobile applications.
Arguments
$0 (optional): Scan scope — one of: all, secrets, injection, auth, config, deps, ai, mobile, data. Defaults to all.
$1 (optional): Path to scan. Defaults to the project root.
If $ARGUMENTS is empty, run a full all scan from the project root.
Execution Plan
Step 1: Tech Stack Detection
Before scanning, detect the project's tech stack by checking for indicator files. This determines which language-specific checks to run.
| Indicator File |
Stack |
Scan Focus |
package.json |
Node.js/JS/TS |
npm patterns, XSS sinks, eval, child_process |
requirements.txt, pyproject.toml, setup.py, Pipfile |
Python |
pickle, subprocess, Jinja2, Django/Flask patterns |
pom.xml, build.gradle, build.gradle.kts |
Java/Kotlin |
JDBC injection, ObjectInputStream, Spring patterns |
Gemfile |
Ruby |
Marshal, system(), ERB patterns |
go.mod |
Go |
fmt.Sprintf in SQL, crypto patterns |
Cargo.toml |
Rust |
unsafe blocks, FFI |
composer.json |
PHP |
exec, unserialize, include with vars |
*.csproj |
.NET |
BinaryFormatter, SqlCommand concat |
AndroidManifest.xml |
Android |
exported components, cleartext, SharedPreferences |
Info.plist, *.xcodeproj, Podfile |
iOS |
NSUserDefaults, ATS bypass |
Dockerfile |
Docker |
FROM :latest, root user, secrets in build |
*.tf, *.hcl |
Terraform |
public ACLs, open CIDR |
next.config.* |
Next.js |
SSR-specific checks |
pubspec.yaml |
Flutter/Dart |
Dart-specific mobile checks |
Use Glob to detect which of these exist, then tailor the scan accordingly.
Step 2: Run Scans by Priority
Run the scans below in order. If a scope argument was provided, only run that specific scan module. Use the patterns from patterns.md for each module.
For each scan module, use Grep with the relevant regex patterns from patterns.md. Search across the detected file types. Skip node_modules/, vendor/, .git/, dist/, build/, __pycache__/, .venv/, venv/, .next/, .nuxt/, target/, Pods/, .gradle/ directories.
Module 1: SECRETS (Critical Priority)
Scan for hardcoded API keys, tokens, private keys, credentials, database connection strings, and committed secret files. See patterns.md Section 1.
Also check:
- Whether
.env files exist in the repo (they should be gitignored)
- Whether
.gitignore covers .env*, *.pem, *.key, *.p12, credentials*.json
- Whether any
*.pem, *.key, *.p12, *.pfx, *.jks files are present
Module 2: INJECTION (Critical Priority)
Scan for SQL injection, XSS, command injection, SSRF, insecure deserialization, and path traversal patterns. See patterns.md Section 2.
Module 3: AUTH (High Priority)
Scan for JWT misuse, weak password handling, insecure session config, broken access control. See patterns.md Section 3.
Module 4: CONFIG (High Priority)
Scan for CORS misconfiguration, missing security headers, exposed debug endpoints, insecure TLS, Docker issues, Kubernetes/Terraform misconfig. See patterns.md Section 4.
Module 5: DEPS (High Priority)
Check dependency manifests for:
- Missing lockfiles alongside manifests
- Suspicious install scripts in package.json (
preinstall/postinstall with curl/wget/bash)
- Known risky or deprecated packages
Module 6: AI (High Priority)
Scan for AI-specific issues: hardcoded AI API keys, prompt injection vectors, eval/exec of LLM output, system prompt leakage, excessive agent permissions. See patterns.md Section 5.
Module 7: MOBILE (High Priority — only if Android/iOS detected)
Scan for insecure data storage, missing certificate pinning, cleartext traffic, debug flags, weak crypto. See patterns.md Section 6.
Module 8: DATA (Medium Priority)
Scan for PII in logs, sensitive data in URLs, plaintext HTTP to external hosts. See patterns.md Section 7.
Step 3: Generate Report
After all scans complete, produce a structured report.
Report Format
Start with a summary banner:
============================================
SECURITY SWEEP REPORT
Project: <project name>
Scanned: <date>
Tech Stack: <detected stacks>
============================================
SUMMARY
CRITICAL: <count>
HIGH: <count>
MEDIUM: <count>
LOW: <count>
INFO: <count>
TOTAL: <count>
============================================
Then list findings grouped by severity (CRITICAL first), with this format for each:
[SEVERITY] CATEGORY — Finding Title
File: path/to/file.ext:line_number
Evidence: <the matching code snippet, max 2 lines>
Risk: <1-sentence explanation of the attack scenario>
Fix: <specific remediation with code example>
Ref: <CWE or OWASP reference>
After the findings, include:
- Top 3 Priorities — The 3 most impactful issues to fix first, with reasoning
- Positive Findings — Security practices the project is doing well (e.g., using parameterized queries, proper .gitignore, CSP headers present)
- Recommendations — General security improvements not tied to a specific finding
Important Guidelines
- Minimize false positives: When a pattern match looks like it might be a false positive (e.g., a test file, a comment, an example/documentation), note it as
[INFO] rather than flagging it at high severity. Use your contextual understanding of the code to distinguish real issues from benign matches.
- Read files for context: When a grep match is ambiguous, use
Read to examine surrounding code before classifying severity. For example, a pickle.load() in a test fixture is lower risk than one in a web endpoint.
- Skip vendored/generated code: Do not flag issues in
node_modules/, vendor/, generated files, or lock files.
- Be framework-aware: Understand that some frameworks have built-in protections (e.g., Django ORM prevents SQL injection, React escapes by default, Angular sanitizes innerHTML). Adjust severity accordingly.
- Deduplicate: If the same pattern appears many times (e.g.,
console.log(req.body) in 20 files), group them as one finding with a count rather than listing each separately.
1---
2name: security-sweep
3description: Scan codebase for security vulnerabilities, hardcoded secrets, injection flaws, misconfigurations, and attack surfaces. Use when user wants a security audit, vulnerability scan, or to find security issues.
4argument-hint: "[scope: all|secrets|injection|auth|config|deps|ai|mobile|data] [path]"
5allowed-tools: Read, Grep, Glob, Bash, Agent
6effort: max
7metadata:
8 source: https://skillmd.com/skills/aibot88/security-sweep
9---
10
11# Security Sweep
12
13Run a comprehensive security scan of the codebase. This skill identifies vulnerabilities, hardcoded secrets, injection flaws, misconfigurations, and attack surfaces across web and mobile applications.
14
15## Arguments
16
17- `$0` (optional): Scan scope — one of: `all`, `secrets`, `injection`, `auth`, `config`, `deps`, `ai`, `mobile`, `data`. Defaults to `all`.
18- `$1` (optional): Path to scan. Defaults to the project root.
19
20If `$ARGUMENTS` is empty, run a full `all` scan from the project root.
21
22## Execution Plan
23
24### Step 1: Tech Stack Detection
25
26Before scanning, detect the project's tech stack by checking for indicator files. This determines which language-specific checks to run.
27
28| Indicator File | Stack | Scan Focus |
29|---|---|---|
30| `package.json` | Node.js/JS/TS | npm patterns, XSS sinks, eval, child_process |
31| `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile` | Python | pickle, subprocess, Jinja2, Django/Flask patterns |
32| `pom.xml`, `build.gradle`, `build.gradle.kts` | Java/Kotlin | JDBC injection, ObjectInputStream, Spring patterns |
33| `Gemfile` | Ruby | Marshal, system(), ERB patterns |
34| `go.mod` | Go | fmt.Sprintf in SQL, crypto patterns |
35| `Cargo.toml` | Rust | unsafe blocks, FFI |
36| `composer.json` | PHP | exec, unserialize, include with vars |
37| `*.csproj` | .NET | BinaryFormatter, SqlCommand concat |
38| `AndroidManifest.xml` | Android | exported components, cleartext, SharedPreferences |
39| `Info.plist`, `*.xcodeproj`, `Podfile` | iOS | NSUserDefaults, ATS bypass |
40| `Dockerfile` | Docker | FROM :latest, root user, secrets in build |
41| `*.tf`, `*.hcl` | Terraform | public ACLs, open CIDR |
42| `next.config.*` | Next.js | SSR-specific checks |
43| `pubspec.yaml` | Flutter/Dart | Dart-specific mobile checks |
44
45Use `Glob` to detect which of these exist, then tailor the scan accordingly.
46
47### Step 2: Run Scans by Priority
48
49Run the scans below in order. If a scope argument was provided, only run that specific scan module. Use the patterns from [patterns.md](patterns.md) for each module.
50
51**For each scan module**, use `Grep` with the relevant regex patterns from [patterns.md](patterns.md). Search across the detected file types. Skip `node_modules/`, `vendor/`, `.git/`, `dist/`, `build/`, `__pycache__/`, `.venv/`, `venv/`, `.next/`, `.nuxt/`, `target/`, `Pods/`, `.gradle/` directories.
52
53#### Module 1: SECRETS (Critical Priority)
54Scan for hardcoded API keys, tokens, private keys, credentials, database connection strings, and committed secret files. See [patterns.md](patterns.md) Section 1.
55
56Also check:
57- Whether `.env` files exist in the repo (they should be gitignored)
58- Whether `.gitignore` covers `.env*`, `*.pem`, `*.key`, `*.p12`, `credentials*.json`
59- Whether any `*.pem`, `*.key`, `*.p12`, `*.pfx`, `*.jks` files are present
60
61#### Module 2: INJECTION (Critical Priority)
62Scan for SQL injection, XSS, command injection, SSRF, insecure deserialization, and path traversal patterns. See [patterns.md](patterns.md) Section 2.
63
64#### Module 3: AUTH (High Priority)
65Scan for JWT misuse, weak password handling, insecure session config, broken access control. See [patterns.md](patterns.md) Section 3.
66
67#### Module 4: CONFIG (High Priority)
68Scan for CORS misconfiguration, missing security headers, exposed debug endpoints, insecure TLS, Docker issues, Kubernetes/Terraform misconfig. See [patterns.md](patterns.md) Section 4.
69
70#### Module 5: DEPS (High Priority)
71Check dependency manifests for:
72- Missing lockfiles alongside manifests
73- Suspicious install scripts in package.json (`preinstall`/`postinstall` with curl/wget/bash)
74- Known risky or deprecated packages
75
76#### Module 6: AI (High Priority)
77Scan for AI-specific issues: hardcoded AI API keys, prompt injection vectors, eval/exec of LLM output, system prompt leakage, excessive agent permissions. See [patterns.md](patterns.md) Section 5.
78
79#### Module 7: MOBILE (High Priority — only if Android/iOS detected)
80Scan for insecure data storage, missing certificate pinning, cleartext traffic, debug flags, weak crypto. See [patterns.md](patterns.md) Section 6.
81
82#### Module 8: DATA (Medium Priority)
83Scan for PII in logs, sensitive data in URLs, plaintext HTTP to external hosts. See [patterns.md](patterns.md) Section 7.
84
85### Step 3: Generate Report
86
87After all scans complete, produce a structured report.
88
89#### Report Format
90
91Start with a summary banner:
92
93```
94============================================
95 SECURITY SWEEP REPORT
96 Project: <project name>
97 Scanned: <date>
98 Tech Stack: <detected stacks>
99============================================
100
101SUMMARY
102 CRITICAL: <count>
103 HIGH: <count>
104 MEDIUM: <count>
105 LOW: <count>
106 INFO: <count>
107 TOTAL: <count>
108============================================
109```
110
111Then list findings grouped by severity (CRITICAL first), with this format for each:
112
113```
114[SEVERITY] CATEGORY — Finding Title
115 File: path/to/file.ext:line_number
116 Evidence: <the matching code snippet, max 2 lines>
117 Risk: <1-sentence explanation of the attack scenario>
118 Fix: <specific remediation with code example>
119 Ref: <CWE or OWASP reference>
120```
121
122#### After the findings, include:
123
1241. **Top 3 Priorities** — The 3 most impactful issues to fix first, with reasoning
1252. **Positive Findings** — Security practices the project is doing well (e.g., using parameterized queries, proper .gitignore, CSP headers present)
1263. **Recommendations** — General security improvements not tied to a specific finding
127
128### Important Guidelines
129
130- **Minimize false positives**: When a pattern match looks like it might be a false positive (e.g., a test file, a comment, an example/documentation), note it as `[INFO]` rather than flagging it at high severity. Use your contextual understanding of the code to distinguish real issues from benign matches.
131- **Read files for context**: When a grep match is ambiguous, use `Read` to examine surrounding code before classifying severity. For example, a `pickle.load()` in a test fixture is lower risk than one in a web endpoint.
132- **Skip vendored/generated code**: Do not flag issues in `node_modules/`, `vendor/`, generated files, or lock files.
133- **Be framework-aware**: Understand that some frameworks have built-in protections (e.g., Django ORM prevents SQL injection, React escapes by default, Angular sanitizes innerHTML). Adjust severity accordingly.
134- **Deduplicate**: If the same pattern appears many times (e.g., `console.log(req.body)` in 20 files), group them as one finding with a count rather than listing each separately.