بنقرة واحدة
security-review
Comprehensive security audit covering 10 threat categories
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Comprehensive security audit covering 10 threat categories
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Process autonomous task queue from do-work/ folder
Enter plan mode for complex tasks (pour energy into the plan for 1-shot implementation)
Initiate autonomous PR review process with Codex agent
Run comprehensive repo assessment with Codex (every 3 PRs)
Install all automation for a new repo (git hooks + GitHub Actions)
Automated PR submission - runs pre-checks, creates PR, and starts review
| name | security-review |
| description | Comprehensive security audit covering 10 threat categories |
Created: 2026-02-11-00-00 Last Updated: 2026-02-25-00-00
Systematic security audit of the repository. Covers the full taxonomy of how repos develop bad security -- from dependency CVEs to AI-agent-specific threats.
Triggered automatically every 3 PRs as part of the assessment waterfall (alongside /repo-assessment) or on demand.
/security-review # Full audit (all 10 categories)
/security-review --quick # Categories 1-2 only (deps + secrets)
/security-review --focus auth # Single category deep-dive
The audit covers 10 categories. Each has specific scan steps and patterns.
How it goes wrong: A dependency gets a CVE. A transitive dependency you've never heard of is compromised. A typosquatted package slips in. CI actions are pinned to @main instead of a SHA.
Scan:
Known CVEs in direct + transitive dependencies
npm audit --audit-level=moderatepip-audit (install via pip install pip-audit)govulncheck ./...bundle-audit check --updatecargo auditOutdated dependencies (not yet vulnerable, but risk increases with age)
npm outdated / pip list --outdatedLock file integrity
package-lock.json, poetry.lock, go.sum, Cargo.lock)package-lock.json vs yarn.lock conflictsDependency source verification
.npmrc / pip.conf for non-default registries--index-url pointing to untrusted sourcesgit+ dependencies pointing to arbitrary reposCI action pinning
.github/workflows/*.yml for unpinned actionsuses: actions/checkout@main (should be @v4 or SHA)uses: third-party/action@latestDependabot / Renovate configured?
.github/dependabot.yml or renovate.jsonCritical finding: Known critical CVE in a direct dependency. Stop and alert.
How it goes wrong: An API key gets hardcoded "just for testing" and never removed. A .env file gets committed. A secret lives in git history even after deletion. AI agents paste tokens into source files.
Scan:
Hardcoded secrets in source (scan all tracked files)
Provider-specific patterns (high confidence -- these are never false positives):
| Provider | Pattern | Example |
|---|---|---|
| OpenAI | sk-proj-[A-Za-z0-9]{20,} | sk-proj-abc123... |
| Anthropic | sk-ant-[A-Za-z0-9]{20,} | sk-ant-api03-... |
| Google/Gemini | AIza[A-Za-z0-9_-]{35} | AIzaSyC... |
| AWS Access Key | AKIA[A-Z0-9]{16} | AKIA... |
| AWS Secret Key | 40-char base64 after aws_secret | wJalrXUtnFEMI/K7MDENG/... |
| GitHub PAT | ghp_[A-Za-z0-9]{36} | ghp_xxxx... |
| GitHub OAuth | gho_[A-Za-z0-9]{36} | gho_xxxx... |
| GitHub App | ghu_[A-Za-z0-9]{36} or ghs_ | ghu_xxxx... |
| Stripe Live | sk_live_[A-Za-z0-9]{24,} | sk_live_... |
| Stripe Publishable | pk_live_[A-Za-z0-9]{24,} | pk_live_... |
| Slack Bot | xoxb-[0-9]{10,}-[A-Za-z0-9]{24} | xoxb-... |
| Slack User | xoxp-[0-9]{10,}-[0-9]{10,}- | xoxp-... |
| Twilio | SK[a-f0-9]{32} | SK... |
| SendGrid | SG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43} | SG.xxx.yyy |
| Mailgun | key-[a-f0-9]{32} | key-... |
| Firebase | AAAA[A-Za-z0-9_-]{7}:[A-Za-z0-9_-]{140} | AAAA... |
| Supabase | sbp_[a-f0-9]{40} | sbp_... |
| Vercel | vercel_[A-Za-z0-9]{24} | vercel_... |
Generic patterns:
(api_key|secret|token|password|credential)\s*[=:]\s*["'][^"']{10,}-----BEGIN (RSA|EC|OPENSSH|PGP) PRIVATE KEY-----(mongodb|postgres|mysql|redis)://[^@]+:[^@]+@eyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}Secrets in git history (even if removed from HEAD)
git log --all -p -S 'sk-' --diff-filter=D to find deleted secrets.env files ever committed: git log --all --diff-filter=A -- '*.env' '.env.*'git log --all --diff-filter=A -- '*.pem' '*.key' 'id_rsa'Tracked files that shouldn't be
.env, .env.local, .env.production*.pem, *.key, id_rsa, *.p12, *.pfxcredentials.json, service-account.json*.sqlite, *.db (may contain user data)Secrets in CI/CD configs
.github/workflows/*.yml for inline secrets (not using ${{ secrets.X }})echo or logging in CI scriptsGITHUB_TOKEN permissions are minimalSecrets in Docker
ARG or ENV with secret values in DockerfilesSecrets in comments, TODOs, or docs
// placeholder: replace with real key, # temp password:Secrets in AI agent logs (CRITICAL -- often overlooked)
Users paste secrets into Codex/Claude conversations. Agents read .env files into context. These get persisted in plaintext log files on disk.
Codex conversation logs:
# Codex stores full conversation history as JSONL
# Location: ~/.codex/projects/<project-hash>/*.jsonl
# Also: ~/.codex/projects/<project-hash>/subagents/*.jsonl
# Scan for provider-specific patterns in all conversation logs
grep -rn 'sk-proj-\|sk-ant-\|AKIA\|ghp_\|sk_live_\|AIza' \
~/.codex/projects/ 2>/dev/null | head -20
# Scan for generic secret patterns
grep -rn 'api_key.*=\|password.*=\|secret.*=\|token.*=' \
~/.codex/projects/ 2>/dev/null | grep -v '"type"' | head -20
Codex review logs:
# Codex review history
grep -n 'sk-proj-\|sk-ant-\|AKIA\|ghp_\|sk_live_' \
~/.codex/codex-commit-reviews.log 2>/dev/null
Codex file-based debugging:
# Temporary files from Codex debugging pattern
grep -n 'sk-proj-\|sk-ant-\|AKIA\|ghp_\|sk_live_' \
/tmp/question.txt /tmp/reply.txt 2>/dev/null
If secrets found in logs:
.jsonl files after rotation.~/.codex/settings.json deny list to prevent future reads.Critical finding: Any real secret in HEAD, history, or agent logs. Stop and alert immediately.
Rule: NEVER print the actual secret value. Report file, line number, and pattern matched only.
How it goes wrong: An endpoint gets added without auth middleware. A role check uses string comparison instead of proper RBAC. JWTs never expire. Rate limiting is missing on login.
Scan:
Missing authentication on endpoints
Broken access control patterns
req.params.id used directly without ownership checkJWT security
exp claim)none or HS256 with a weak secretSession management
HttpOnly, Secure, SameSite)Rate limiting
CSRF protection
Focus areas by framework:
helmet, express-rate-limit, csurf/csrf-csrfslowapi, auth dependencies, CORS middlewareCSRF_COOKIE_SECURE, SESSION_COOKIE_SECURE, SECURE_SSL_REDIRECTHow it goes wrong: User input flows into a SQL query, a shell command, an HTML template, or a file path without sanitization. AI-generated code is especially prone to this because models often write the "happy path" without considering malicious input.
Scan:
SQL injection
f"SELECT * FROM users WHERE id = {user_id}"Command injection
exec(), eval(), child_process.exec(), os.system(), subprocess.run(shell=True)Cross-site scripting (XSS)
dangerouslySetInnerHTML in React without sanitizationinnerHTML assignments with user datav-html in Vue without sanitizationPath traversal
../ sequences not strippedfs.readFile(req.params.filename) patternsServer-side request forgery (SSRF)
fetch(), requests.get(), http.get()Unsafe deserialization
pickle.loads() with untrusted data (Python)JSON.parse() on untrusted input followed by prototype accessload() instead of safe_load() (Python)ObjectInputStream with untrusted dataRegex denial of service (ReDoS)
(a+)+$, (a|a)*$File upload
How it goes wrong: Debug mode ships to production. CORS allows any origin. Security headers are missing. An admin panel is exposed. Error messages leak stack traces.
Scan:
Debug/development mode in production configs
DEBUG = True (Django), NODE_ENV !== 'production'CORS misconfiguration
Access-Control-Allow-Origin: * with credentialsMissing security headers
Content-Security-PolicyStrict-Transport-Security (HSTS)X-Frame-Options / frame-ancestorsX-Content-Type-Options: nosniffReferrer-PolicyPermissions-PolicyExposed endpoints
/admin, /dashboard, /debug)/swagger, /docs, /graphql).git/ directory in deployment configTLS/SSL
Error handling
How it goes wrong: Docker runs as root. A database port is exposed to the internet. Cloud IAM policies are too permissive. An S3 bucket is public.
Scan:
Dockerfile security
USER directive)latest tag (non-reproducible)curl, wget, netcat in production)--privileged flag in docker-composeDocker Compose / orchestration
0.0.0.0:5432:5432 instead of 127.0.0.1:5432:5432)Cloud configuration (if present)
0.0.0.0/0 on sensitive portsFile permissions
find . -type f -perm -o+wHow it goes wrong: Math.random() generates a session token. Sensitive data gets logged. A race condition allows double-spending. AI models love eval().
Scan:
Dangerous function usage
eval(), exec(), Function() constructordocument.write()__import__() with user inputsetInterval/setTimeout with string argumentsInsecure randomness
Math.random() for security-sensitive values (tokens, IDs, passwords)random module for cryptographic purposes (should use secrets)Sensitive data in logs
Cryptography issues
Race conditions
Error handling that leaks information
How it goes wrong: An AI agent has access to production secrets. LLM output gets injected into a SQL query. A prompt injection in user content causes the agent to exfiltrate data. AI-generated code has subtle vulnerabilities the model doesn't recognize.
This category is unique to AI-assisted development and is often missed by traditional security tools.
Scan:
Agent permission scope
~/.codex/settings.json deny list -- is it comprehensive?.env files, credential stores, SSH keys accessible to the agent?LLM output used in dangerous contexts
eval()'d at runtimePrompt injection surface
Context window data exposure
AI-generated code vulnerability patterns
Agent action guardrails
--no-verify)?How it goes wrong: A GitHub Action runs with write permissions when it only needs read. A workflow trigger on pull_request_target lets external PRs execute code with repo secrets. Secrets appear in CI logs.
Scan:
GitHub Actions permissions
permissions: write-all or missing permissions block (defaults to write)GITHUB_TOKEN permissions should be scopedWorkflow injection
pull_request_target trigger with actions/checkout of PR code (code injection)${{ github.event.issue.title }} in run: blocksAction pinning
Secret handling in CI
echo $SECRET or debug logging)Artifact security
How it goes wrong: There's no CODEOWNERS file so anyone can merge anything. Branch protection is off. There's no audit log. Nobody knows the incident response process because there isn't one.
Scan:
Branch protection
scripts/validate-github-protection.shCODEOWNERS
.github/CODEOWNERS exists?require_code_owner_review enabled in ruleset?Audit logging
Security documentation
docs/rules/trust-model.md or similar)SECURITY.md)Dependency management
Settings and deny list
~/.codex/settings.json blocks dangerous commandsRun all 10 categories in order. For each:
--quick)Run only Categories 1-2 (dependencies + secrets). Takes <2 minutes.
--focus <category>)Deep-dive a single category. Options: deps, secrets, auth, injection, config, infra, code, ai, cicd, governance.
| Level | Meaning | Action |
|---|---|---|
| Critical | Active exploitation risk. Leaked secrets, RCE, auth bypass. | Stop. Alert human immediately. Do not continue audit. |
| High | Exploitable with moderate effort. Known CVEs, SQL injection, missing auth. | Flag for immediate fix. Block PR if in pre-push. |
| Medium | Exploitable with specific conditions. Weak crypto, missing headers, debug mode. | Flag for fix in current sprint. |
| Low | Defense-in-depth gap. Missing rate limiting, verbose errors, outdated deps. | Track for future fix. |
| Info | Observation. Missing best practice, potential improvement. | Document. |
## Security Review - [date]
**Scope:** Full audit / Quick / Focus: [category]
**Repository:** [repo name]
**Branch:** [current branch]
### Critical Findings
- [None / list with file:line and description]
### Summary by Category
| # | Category | Findings | Severity |
|---|----------|----------|----------|
| 1 | Supply Chain | X issues | highest severity |
| 2 | Secrets | X issues | highest severity |
| 3 | Auth & Access | X issues | highest severity |
| 4 | Input Validation | X issues | highest severity |
| 5 | Configuration | X issues | highest severity |
| 6 | Infrastructure | X issues | highest severity |
| 7 | Code Quality | X issues | highest severity |
| 8 | AI/Agent Security | X issues | highest severity |
| 9 | CI/CD Pipeline | X issues | highest severity |
| 10 | Governance | X issues | highest severity |
### Detailed Findings
#### [Category Name]
**[SEVERITY] [Finding title]**
- File: `path/to/file.ts:42`
- Pattern: [what was detected]
- Risk: [what could happen]
- Fix: [specific remediation]
### Action Items (Priority Order)
1. [Critical/High items first]
2. [Medium items]
3. [Low items for backlog]
### Positive Findings
- [Things that are done well -- reinforcement matters]
Security's #1 job: protect the main branch. Everything else is secondary. If branch protection is misconfigured, fix that before anything else.
#2: Secrets never get recorded anywhere. Not in source, not in git history, not in agent logs. If a secret is found anywhere, the immediate action is rotation -- not cleanup.
For Categories 1-2, use the deterministic scanner:
# Quick: repo working tree only
scripts/scan-secrets.sh
# Full: also scan git history
scripts/scan-secrets.sh --history
# Everything: repo + history + agent conversation logs
scripts/scan-secrets.sh --all
This script uses exact regex patterns for all major providers (OpenAI, Anthropic, Google, AWS, GitHub, Stripe, Slack, etc.) and scans Codex/Claude log files at ~/.codex/projects/. No false negatives for known key formats.
The pre-push hook runs a lightweight version of this on every push. The full script runs as part of the periodic security review.
If Critical or High findings were reported, run /redteam to verify exploitability.
Pattern-matching finds possibilities; red teaming confirms realities.
/redteam -- Active exploit verification (confirms or disproves findings from this review)docs/rules/trust-model.md -- Trust boundaries and zero-trust philosophyscripts/scan-secrets.sh -- Deterministic secret scanner (standalone)/repo-assessment -- General code quality (runs at the same cadence).github/dependabot.yml -- Automated dependency updates (Category 1 prevention).github/CODEOWNERS -- Code ownership enforcement (Category 10)