izanagi-ai 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/AGENTS.md +53 -0
  2. package/CHANGELOG.md +198 -0
  3. package/LICENSE +21 -0
  4. package/README.md +96 -0
  5. package/ROADMAP.md +131 -0
  6. package/RULES.md +202 -0
  7. package/SYSTEM.md +201 -0
  8. package/agents/INDEX.md +40 -0
  9. package/agents/architect-agent.json +15 -0
  10. package/agents/bug-hunter-agent.json +14 -0
  11. package/agents/database-agent.json +14 -0
  12. package/agents/devops-agent.json +15 -0
  13. package/agents/docs-agent.json +15 -0
  14. package/agents/pm-agent.json +14 -0
  15. package/agents/professor-agent.json +15 -0
  16. package/agents/security-agent.json +14 -0
  17. package/agents/senior-engineer-agent.json +16 -0
  18. package/agents/techlead-agent.json +15 -0
  19. package/architecture/clean-architecture.md +98 -0
  20. package/architecture/cqrs-specialist.md +102 -0
  21. package/architecture/ddd-specialist.md +97 -0
  22. package/architecture/event-driven-architect.md +79 -0
  23. package/architecture/hexagonal-architecture.md +96 -0
  24. package/architecture/microservices-expert.md +83 -0
  25. package/architecture/monolith-expert.md +67 -0
  26. package/architecture/repository-pattern.md +73 -0
  27. package/architecture/unit-of-work.md +92 -0
  28. package/backend/README.md +29 -0
  29. package/bin/nexus.js +8 -0
  30. package/core/compression-engine.md +194 -0
  31. package/core/context-engine.md +239 -0
  32. package/core/decision-engine.md +377 -0
  33. package/core/evolution-engine.md +169 -0
  34. package/core/planning-engine.md +201 -0
  35. package/core/quality-gates.md +233 -0
  36. package/core/reflection-engine.md +182 -0
  37. package/core/skill-resolver.json +169 -0
  38. package/core/token-manager.md +152 -0
  39. package/database/database-engineer.md +244 -0
  40. package/database/mysql-specialist.md +61 -0
  41. package/database/postgresql-specialist.md +70 -0
  42. package/database/redis-specialist.md +73 -0
  43. package/database/sql-optimizer.md +95 -0
  44. package/database/sqlserver-specialist.md +69 -0
  45. package/devops/ci-cd-specialist.md +101 -0
  46. package/devops/devops-engineer.md +358 -0
  47. package/devops/docker-expert.md +105 -0
  48. package/devops/git-expert.md +76 -0
  49. package/devops/git-flow-specialist.md +71 -0
  50. package/devops/kubernetes-specialist.md +84 -0
  51. package/devops/linux-specialist.md +82 -0
  52. package/devops/windows-specialist.md +43 -0
  53. package/dist/cli/commands/compile.d.ts +2 -0
  54. package/dist/cli/commands/compile.d.ts.map +1 -0
  55. package/dist/cli/commands/compile.js +44 -0
  56. package/dist/cli/commands/compile.js.map +1 -0
  57. package/dist/cli/commands/doctor.d.ts +2 -0
  58. package/dist/cli/commands/doctor.d.ts.map +1 -0
  59. package/dist/cli/commands/doctor.js +88 -0
  60. package/dist/cli/commands/doctor.js.map +1 -0
  61. package/dist/cli/commands/init.d.ts +2 -0
  62. package/dist/cli/commands/init.d.ts.map +1 -0
  63. package/dist/cli/commands/init.js +26 -0
  64. package/dist/cli/commands/init.js.map +1 -0
  65. package/dist/cli/commands/list.d.ts +2 -0
  66. package/dist/cli/commands/list.d.ts.map +1 -0
  67. package/dist/cli/commands/list.js +50 -0
  68. package/dist/cli/commands/list.js.map +1 -0
  69. package/dist/cli/commands/run.d.ts +2 -0
  70. package/dist/cli/commands/run.d.ts.map +1 -0
  71. package/dist/cli/commands/run.js +49 -0
  72. package/dist/cli/commands/run.js.map +1 -0
  73. package/dist/cli/index.d.ts +2 -0
  74. package/dist/cli/index.d.ts.map +1 -0
  75. package/dist/cli/index.js +72 -0
  76. package/dist/cli/index.js.map +1 -0
  77. package/dist/index.d.ts +3 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +3 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/installer.d.ts +5 -0
  82. package/dist/installer.d.ts.map +1 -0
  83. package/dist/installer.js +86 -0
  84. package/dist/installer.js.map +1 -0
  85. package/dist/postinstall.d.ts +2 -0
  86. package/dist/postinstall.d.ts.map +1 -0
  87. package/dist/postinstall.js +8 -0
  88. package/dist/postinstall.js.map +1 -0
  89. package/frontend/README.md +19 -0
  90. package/memory/context-recovery.md +49 -0
  91. package/memory/conversation-summarizer.md +65 -0
  92. package/memory/long-term-project-memory.md +58 -0
  93. package/memory/memory-manager.md +299 -0
  94. package/memory/session-compression.md +182 -0
  95. package/memory/smart-recall.md +37 -0
  96. package/optimization/compact-example.md +87 -0
  97. package/optimization/cost-optimizer.md +53 -0
  98. package/optimization/prompt-optimizer.md +194 -0
  99. package/optimization/token-audit.md +177 -0
  100. package/optimization/token-reducer.md +202 -0
  101. package/package.json +67 -0
  102. package/security/owasp-auditor.md +249 -0
  103. package/security/pentest-reviewer.md +109 -0
  104. package/security/security-engineer.md +238 -0
  105. package/skills/INDEX.md +434 -0
  106. package/skills/accessibility-reviewer.md +63 -0
  107. package/skills/agentic-coding.md +56 -0
  108. package/skills/ai-agent/SKILL.md +107 -0
  109. package/skills/ai-agent-dev/SKILL.md +117 -0
  110. package/skills/alternative-solution-generator.md +72 -0
  111. package/skills/architecture-patterns/SKILL.md +113 -0
  112. package/skills/breaking-change-detector.md +84 -0
  113. package/skills/bug-hunter.md +234 -0
  114. package/skills/bug-prevention.md +75 -0
  115. package/skills/chaos-engineering/SKILL.md +108 -0
  116. package/skills/clean-code-validator.md +218 -0
  117. package/skills/cloud-architect/SKILL.md +78 -0
  118. package/skills/cloud-infra/SKILL.md +99 -0
  119. package/skills/code-auditor.md +24 -0
  120. package/skills/complexity-analyzer.md +102 -0
  121. package/skills/confidence-estimator.md +53 -0
  122. package/skills/continuous-improvement.md +46 -0
  123. package/skills/continuous-learning-engine.md +51 -0
  124. package/skills/cto-advisor.md +66 -0
  125. package/skills/data-engineer/SKILL.md +76 -0
  126. package/skills/data-engineering/SKILL.md +82 -0
  127. package/skills/debug-specialist.md +215 -0
  128. package/skills/dependency-analyzer.md +78 -0
  129. package/skills/design-pattern-advisor.md +78 -0
  130. package/skills/documentation-writer.md +66 -0
  131. package/skills/dry-kiss-yagni-validator.md +114 -0
  132. package/skills/economia-tokens/SKILL.md +40 -0
  133. package/skills/er-diagram-builder.md +85 -0
  134. package/skills/feature-flags/SKILL.md +95 -0
  135. package/skills/frontend/SKILL.md +327 -0
  136. package/skills/frontend-dev/SKILL.md +178 -0
  137. package/skills/graphql/SKILL.md +104 -0
  138. package/skills/hallucination-detection.md +49 -0
  139. package/skills/handoff-sessao/SKILL.md +32 -0
  140. package/skills/i18n-l10n/SKILL.md +103 -0
  141. package/skills/iac-terraform/SKILL.md +98 -0
  142. package/skills/legacy-migration/SKILL.md +91 -0
  143. package/skills/logging-expert.md +78 -0
  144. package/skills/mcp-server-dev.md +33 -0
  145. package/skills/memoria-projeto/SKILL.md +49 -0
  146. package/skills/mobile-dev/SKILL.md +82 -0
  147. package/skills/mobile-engineer/SKILL.md +74 -0
  148. package/skills/monitoring-specialist.md +59 -0
  149. package/skills/observability-expert.md +60 -0
  150. package/skills/performance-optimizer.md +239 -0
  151. package/skills/principal-engineer.md +55 -0
  152. package/skills/privacy-engineer/SKILL.md +79 -0
  153. package/skills/professor-modo/SKILL.md +33 -0
  154. package/skills/project-manager.md +74 -0
  155. package/skills/prompt-engineering.md +27 -0
  156. package/skills/qa/SKILL.md +231 -0
  157. package/skills/qa-engineer/SKILL.md +222 -0
  158. package/skills/readme-generator.md +42 -0
  159. package/skills/refactoring-specialist.md +250 -0
  160. package/skills/release-planner.md +70 -0
  161. package/skills/requirement-analyzer.md +65 -0
  162. package/skills/risk-analyzer.md +73 -0
  163. package/skills/root-cause-analyzer.md +210 -0
  164. package/skills/scalability-expert.md +73 -0
  165. package/skills/security-privacy/SKILL.md +98 -0
  166. package/skills/self-correction.md +54 -0
  167. package/skills/self-critique.md +42 -0
  168. package/skills/senior-code-reviewer.md +193 -0
  169. package/skills/sequence-diagram-builder.md +56 -0
  170. package/skills/serverless-edge/SKILL.md +103 -0
  171. package/skills/software-architect.md +356 -0
  172. package/skills/solid-validator.md +332 -0
  173. package/skills/sre-reliability/SKILL.md +115 -0
  174. package/skills/staff-engineer.md +61 -0
  175. package/skills/task-planner.md +61 -0
  176. package/skills/tech-lead.md +59 -0
  177. package/skills/technical-debt-analyzer.md +81 -0
  178. package/skills/technical-writer.md +39 -0
  179. package/skills/tradeoff-analyzer.md +79 -0
  180. package/skills/uml-generator.md +72 -0
  181. package/skills/ux-reviewer.md +61 -0
  182. package/skills/wasm/SKILL.md +133 -0
  183. package/skills/web-perf-engineer/SKILL.md +75 -0
  184. package/skills/web-perf-seo/SKILL.md +111 -0
  185. package/skills/websocket-realtime/SKILL.md +107 -0
  186. package/teaching/adaptive-teaching.md +37 -0
  187. package/teaching/code-explainer.md +172 -0
  188. package/teaching/interactive-teaching.md +41 -0
  189. package/teaching/learning-tracker.md +63 -0
  190. package/teaching/mentor-mode.md +200 -0
  191. package/teaching/professor-mode.md +222 -0
  192. package/testing/e2e-test-engineer.md +68 -0
  193. package/testing/integration-test-engineer.md +74 -0
  194. package/testing/mocking-specialist.md +78 -0
  195. package/testing/unit-test-engineer.md +209 -0
@@ -0,0 +1,249 @@
1
+ # Security: OWASP Auditor
2
+
3
+ > Version 1.0.0
4
+ > Priority: Critical
5
+ > Dependencies: Security Engineer
6
+ > Compatibility: ">=1.0.0"
7
+
8
+ ---
9
+
10
+ ## Identity
11
+
12
+ The OWASP Auditor systematically checks code and configuration against the OWASP Top 10 web application security risks. It produces a severity-graded report with evidence, remediation steps, and CVE references where applicable. It is the deepest security skill in the framework.
13
+
14
+ ---
15
+
16
+ ## Goals
17
+
18
+ - Check every output against all OWASP Top 10 categories.
19
+ - Provide severity-graded findings (CVSS-based).
20
+ - Include evidence (code snippet, line number).
21
+ - Provide remediation steps for every finding.
22
+ - Reference CVEs for known vulnerable components.
23
+
24
+ ---
25
+
26
+ ## Triggers
27
+
28
+ | Condition | Action |
29
+ |-----------|--------|
30
+ | After any code output | OWASP audit |
31
+ | `task == "security_audit"` or `task == "owasp"` | Full OWASP audit |
32
+ | Before production deploy | Mandatory OWASP audit |
33
+ | After dependency update | Check for known CVEs |
34
+ | `task == "pentest"` | Deep security review |
35
+
36
+ ---
37
+
38
+ ## OWASP Top 10 Audit
39
+
40
+ ### A01: Broken Access Control
41
+
42
+ - [ ] Authorization check on every endpoint
43
+ - [ ] No IDOR (Insecure Direct Object Reference)
44
+ - [ ] Role-based access control (RBAC) implemented
45
+ - [ ] Principle of least privilege applied
46
+ - [ ] No hardcoded admin accounts
47
+ - [ ] API endpoints scoped by permission
48
+
49
+ ### A02: Cryptographic Failures
50
+
51
+ - [ ] Passwords hashed (bcrypt/argon2), not encrypted
52
+ - [ ] HTTPS enforced (HSTS header)
53
+ - [ ] No weak ciphers in TLS configuration
54
+ - [ ] JWTs signed and verified
55
+ - [ ] No hardcoded secrets or keys
56
+ - [ ] Sensitive data encrypted at rest
57
+
58
+ ### A03: Injection
59
+
60
+ - [ ] Parameterized queries (no string concatenation)
61
+ - [ ] Input validation on all user-supplied data
62
+ - [ ] Output escaping (context-aware: HTML, JS, CSS, URL)
63
+ - [ ] ORM used instead of raw SQL where possible
64
+ - [ ] No eval(), exec(), system() with user input
65
+
66
+ ### A04: Insecure Design
67
+
68
+ - [ ] Rate limiting on public endpoints
69
+ - [ ] Request throttling on auth endpoints
70
+ - [ ] Proper error messages (no stack traces to users)
71
+ - [ ] Secure defaults (no default passwords)
72
+ - [ ] Feature flags for new functionality
73
+
74
+ ### A05: Security Misconfiguration
75
+
76
+ - [ ] CORS configured (specific origins, not wildcard)
77
+ - [ ] Security headers set (CSP, X-Frame-Options, HSTS, X-Content-Type-Options)
78
+ - [ ] Debug mode disabled in production
79
+ - [ ] Default credentials changed
80
+ - [ ] Unused services and ports disabled
81
+
82
+ ### A06: Vulnerable Components
83
+
84
+ - [ ] `composer audit` or `npm audit` run
85
+ - [ ] Dependencies up to date (no known CVEs)
86
+ - [ ] No deprecated packages
87
+ - [ ] Lock files committed (composer.lock, package-lock.json)
88
+ - [ ] Regular dependency update schedule
89
+
90
+ ### A07: Identification and Authentication Failures
91
+
92
+ - [ ] MFA support for admin accounts
93
+ - [ ] Password policy (min length, complexity)
94
+ - [ ] Session management (timeout, rotation)
95
+ - [ ] No default or weak credentials
96
+ - [ ] Account lockout after failed attempts
97
+
98
+ ### A08: Software and Data Integrity Failures
99
+
100
+ - [ ] Signed JWTs (not unsigned)
101
+ - [ ] CSRF tokens on state-changing requests
102
+ - [ ] Integrity checks on file uploads
103
+ - [ ] Signed commits (GPG)
104
+ - [ ] No tampered dependencies (lock files)
105
+
106
+ ### A09: Security Logging and Monitoring Failures
107
+
108
+ - [ ] Authentication attempts logged
109
+ - [ ] Authorization failures logged
110
+ - [ ] Input validation failures logged
111
+ - [ ] Logs include timestamp, user, IP, action
112
+ - [ ] No sensitive data in logs (passwords, tokens)
113
+
114
+ ### A10: SSRF
115
+
116
+ - [ ] URL validation (allowlist allowed hosts)
117
+ - [ ] No user input passed directly to file_get_contents, curl, etc.
118
+ - [ ] Internal network not exposed to user input
119
+ - [ ] Outbound network restrictions
120
+
121
+ ---
122
+
123
+ ## CVSS Severity
124
+
125
+ ```yaml
126
+ severity_levels:
127
+ critical: 9.0 - 10.0
128
+ action: "Block delivery immediately. Fix required before any output."
129
+
130
+ high: 7.0 - 8.9
131
+ action: "Block delivery. Fix recommended before merge."
132
+
133
+ medium: 4.0 - 6.9
134
+ action: "Warn. Should fix before production deploy."
135
+
136
+ low: 0.1 - 3.9
137
+ action: "Inform. Consider fixing in next sprint."
138
+
139
+ info: 0.0
140
+ action: "Informational. No action required."
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Audit Report Template
146
+
147
+ ```yaml
148
+ owasp_audit:
149
+ target: "app/Http/Controllers/UserController.php"
150
+ date: "2026-07-17"
151
+ overall_score: 85 / 100
152
+
153
+ findings:
154
+ - owasp: "A01: Broken Access Control"
155
+ severity: "high (7.5)"
156
+ location: "UserController::update(42)"
157
+ evidence: "No authorization check. Any user can update any user's profile."
158
+ impact: "Privilege escalation — user A can modify user B's data."
159
+ remediation: "Add Gate::authorize('update', $user) before update logic."
160
+ cve: null
161
+
162
+ - owasp: "A05: Security Misconfiguration"
163
+ severity: "medium (5.0)"
164
+ location: "config/cors.php:15"
165
+ evidence: "Allowed origins set to '*'"
166
+ impact: "Any domain can make cross-origin requests."
167
+ remediation: "Restrict to specific origins: env('APP_URL') or a whitelist."
168
+ cve: null
169
+
170
+ - owasp: "A03: Injection"
171
+ severity: "info (0.0)"
172
+ location: "UserController"
173
+ evidence: "All queries use Eloquent ORM — no raw SQL found."
174
+ impact: "No injection vector detected."
175
+ remediation: null
176
+ cve: null
177
+
178
+ summary:
179
+ critical: 0
180
+ high: 1
181
+ medium: 1
182
+ low: 0
183
+ info: 8
184
+ passed: 8 / 10
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Automated Scan Commands
190
+
191
+ ```bash
192
+ # PHP
193
+ composer audit # Check for known CVE in dependencies
194
+ vendor/bin/security-checker security:check composer.lock
195
+ php artisan security:check # Laravel-specific scan
196
+
197
+ # JavaScript
198
+ npm audit # Check for known CVE
199
+ npx snyk test # Deep dependency scan
200
+
201
+ # General
202
+ trivy filesystem --severity CRITICAL,HIGH .
203
+ gitleaks detect --source . # Secrets scan
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Rules
209
+
210
+ ### Always
211
+
212
+ - ✅ Run all 10 OWASP categories on every audit.
213
+ - ✅ Severity-grade findings using CVSS.
214
+ - ✅ Provide remediation steps for every finding.
215
+ - ✅ Include evidence (line number, code snippet).
216
+ - ✅ Reference CVEs when known.
217
+
218
+ ### Never
219
+
220
+ - ❌ Skip categories because "this code doesn't do that".
221
+ - ❌ Report findings without remediation steps.
222
+ - ❌ Ignore low-severity findings (they accumulate).
223
+ - ❌ Deliver code with critical or high OWASP findings.
224
+
225
+ ---
226
+
227
+ ## Metrics
228
+
229
+ | Metric | Target | How to Measure |
230
+ |--------|--------|---------------|
231
+ | OWASP categories checked | 10/10 per audit | Count per report |
232
+ | Critical findings | 0 | Count in audit report |
233
+ | High findings | 0 | Count in audit report |
234
+ | Remediation provided | 100% | Findings with remediation / total |
235
+ | Pass rate | ≥ 80% | Categories passed / total |
236
+
237
+ ---
238
+
239
+ ## Changelog
240
+
241
+ ### 1.0.0 (2026-07-17)
242
+
243
+ - Initial release
244
+ - Full OWASP Top 10 audit with checklists (6-10 items each)
245
+ - CVSS severity grading (critical → info)
246
+ - Structured audit report in YAML
247
+ - Remediation steps for every finding
248
+ - Automated scan commands
249
+ - CVE referencing for known vulnerabilities
@@ -0,0 +1,109 @@
1
+ # Security: Pentest Reviewer
2
+
3
+ > Version 1.0.0 | Priority: Critical
4
+ > Dependencies: OWASP Auditor, Security Engineer
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Pentest Reviewer performs manual and automated penetration testing against the application. Simulates real-world attacks: injection, XSS, CSRF, SSRF, IDOR, privilege escalation, and authentication bypass.
12
+
13
+ ---
14
+
15
+ ## Pentest Workflow
16
+
17
+ ```
18
+ 1. Reconnaissance
19
+ - Map endpoints and parameters
20
+ - Identify auth mechanisms
21
+ - Note technologies and versions
22
+ ↓
23
+ 2. Automated Scan
24
+ - OWASP ZAP / Burp Suite passive scan
25
+ - Nuclei for known CVEs
26
+ ↓
27
+ 3. Manual Testing (per category)
28
+ - See attack categories below
29
+ ↓
30
+ 4. Privilege Escalation
31
+ - Low-privilege user tries to access admin endpoints
32
+ - IDOR testing (change IDs in requests)
33
+ ↓
34
+ 5. Report
35
+ - Findings with severity, evidence, reproduction, fix
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Attack Categories
41
+
42
+ ### IDOR (Insecure Direct Object Reference)
43
+
44
+ ```
45
+ Test: /api/users/123 → change to /api/users/456
46
+ Pass: Returns 403/404
47
+ Fail: Returns another user's data
48
+ Fix: Authorization check on every resource access
49
+ ```
50
+
51
+ ### Privilege Escalation
52
+
53
+ ```
54
+ Test: Standard user sends PATCH /api/users/123 with {"role": "admin"}
55
+ Pass: Returns 403
56
+ Fail: User promotes themselves to admin
57
+ Fix: Server-side role validation (not client-side)
58
+ ```
59
+
60
+ ### Mass Assignment
61
+
62
+ ```
63
+ Test: POST /api/users with {"name": "test", "is_admin": true}
64
+ Pass: is_admin ignored
65
+ Fail: User created with admin role
66
+ Fix: Use Form Request with only() or validated()
67
+ ```
68
+
69
+ ### SSRF
70
+
71
+ ```
72
+ Test: POST /api/import with {"url": "http://169.254.169.254/latest/meta-data/"}
73
+ Pass: Returns error or sanitized response
74
+ Fail: Returns cloud metadata (AWS credentials)
75
+ Fix: URL allowlist, block private IP ranges
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Report Format
81
+
82
+ ```yaml
83
+ finding:
84
+ title: "IDOR on user profile endpoint"
85
+ severity: "high"
86
+ cvss: 7.5
87
+
88
+ endpoint: "GET /api/v1/users/{id}"
89
+ auth: "Bearer token (standard user)"
90
+
91
+ reproduction:
92
+ - "Login as user A (token_abc)"
93
+ - "GET /api/v1/users/456 (user B's ID)"
94
+ - "Response: user B's full profile data"
95
+
96
+ impact: "Unauthorized access to any user's PII"
97
+
98
+ remediation:
99
+ - "Add Gate::authorize('view', User::find($id))"
100
+ - "Or use $request->user() instead of parameter"
101
+
102
+ retest: "✅ Fixed — 403 returned for unauthorized access"
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Changelog
108
+
109
+ ### 1.0.0 — Initial release. Workflow, attack categories, report format.
@@ -0,0 +1,238 @@
1
+ # Security: Security Engineer
2
+
3
+ > Version 1.0.0
4
+ > Priority: Critical
5
+ > Dependencies: OWASP Auditor, Secrets Analyzer
6
+ > Compatibility: ">=1.0.0"
7
+
8
+ ---
9
+
10
+ ## Identity
11
+
12
+ The Security Engineer is embedded in every skill chain where code is produced or reviewed. It validates all output against OWASP Top 10, checks for secrets exposure, ensures authentication and authorization are properly implemented, and blocks any output that introduces vulnerabilities.
13
+
14
+ ---
15
+
16
+ ## Goals
17
+
18
+ - Zero vulnerabilities delivered to the user.
19
+ - 100% of OWASP Top 10 checked on every code output.
20
+ - No secrets, credentials, or tokens ever leaked.
21
+ - Authentication and authorization implemented correctly by default.
22
+ - Every endpoint has rate limiting, input validation, and output escaping.
23
+
24
+ ---
25
+
26
+ ## Triggers
27
+
28
+ | Condition | Action |
29
+ |-----------|--------|
30
+ | Any code output | Full security scan |
31
+ | Any database query | SQL injection check |
32
+ | Any authentication code | Auth pattern validation |
33
+ | Any API endpoint | Rate limiting + auth check |
34
+ | Any file upload | Upload validation check |
35
+ | Any third-party integration | Secrets exposure check |
36
+ | `task == "security_audit"` | Full audit mode |
37
+
38
+ ---
39
+
40
+ ## OWASP Top 10 Checklist
41
+
42
+ - [ ] **A01: Broken Access Control** — verify authorization on every endpoint
43
+ - [ ] **A02: Cryptographic Failures** — no plaintext passwords, no weak ciphers
44
+ - [ ] **A03: Injection** — parameterized queries, input validation, output escaping
45
+ - [ ] **A04: Insecure Design** — rate limiting, request throttling, proper error messages
46
+ - [ ] **A05: Security Misconfiguration** — no default credentials, CORS configured, headers set
47
+ - [ ] **A06: Vulnerable Components** — check dependency versions, no known CVEs
48
+ - [ ] **A07: Auth Failures** — MFA support, password policy, session management
49
+ - [ ] **A08: Integrity Failures** — signed JWTs, CSRF tokens, integrity checks
50
+ - **A09: Logging Failures** — audit logs, no sensitive data in logs
51
+ - **A10: SSRF** — validate URLs, whitelist allowed hosts
52
+
53
+ ---
54
+
55
+ ## Workflow
56
+
57
+ ```
58
+ 1. Receive code or configuration from skill chain
59
+ ↓
60
+ 2. Parse for security-relevant patterns
61
+ ↓
62
+ 3. Run OWASP Top 10 checks
63
+ ↓
64
+ 4. Scan for secrets (regex patterns)
65
+ ↓
66
+ 5. Validate authentication (if applicable)
67
+ ↓
68
+ 6. Validate authorization (if applicable)
69
+ ↓
70
+ 7. Check rate limiting (if endpoint)
71
+ ↓
72
+ 8. Check input validation
73
+ ↓
74
+ 9. Check output escaping
75
+ ↓
76
+ 10. Generate security report
77
+ ↓
78
+ 11. If any FAIL → block output → notify Reflection Engine
79
+ ↓
80
+ 12. If all PASS → append security report → deliver
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Secrets Detection
86
+
87
+ ### Patterns Scanned
88
+
89
+ ```yaml
90
+ patterns:
91
+ - name: "AWS Access Key"
92
+ regex: "AKIA[0-9A-Z]{16}"
93
+ severity: "critical"
94
+
95
+ - name: "GitHub Token"
96
+ regex: "ghp_[a-zA-Z0-9]{36}"
97
+ severity: "critical"
98
+
99
+ - name: "Generic API Key"
100
+ regex: "(api[_-]?key|apikey|secret)[=:]['\"']?[a-zA-Z0-9_\-]{16,}"
101
+ severity: "high"
102
+
103
+ - name: "JWT Token"
104
+ regex: "eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+"
105
+ severity: "high"
106
+
107
+ - name: "Private Key"
108
+ regex: "-----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----"
109
+ severity: "critical"
110
+
111
+ - name: "Password in Code"
112
+ regex: "password[=:]['\"'][a-zA-Z0-9!@#$%^&*()_+\-=\[\]{}]{6,}['\"']"
113
+ severity: "high"
114
+
115
+ - name: "Connection String"
116
+ regex: "(mysql|postgres|mongodb|redis)://[a-zA-Z0-9]+:[a-zA-Z0-9]+@"
117
+ severity: "critical"
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Security Report Format
123
+
124
+ ```yaml
125
+ security_report:
126
+ status: "✅ PASS" | "❌ BLOCKED"
127
+
128
+ owasp:
129
+ passed: 10 / 10
130
+ failed: []
131
+ warnings: ["A05: CORS not explicitly configured"]
132
+
133
+ secrets:
134
+ scanned: 15
135
+ found: 0
136
+
137
+ auth:
138
+ method: "JWT in httpOnly cookies"
139
+ weaknesses: []
140
+
141
+ rate_limiting:
142
+ enabled: true
143
+ limit: "60 requests/minute"
144
+
145
+ input_validation:
146
+ status: "✅ PASS"
147
+ details: "All inputs validated via Form Request"
148
+
149
+ output_escaping:
150
+ status: "✅ PASS"
151
+ details: "Blade auto-escapes, JS uses encodeURIComponent"
152
+
153
+ recommendations:
154
+ - "Add Content-Security-Policy header"
155
+ - "Implement rate limiting on password reset endpoint"
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Code Patterns — Safe vs Unsafe
161
+
162
+ ### SQL Injection
163
+
164
+ ```php
165
+ // ❌ UNSAFE
166
+ DB::select("SELECT * FROM users WHERE id = $id");
167
+
168
+ // ✅ SAFE
169
+ DB::select("SELECT * FROM users WHERE id = ?", [$id]);
170
+ ```
171
+
172
+ ### XSS
173
+
174
+ ```php
175
+ // ❌ UNSAFE
176
+ <h1>{{ $title }}</h1> <!-- if $title contains <script> -->
177
+
178
+ // ✅ SAFE (Blade auto-escapes)
179
+ <h1>{{ $title }}</h1>
180
+ ```
181
+
182
+ ### File Upload
183
+
184
+ ```php
185
+ // ❌ UNSAFE
186
+ $request->file('avatar')->store('avatars');
187
+
188
+ // ✅ SAFE
189
+ $request->validate([
190
+ 'avatar' => 'required|image|mimes:jpg,png|max:2048'
191
+ ]);
192
+ $path = $request->file('avatar')->store('avatars', 's3');
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Rules
198
+
199
+ ### Always
200
+
201
+ - ✅ Run on every code output, every time.
202
+ - ✅ Block output on critical severity findings.
203
+ - ✅ Explain the vulnerability and how to fix it (teaching moment).
204
+ - ✅ Include security recommendations even when passing.
205
+ - ✅ Log all findings for Reflection Engine.
206
+
207
+ ### Never
208
+
209
+ - ❌ Output code containing secrets, ever.
210
+ - ❌ Suggest rolling your own cryptography.
211
+ - ❌ Skip rate limiting on public endpoints.
212
+ - ❌ Store passwords in plaintext or with weak hashes.
213
+ - ❌ Trust user input without validation.
214
+
215
+ ---
216
+
217
+ ## Metrics
218
+
219
+ | Metric | Target | How to Measure |
220
+ |--------|--------|---------------|
221
+ | Vulnerabilities delivered | 0 | Count of post-delivery vulnerability reports |
222
+ | Scan coverage | 100% | Code outputs scanned / total code outputs |
223
+ | Secrets leaked | 0 | Count of secrets detected in output |
224
+ | Fix rate | ≥ 95% | Vulnerabilities found vs fixed before delivery |
225
+
226
+ ---
227
+
228
+ ## Changelog
229
+
230
+ ### 1.0.0 (2026-07-17)
231
+
232
+ - Initial release
233
+ - OWASP Top 10 full checklist
234
+ - Secrets detection with regex pattern matching
235
+ - Auth, rate limiting, input validation, output escaping checks
236
+ - Security report appended to every output
237
+ - Critical findings block delivery
238
+ - Teaching moment integration (explains vulnerability + fix)