Ralph Security — 100 Iterations (~30-60 min)
Comprehensive security audit with balanced depth and duration.
References
- Severity definitions and triage guidance
Instructions
Execution Engine
YOU MUST follow this loop for EVERY iteration:
- STATE: Read current iteration (start: 1)
- PHASE: Determine phase from iteration number
- ACTION: Perform ONE check from current phase
- VERIFY: Before reporting FAIL — read actual code, check if a library handles it (jose, bcrypt, passport, Auth0, etc.), check DB constraints, check environment gating. If inconclusive:
NEEDS_REVIEW, not FAIL.
- REPORT: Output iteration result
- SAVE: Every 10 iterations, update
.ralph-report.md
- INCREMENT: iteration = iteration + 1
- CONTINUE: IF iteration <= 100 GOTO Step 1
- FINAL: Generate comprehensive report
Critical rules:
- ONE check per iteration — deep, not wide
- ALWAYS show
[SEC-X/100]
- NEVER skip iterations
- CRITICAL findings: flag for immediate attention
Per-Iteration Output
══════════════════════════════════════════════════════════
[SEC-{N}/100] Phase {P}: {phase_name}
Check: {specific_check}
══════════════════════════════════════════════════════════
Target: {file/endpoint/system}
Result: {PASS|FAIL|WARN|N/A}
Confidence: {VERIFIED|LIKELY|PATTERN_MATCH|NEEDS_REVIEW}
Severity: {CRITICAL|HIGH|MEDIUM|LOW|INFO}
Finding: {description}
Fix: {recommendation or "N/A"}
──────────────────────────────────────────────────────────
Progress: [██████████░░░░░░░░░░] {N}%
──────────────────────────────────────────────────────────
Persona
Senior security engineer. Evidence-based mindset, defense in depth, fail secure, least privilege.
Phase Structure (100 Iterations)
| Phase |
Iterations |
Focus Area |
| 1 |
1-15 |
Reconnaissance & Sync |
| 2 |
16-45 |
OWASP Top 10 Analysis |
| 3 |
46-65 |
Authentication & Secrets |
| 4 |
66-85 |
Infrastructure Security |
| 5 |
86-100 |
Code Quality & Report |
Phase 1: Reconnaissance (1-15)
| Iter |
Check |
| 1 |
Auto-detect stack and infra |
| 2 |
Git sync: local vs remote |
| 3 |
Uncommitted sensitive files |
| 4 |
.env in .gitignore |
| 5 |
Public endpoints enumeration |
| 6 |
Authentication requirements mapping |
| 7 |
Rate limiting coverage |
| 8 |
Exposed ports (host/container) |
| 9 |
Hidden services discovery |
| 10 |
Cron jobs and scheduled tasks |
| 11 |
Environment variable audit |
| 12 |
Docker environment check |
| 13 |
Documentation vs reality |
| 14 |
Attack surface score |
| 15 |
Phase 1 summary |
Phase 2: OWASP Top 10 (16-45)
| Iter |
OWASP |
Check |
| 16-18 |
A01 |
Broken Access Control (IDOR, CORS, path traversal) |
| 19-21 |
A02 |
Cryptographic Failures (weak algos, key mgmt, TLS) |
| 22-27 |
A03 |
Injection (SQL, Command, XSS, Template, Log) |
| 28-30 |
A04 |
Insecure Design (missing controls, business logic) |
| 31-33 |
A05 |
Security Misconfiguration (debug, errors, headers) |
| 34-36 |
A06 |
Vulnerable Components (dependency audit) |
| 37-39 |
A07 |
Auth Failures (credential stuffing, session mgmt) |
| 40-42 |
A08 |
Integrity Failures (deserialization, CI/CD) |
| 43-44 |
A09 |
Logging Failures (coverage, security) |
| 45 |
A10 |
SSRF (URL validation, metadata protection) |
Phase 3: Authentication & Secrets (46-65)
Pre-check: Determine if codebase uses well-known libraries vs custom implementations. Library-handled crypto is generally safe — focus on USAGE errors.
| Iter |
Check |
| 46-50 |
Secret detection (API keys, passwords, tokens) |
| 51-55 |
JWT security (algorithm, claims, storage, revocation) |
| 56-58 |
OAuth 2.0 (PKCE, redirect URI, state) |
| 59-62 |
Admin authentication (brute force, timing, lockout) |
| 63-65 |
Rate limiting analysis (coverage, bypass) |
Phase 4: Infrastructure (66-85)
| Iter |
Check |
| 66-70 |
Container security (non-root, readonly, limits) |
| 71-75 |
Network security (ports, firewall, isolation) |
| 76-78 |
TLS/SSL (cert validity, ciphers, HSTS) |
| 79-81 |
SSH security (key auth, config hardening) |
| 82-85 |
Database security (SSL, permissions, access) |
Phase 5: Code Quality & Report (86-100)
Pre-check: Check database constraints before flagging race conditions.
| Iter |
Check |
| 86-88 |
Race conditions (TOCTOU, concurrent access) |
| 89-91 |
Business logic flaws (workflow, rate limit bypass) |
| 92-94 |
Error handling (safe messages, fail-safe) |
| 95-97 |
Resource management (connections, memory) |
| 98 |
Critical findings review |
| 99 |
Security scorecard generation |
| 100 |
Final report generation |
Auto-Detect (Iteration 1)
git rev-parse --show-toplevel, git remote -v
- Stack:
package.json, pyproject.toml, requirements.txt, go.mod
- Infra:
Dockerfile, docker-compose.yml, k8s manifests
- CI/CD:
.github/workflows, .gitlab-ci.yml
- Skip non-applicable checks, mark N/A
Report File
On start: rename existing .ralph-report.md to .ralph-report-{YYYY-MM-DD-HHmm}.md. Auto-save every 10 iterations.
Parameters
| Param |
Default |
Options |
--iterations |
100 |
1-200 |
--focus |
all |
recon, owasp, secrets, auth, infra, code, all |
--phase |
all |
1-5 |
--resume |
— |
Continue from checkpoint |
Context Limit Protocol
If approaching context limit: checkpoint to report file, output resume command, wait for new session.
When to Use
- Weekly security check
- New project onboarding
- Before major release
- Standard security audit
1---
2name: ralph-security
3description: "Comprehensive security audit with 100 iterations (~30-60 min). Use when user says 'security audit', 'ralph security', 'weekly security check', 'audit this project', 'new project security review', or 'check for vulnerabilities'. Covers OWASP Top 10, auth, secrets, infrastructure, and code quality."
4metadata:
5 source: https://skillmd.com/skills/modbender/ralph-security
6 openclaw:
7 emoji: 🛡️
8 author: dorukardahan
9 version: 2.0.0
10 category: security
11 tags:
12 - security
13 - audit
14 - owasp
15 - comprehensive
16---
17
18# Ralph Security — 100 Iterations (~30-60 min)
19
20Comprehensive security audit with balanced depth and duration.
21
22## References
23
24- [Severity definitions and triage guidance](references/severity-guide.md)
25
26## Instructions
27
28### Execution Engine
29
30YOU MUST follow this loop for EVERY iteration:
31
321. **STATE**: Read current iteration (start: 1)
332. **PHASE**: Determine phase from iteration number
343. **ACTION**: Perform ONE check from current phase
354. **VERIFY**: Before reporting FAIL — read actual code, check if a library handles it (jose, bcrypt, passport, Auth0, etc.), check DB constraints, check environment gating. If inconclusive: `NEEDS_REVIEW`, not `FAIL`.
365. **REPORT**: Output iteration result
376. **SAVE**: Every 10 iterations, update `.ralph-report.md`
387. **INCREMENT**: iteration = iteration + 1
398. **CONTINUE**: IF iteration <= 100 GOTO Step 1
409. **FINAL**: Generate comprehensive report
41
42**Critical rules:**
43- ONE check per iteration — deep, not wide
44- ALWAYS show `[SEC-X/100]`
45- NEVER skip iterations
46- CRITICAL findings: flag for immediate attention
47
48### Per-Iteration Output
49
50```
51══════════════════════════════════════════════════════════
52[SEC-{N}/100] Phase {P}: {phase_name}
53Check: {specific_check}
54══════════════════════════════════════════════════════════
55Target: {file/endpoint/system}
56Result: {PASS|FAIL|WARN|N/A}
57Confidence: {VERIFIED|LIKELY|PATTERN_MATCH|NEEDS_REVIEW}
58Severity: {CRITICAL|HIGH|MEDIUM|LOW|INFO}
59Finding: {description}
60Fix: {recommendation or "N/A"}
61──────────────────────────────────────────────────────────
62Progress: [██████████░░░░░░░░░░] {N}%
63──────────────────────────────────────────────────────────
64```
65
66### Persona
67
68Senior security engineer. Evidence-based mindset, defense in depth, fail secure, least privilege.
69
70### Phase Structure (100 Iterations)
71
72| Phase | Iterations | Focus Area |
73|-------|------------|------------|
74| 1 | 1-15 | Reconnaissance & Sync |
75| 2 | 16-45 | OWASP Top 10 Analysis |
76| 3 | 46-65 | Authentication & Secrets |
77| 4 | 66-85 | Infrastructure Security |
78| 5 | 86-100 | Code Quality & Report |
79
80### Phase 1: Reconnaissance (1-15)
81
82| Iter | Check |
83|------|-------|
84| 1 | Auto-detect stack and infra |
85| 2 | Git sync: local vs remote |
86| 3 | Uncommitted sensitive files |
87| 4 | .env in .gitignore |
88| 5 | Public endpoints enumeration |
89| 6 | Authentication requirements mapping |
90| 7 | Rate limiting coverage |
91| 8 | Exposed ports (host/container) |
92| 9 | Hidden services discovery |
93| 10 | Cron jobs and scheduled tasks |
94| 11 | Environment variable audit |
95| 12 | Docker environment check |
96| 13 | Documentation vs reality |
97| 14 | Attack surface score |
98| 15 | Phase 1 summary |
99
100### Phase 2: OWASP Top 10 (16-45)
101
102| Iter | OWASP | Check |
103|------|-------|-------|
104| 16-18 | A01 | Broken Access Control (IDOR, CORS, path traversal) |
105| 19-21 | A02 | Cryptographic Failures (weak algos, key mgmt, TLS) |
106| 22-27 | A03 | Injection (SQL, Command, XSS, Template, Log) |
107| 28-30 | A04 | Insecure Design (missing controls, business logic) |
108| 31-33 | A05 | Security Misconfiguration (debug, errors, headers) |
109| 34-36 | A06 | Vulnerable Components (dependency audit) |
110| 37-39 | A07 | Auth Failures (credential stuffing, session mgmt) |
111| 40-42 | A08 | Integrity Failures (deserialization, CI/CD) |
112| 43-44 | A09 | Logging Failures (coverage, security) |
113| 45 | A10 | SSRF (URL validation, metadata protection) |
114
115### Phase 3: Authentication & Secrets (46-65)
116
117**Pre-check:** Determine if codebase uses well-known libraries vs custom implementations. Library-handled crypto is generally safe — focus on USAGE errors.
118
119| Iter | Check |
120|------|-------|
121| 46-50 | Secret detection (API keys, passwords, tokens) |
122| 51-55 | JWT security (algorithm, claims, storage, revocation) |
123| 56-58 | OAuth 2.0 (PKCE, redirect URI, state) |
124| 59-62 | Admin authentication (brute force, timing, lockout) |
125| 63-65 | Rate limiting analysis (coverage, bypass) |
126
127### Phase 4: Infrastructure (66-85)
128
129| Iter | Check |
130|------|-------|
131| 66-70 | Container security (non-root, readonly, limits) |
132| 71-75 | Network security (ports, firewall, isolation) |
133| 76-78 | TLS/SSL (cert validity, ciphers, HSTS) |
134| 79-81 | SSH security (key auth, config hardening) |
135| 82-85 | Database security (SSL, permissions, access) |
136
137### Phase 5: Code Quality & Report (86-100)
138
139**Pre-check:** Check database constraints before flagging race conditions.
140
141| Iter | Check |
142|------|-------|
143| 86-88 | Race conditions (TOCTOU, concurrent access) |
144| 89-91 | Business logic flaws (workflow, rate limit bypass) |
145| 92-94 | Error handling (safe messages, fail-safe) |
146| 95-97 | Resource management (connections, memory) |
147| 98 | Critical findings review |
148| 99 | Security scorecard generation |
149| 100 | Final report generation |
150
151### Auto-Detect (Iteration 1)
152
1531. `git rev-parse --show-toplevel`, `git remote -v`
1542. Stack: `package.json`, `pyproject.toml`, `requirements.txt`, `go.mod`
1553. Infra: `Dockerfile`, `docker-compose.yml`, k8s manifests
1564. CI/CD: `.github/workflows`, `.gitlab-ci.yml`
1575. Skip non-applicable checks, mark N/A
158
159### Report File
160
161On start: rename existing `.ralph-report.md` to `.ralph-report-{YYYY-MM-DD-HHmm}.md`. Auto-save every 10 iterations.
162
163### Parameters
164
165| Param | Default | Options |
166|-------|---------|---------|
167| `--iterations` | 100 | 1-200 |
168| `--focus` | all | recon, owasp, secrets, auth, infra, code, all |
169| `--phase` | all | 1-5 |
170| `--resume` | — | Continue from checkpoint |
171
172### Context Limit Protocol
173
174If approaching context limit: checkpoint to report file, output resume command, wait for new session.
175
176### When to Use
177
178- Weekly security check
179- New project onboarding
180- Before major release
181- Standard security audit