| name | security-infra-review |
| description | Infrastructure & deployment security audit — Docker, Nginx, databases, CI/CD, cloud, TLS, secrets management. Framework-agnostic, adapts to any stack. Use before production deployments. |
| argument-hint | [config files, directories, or 'full' for complete infra audit] |
| model | claude-opus-4-6 |
| context | fork |
ultrathink
CORE RULES
- Only report issues found in actual config files. No hypotheticals.
- Every finding: file path, line, CWE, risk description, exact before/after remediation.
- Confidence threshold: 0.7 minimum.
- Be specific: exact config lines, not "review your security settings".
What You Do
Deep infrastructure and deployment configuration security audit. You have unrestricted tool access — use Read, Grep, Glob, Bash, and any available tool to thoroughly analyze all config files.
Target
$ARGUMENTS — specific config files, directories, or full for complete project infra audit. Defaults to full project.
Step 1 — Full Discovery & Inventory
Before auditing, exhaustively discover every infrastructure config file to ensure nothing is missed.
1A — Exhaustive Config Discovery
Run ALL these searches in parallel using Grep and Glob:
Containers & Orchestration:
- Glob:
**/docker-compose*.yml, **/docker-compose*.yaml, **/Dockerfile*, **/podman-compose*
- Glob:
**/k8s/**, **/helm/**, **/kustomize/**, **/*.deployment.yaml, **/*.service.yaml
- Grep:
(image:|ports:|volumes:|environment:|privileged|cap_add|security_context) in YAML files
- Grep:
(FROM|EXPOSE|RUN|COPY|ADD|ENV|USER|ENTRYPOINT|CMD)\s in Dockerfiles
Reverse Proxy & Web Server:
- Glob:
**/nginx*.conf, **/nginx/**, **/Caddyfile, **/traefik*.yml, **/haproxy.cfg, **/apache*.conf
- Glob:
**/vercel.json, **/netlify.toml, **/fly.toml, **/render.yaml
- Grep:
(server_tokens|add_header|proxy_pass|ssl_protocols|ssl_ciphers|limit_req) in config files
Databases:
- Glob:
**/redis.conf, **/pg_hba.conf, **/postgresql.conf, **/mongod.conf, **/my.cnf, **/mysql.cnf
- Grep:
(DATABASE_URL|REDIS_URL|MONGO_URI|connection_string|connectionString) — connection strings
- Grep:
(requirepass|bind|maxmemory|ssl-cert|auth|trust) in database configs
Environment & Secrets:
- Glob:
**/.env*, **/*.env, **/.env.example, **/.env.local, **/.env.production
- Glob:
**/*.pem, **/*.key, **/*.crt, **/*.cert, **/*.p12, **/*.pfx
- Bash:
git ls-files '*.env' '.env*' — check if env files are tracked
- Bash:
git log --all --diff-filter=D -- '*.env' '*.pem' '*.key' — deleted secrets in history
- Grep:
(api[_-]?key|secret|password|token|private[_-]?key|access[_-]?key)\s*[:=] in all source files
CI/CD Pipelines:
- Glob:
**/.github/workflows/*.yml, **/.gitlab-ci.yml, **/Jenkinsfile, **/bitbucket-pipelines.yml
- Glob:
**/.circleci/config.yml, **/azure-pipelines.yml, **/.drone.yml
- Grep:
(secrets\.|\$\{\{|env\.|permissions:|write-all|contents: write) in CI files
Cloud / IaC:
- Glob:
**/terraform/*.tf, **/terraform.tfstate*, **/pulumi/**, **/cloudformation*.yml
- Glob:
**/.aws/**, **/gcp-*.json, **/azure-*.json, **/service-account*.json
- Grep:
(aws_|azurerm_|google_|resource |data |module ) in .tf files
- Grep:
(public-read|public-read-write|AllUsers|\*:\*) — public access patterns
BaaS & Third-party Platforms:
- Glob:
**/supabase/config.toml, **/supabase/migrations/**, **/supabase/functions/**
- Glob:
**/firestore.rules, **/storage.rules, **/database.rules.json, **/firebase.json
- Grep:
(SUPABASE_SERVICE_ROLE|STRIPE_SECRET|CLERK_SECRET|FIREBASE_ADMIN)\s*[:=] — secret keys in config
- Grep:
(NEXT_PUBLIC_|VITE_|REACT_APP_).*(SERVICE_ROLE|SECRET|PRIVATE) — secret keys accidentally exposed as public env vars
- Grep:
(allow read, write: if true|".read":\s*true|".write":\s*true) — open Firebase rules
App Security Config:
- Glob:
**/next.config.*, **/nuxt.config.*, **/vite.config.*
- Grep:
(helmet|cors|csp|content-security-policy|x-frame-options|rate-limit) in source
- Grep:
(productionSourceMap|devtool|source-map|sourcemap) — source maps config
1B — Build Structured Audit TODO
After discovery, organize all found configs into a prioritized checklist:
## INFRA AUDIT TODO — [Project Name]
### P1 — Critical (secrets, auth, exposed services)
- [ ] `.env.production` — committed to git with real credentials
- [ ] `docker-compose.yml` — redis exposed on 0.0.0.0:6379
- [ ] `terraform.tfstate` — state file in repo
### P2 — High (containers, proxy, database config)
- [ ] `Dockerfile` — running as root, unpinned base image
- [ ] `nginx.conf` — missing security headers
- [ ] `pg_hba.conf` — trust auth for remote connections
### P3 — Medium (CI/CD, TLS, cloud)
- [ ] `.github/workflows/deploy.yml` — write-all permissions
- [ ] `nginx.conf` — TLS 1.0/1.1 still enabled
### P4 — Low (hardening, defense-in-depth)
- [ ] `docker-compose.yml` — no resource limits
- [ ] `redis.conf` — dangerous commands not disabled
Rules for the TODO:
- One line per config file, with the specific concern noted
- Include line number when a specific pattern was matched
- Group by security priority, not by component type
- If >50 configs found, ask user: "Full audit (~X files) or focused on P1-P2 (~Y files)?"
1C — Progress Tracking
As you audit each config, update the checklist:
[x] — Audited, no issues found
[!] — Audited, finding(s) reported
[ ] — Not yet audited
Print the checklist status at each major milestone so progress is visible.
Step 2 — Audit Each Component
Containers (Docker / Podman / K8s)
Reverse Proxy & Web Server
Databases
Redis:
PostgreSQL / MySQL:
MongoDB:
Environment & Secrets
CI/CD Pipelines
BaaS & Third-party Platforms
Supabase:
Firebase:
Clerk / Auth.js / BetterAuth:
Stripe / Payment Providers:
Cloud / IaC
Step 3 — Report
Per finding:
### [SEVERITY] Title — CWE-XXX
**File**: `path/to/config:line`
**Confidence**: confirmed | probable
**Issue**: What is wrong (specific).
**Risk**: What an attacker gains and how.
**Fix**:
Before:
[exact current config line]
After:
[exact fixed config line]
**Effort**: ~Xmin
End with executive summary: total findings by severity, top priority fixes, production readiness assessment, and Files Discovered: X total (Y audited, Z skipped).
Exclusions
- Performance tuning (unless security-relevant resource limits)
- Cosmetic config formatting
- Hypothetical network topology you cannot verify from files
- Deprecated but unused/commented config blocks
CORE RULES — REREAD BEFORE REPORTING
- Only report issues found in actual config files. No hypotheticals.
- Every finding: file path, line, CWE, risk description, exact before/after remediation.
- Confidence threshold: 0.7 minimum.
- Be specific: exact config lines, not "review your security settings".
- Full discovery phase MUST complete before auditing begins.