bobs-workshop 0.3.3 → 3.1.1
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.
- package/LICENSE +2 -2
- package/README.md +199 -210
- package/bin/bobs-workshop.js +109 -0
- package/config/agents.json +27 -0
- package/dist/plugins/bobs-workshop.js +34 -0
- package/dist/tools/background-agent/cancel.d.ts +3 -0
- package/dist/tools/background-agent/cancel.d.ts.map +1 -0
- package/dist/tools/background-agent/cancel.js +52 -0
- package/dist/tools/background-agent/concurrency.d.ts +15 -0
- package/dist/tools/background-agent/concurrency.d.ts.map +1 -0
- package/dist/tools/background-agent/concurrency.js +61 -0
- package/dist/tools/background-agent/index.d.ts +8 -0
- package/dist/tools/background-agent/index.d.ts.map +1 -0
- package/dist/tools/background-agent/index.js +7 -0
- package/dist/tools/background-agent/launch.d.ts +6 -0
- package/dist/tools/background-agent/launch.d.ts.map +1 -0
- package/dist/tools/background-agent/launch.js +33 -0
- package/dist/tools/background-agent/list.d.ts +7 -0
- package/dist/tools/background-agent/list.d.ts.map +1 -0
- package/dist/tools/background-agent/list.js +40 -0
- package/dist/tools/background-agent/manager.d.ts +29 -0
- package/dist/tools/background-agent/manager.d.ts.map +1 -0
- package/dist/tools/background-agent/manager.js +388 -0
- package/dist/tools/background-agent/output.d.ts +3 -0
- package/dist/tools/background-agent/output.d.ts.map +1 -0
- package/dist/tools/background-agent/output.js +41 -0
- package/dist/tools/background-agent/types.d.ts +46 -0
- package/dist/tools/background-agent/types.d.ts.map +1 -0
- package/dist/tools/background-agent/types.js +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/manual/index.d.ts +3 -0
- package/dist/tools/manual/index.d.ts.map +1 -0
- package/dist/tools/manual/index.js +2 -0
- package/dist/tools/manual/manual-update.d.ts +4 -0
- package/dist/tools/manual/manual-update.d.ts.map +1 -0
- package/dist/tools/manual/manual-update.js +190 -0
- package/dist/tools/manual/verify-manual.d.ts +4 -0
- package/dist/tools/manual/verify-manual.d.ts.map +1 -0
- package/dist/tools/manual/verify-manual.js +51 -0
- package/package.json +34 -66
- package/postinstall.js +193 -0
- package/src/agents/alice.md +466 -0
- package/src/agents/bob-rev.md +493 -0
- package/src/agents/bob-send.md +277 -0
- package/src/agents/bob.md +442 -0
- package/src/agents/trace.md +451 -0
- package/src/plugins/bobs-workshop.ts +45 -0
- package/src/skills/api-patterns/SKILL.md +376 -0
- package/src/skills/architecture/SKILL.md +271 -0
- package/src/skills/bobs-workshop/performance/icon.svg +3 -0
- package/src/skills/brainstorming/SKILL.md +210 -0
- package/src/skills/clean-code/SKILL.md +151 -0
- package/src/skills/code-review-checklist/SKILL.md +220 -0
- package/src/skills/database-design/SKILL.md +271 -0
- package/src/skills/exploration/SKILL.md +257 -0
- package/src/skills/frontend-ui-ux/SKILL.md +78 -0
- package/src/skills/git-master/SKILL.md +1105 -0
- package/src/skills/performance/SKILL.md +144 -0
- package/src/skills/performance/icon.svg +3 -0
- package/src/skills/plan-writing/SKILL.md +225 -0
- package/src/skills/security/SKILL.md +410 -0
- package/src/skills/simplification/SKILL.md +238 -0
- package/src/skills/systematic-debugging/SKILL.md +175 -0
- package/src/skills/testing-patterns/SKILL.md +305 -0
- package/src/skills/verification/SKILL.md +286 -0
- package/src/tools/background-agent/cancel.ts +67 -0
- package/src/tools/background-agent/concurrency.ts +71 -0
- package/src/tools/background-agent/index.ts +7 -0
- package/src/tools/background-agent/launch.ts +39 -0
- package/src/tools/background-agent/list.ts +50 -0
- package/src/tools/background-agent/manager.ts +466 -0
- package/src/tools/background-agent/output.ts +57 -0
- package/src/tools/background-agent/types.ts +55 -0
- package/src/tools/index.ts +8 -0
- package/src/tools/manual/index.ts +2 -0
- package/src/tools/manual/manual-update.ts +197 -0
- package/src/tools/manual/verify-manual.ts +60 -0
- package/uninstall.js +64 -0
- package/Claude.md +0 -162
- package/bin/bobs-mcp-server.js +0 -11
- package/bin/bobs-mcp.js +0 -130
- package/dist/api/taskLogger.js +0 -106
- package/dist/api/taskLogger.js.map +0 -1
- package/dist/cli/checker.js +0 -401
- package/dist/cli/checker.js.map +0 -1
- package/dist/cli/cleanup.js +0 -131
- package/dist/cli/cleanup.js.map +0 -1
- package/dist/cli/debug.js +0 -157
- package/dist/cli/debug.js.map +0 -1
- package/dist/cli/health.js +0 -97
- package/dist/cli/health.js.map +0 -1
- package/dist/cli/setup.js +0 -81
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/workshop.js +0 -42
- package/dist/cli/workshop.js.map +0 -1
- package/dist/dashboard/server.js +0 -1203
- package/dist/dashboard/server.js.map +0 -1
- package/dist/index.js +0 -960
- package/dist/index.js.map +0 -1
- package/dist/prompts/architect.js +0 -221
- package/dist/prompts/architect.js.map +0 -1
- package/dist/prompts/debugger.js +0 -257
- package/dist/prompts/debugger.js.map +0 -1
- package/dist/prompts/engineer.js +0 -249
- package/dist/prompts/engineer.js.map +0 -1
- package/dist/prompts/orchestrator.js +0 -304
- package/dist/prompts/orchestrator.js.map +0 -1
- package/dist/prompts/reviewer.js +0 -289
- package/dist/prompts/reviewer.js.map +0 -1
- package/dist/services/activitySummarizer.js +0 -388
- package/dist/services/activitySummarizer.js.map +0 -1
- package/dist/services/changeValidator.js +0 -396
- package/dist/services/changeValidator.js.map +0 -1
- package/dist/services/claudeOrchestrator.js +0 -343
- package/dist/services/claudeOrchestrator.js.map +0 -1
- package/dist/services/fileMonitor.js +0 -250
- package/dist/services/fileMonitor.js.map +0 -1
- package/dist/services/implementationSummarizer.js +0 -306
- package/dist/services/implementationSummarizer.js.map +0 -1
- package/dist/services/liveMonitor.js +0 -315
- package/dist/services/liveMonitor.js.map +0 -1
- package/dist/services/mcpAuditLogger.js +0 -104
- package/dist/services/mcpAuditLogger.js.map +0 -1
- package/dist/services/mcpLogger.js +0 -223
- package/dist/services/mcpLogger.js.map +0 -1
- package/dist/services/tmuxManager.js +0 -541
- package/dist/services/tmuxManager.js.map +0 -1
- package/dist/tools/approvalTools.js +0 -244
- package/dist/tools/approvalTools.js.map +0 -1
- package/dist/tools/autoDebugger.js +0 -147
- package/dist/tools/autoDebugger.js.map +0 -1
- package/dist/tools/cleanupService.js +0 -221
- package/dist/tools/cleanupService.js.map +0 -1
- package/dist/tools/dashboardTools.js +0 -342
- package/dist/tools/dashboardTools.js.map +0 -1
- package/dist/tools/developmentNudges.js +0 -336
- package/dist/tools/developmentNudges.js.map +0 -1
- package/dist/tools/gitTools.js +0 -741
- package/dist/tools/gitTools.js.map +0 -1
- package/dist/tools/orchestratorTools.js +0 -832
- package/dist/tools/orchestratorTools.js.map +0 -1
- package/dist/tools/searchCache.js +0 -64
- package/dist/tools/searchCache.js.map +0 -1
- package/dist/tools/searchTools.js +0 -1107
- package/dist/tools/searchTools.js.map +0 -1
- package/dist/tools/semgrep-patterns.js +0 -296
- package/dist/tools/semgrep-patterns.js.map +0 -1
- package/dist/tools/specTools.js +0 -332
- package/dist/tools/specTools.js.map +0 -1
- package/dist/tools/structural/__tests__/orchestrator.test.js +0 -61
- package/dist/tools/structural/__tests__/orchestrator.test.js.map +0 -1
- package/dist/tools/structural/cache.js +0 -226
- package/dist/tools/structural/cache.js.map +0 -1
- package/dist/tools/structural/engines/python/index.js +0 -118
- package/dist/tools/structural/engines/python/index.js.map +0 -1
- package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js +0 -97
- package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js.map +0 -1
- package/dist/tools/structural/engines/typescript/analyzer.js +0 -433
- package/dist/tools/structural/engines/typescript/analyzer.js.map +0 -1
- package/dist/tools/structural/engines/typescript/index.js +0 -381
- package/dist/tools/structural/engines/typescript/index.js.map +0 -1
- package/dist/tools/structural/engines/typescript/utils.js +0 -279
- package/dist/tools/structural/engines/typescript/utils.js.map +0 -1
- package/dist/tools/structural/index.js +0 -248
- package/dist/tools/structural/index.js.map +0 -1
- package/dist/tools/structural/types.js +0 -18
- package/dist/tools/structural/types.js.map +0 -1
- package/dist/tools/tmuxTools.js +0 -100
- package/dist/tools/tmuxTools.js.map +0 -1
- package/dist/tools/workRecorder.js +0 -215
- package/dist/tools/workRecorder.js.map +0 -1
- package/dist/tools/worktreeTools.js +0 -705
- package/dist/tools/worktreeTools.js.map +0 -1
- package/dist/utils/__tests__/integration.test.js +0 -57
- package/dist/utils/__tests__/integration.test.js.map +0 -1
- package/dist/utils/__tests__/serverDetection.test.js +0 -151
- package/dist/utils/__tests__/serverDetection.test.js.map +0 -1
- package/dist/utils/errorHandling.js +0 -336
- package/dist/utils/errorHandling.js.map +0 -1
- package/dist/utils/processManager.js +0 -172
- package/dist/utils/processManager.js.map +0 -1
- package/dist/utils/reliability.js +0 -263
- package/dist/utils/reliability.js.map +0 -1
- package/dist/utils/responseFormatter.js +0 -250
- package/dist/utils/responseFormatter.js.map +0 -1
- package/dist/utils/serverDetection.js +0 -133
- package/dist/utils/serverDetection.js.map +0 -1
- package/dist/utils/specMigration.js +0 -105
- package/dist/utils/specMigration.js.map +0 -1
- package/dist/validation/schemas.js +0 -299
- package/dist/validation/schemas.js.map +0 -1
- package/public/.well-known/mcp/manifest.json +0 -473
- package/public/index.html +0 -3157
- package/public/index.html.backup +0 -2805
- package/public/index.html.backup2 +0 -1292
- package/scripts/cleanup-system-logs.ts +0 -121
- package/scripts/init-workspace.js +0 -63
- package/scripts/install-search-tools.js +0 -116
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security
|
|
3
|
+
description: Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization.
|
|
4
|
+
metadata:
|
|
5
|
+
recommended_for: bob-rev
|
|
6
|
+
category: security
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Security Skill
|
|
10
|
+
|
|
11
|
+
> Think like an attacker, defend like an expert. 2025 threat landscape awareness.
|
|
12
|
+
|
|
13
|
+
## 🔧 Runtime Scripts
|
|
14
|
+
|
|
15
|
+
**Execute for automated validation:**
|
|
16
|
+
|
|
17
|
+
| Script | Purpose | Usage |
|
|
18
|
+
|--------|---------|-------|
|
|
19
|
+
| `scripts/security_scan.py` | Validate security principles applied | `python scripts/security_scan.py <project_path>` |
|
|
20
|
+
|
|
21
|
+
## 📋 Reference Files
|
|
22
|
+
|
|
23
|
+
| File | Purpose |
|
|
24
|
+
|------|---------|
|
|
25
|
+
| [checklists.md](checklists.md) | OWASP Top 10, Auth, API, Data protection checklists |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 1. Security Expert Mindset
|
|
30
|
+
|
|
31
|
+
### Core Principles
|
|
32
|
+
|
|
33
|
+
| Principle | Application |
|
|
34
|
+
|-----------|-------------|
|
|
35
|
+
| **Assume Breach** | Design as if attacker already inside |
|
|
36
|
+
| **Zero Trust** | Never trust, always verify |
|
|
37
|
+
| **Defense in Depth** | Multiple layers, no single point |
|
|
38
|
+
| **Least Privilege** | Minimum required access only |
|
|
39
|
+
| **Fail Secure** | On error, deny access |
|
|
40
|
+
|
|
41
|
+
### Threat Modeling Questions
|
|
42
|
+
|
|
43
|
+
Before scanning, ask:
|
|
44
|
+
1. What are we protecting? (Assets)
|
|
45
|
+
2. Who would attack? (Threat actors)
|
|
46
|
+
3. How would they attack? (Attack vectors)
|
|
47
|
+
4. What's the impact? (Business risk)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. OWASP Top 10:2025
|
|
52
|
+
|
|
53
|
+
### Risk Categories
|
|
54
|
+
|
|
55
|
+
| Rank | Category | Think About |
|
|
56
|
+
|------|----------|-------------|
|
|
57
|
+
| **A01** | Broken Access Control | Who can access what? IDOR, SSRF |
|
|
58
|
+
| **A02** | Security Misconfiguration | Defaults, headers, exposed services |
|
|
59
|
+
| **A03** | Software Supply Chain 🆕 | Dependencies, CI/CD, build integrity |
|
|
60
|
+
| **A04** | Cryptographic Failures | Weak crypto, exposed secrets |
|
|
61
|
+
| **A05** | Injection | User input → system commands |
|
|
62
|
+
| **A06** | Insecure Design | Flawed architecture |
|
|
63
|
+
| **A07** | Authentication Failures | Session, credential management |
|
|
64
|
+
| **A08** | Integrity Failures | Unsigned updates, tampered data |
|
|
65
|
+
| **A09** | Logging & Alerting | Blind spots, no monitoring |
|
|
66
|
+
| **A10** | Exceptional Conditions 🆕 | Error handling, fail-open states |
|
|
67
|
+
|
|
68
|
+
### 2025 Key Changes
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
2021 → 2025 Shifts:
|
|
72
|
+
├── SSRF merged into A01 (Access Control)
|
|
73
|
+
├── A02 elevated (Cloud/Container configs)
|
|
74
|
+
├── A03 NEW: Supply Chain (major focus)
|
|
75
|
+
├── A10 NEW: Exceptional Conditions
|
|
76
|
+
└── Focus shift: Root causes > Symptoms
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 3. Supply Chain Security (A03)
|
|
82
|
+
|
|
83
|
+
### Attack Surface
|
|
84
|
+
|
|
85
|
+
| Vector | Risk | Question to Ask |
|
|
86
|
+
|--------|------|-----------------|
|
|
87
|
+
| **Dependencies** | Malicious packages | Do we audit new deps? |
|
|
88
|
+
| **Lock files** | Integrity attacks | Are they committed? |
|
|
89
|
+
| **Build pipeline** | CI/CD compromise | Who can modify? |
|
|
90
|
+
| **Registry** | Typosquatting | Verified sources? |
|
|
91
|
+
|
|
92
|
+
### Defense Principles
|
|
93
|
+
|
|
94
|
+
- Verify package integrity (checksums)
|
|
95
|
+
- Pin versions, audit updates
|
|
96
|
+
- Use private registries for critical deps
|
|
97
|
+
- Sign and verify artifacts
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 4. Attack Surface Mapping
|
|
102
|
+
|
|
103
|
+
### What to Map
|
|
104
|
+
|
|
105
|
+
| Category | Elements |
|
|
106
|
+
|----------|----------|
|
|
107
|
+
| **Entry Points** | APIs, forms, file uploads |
|
|
108
|
+
| **Data Flows** | Input → Process → Output |
|
|
109
|
+
| **Trust Boundaries** | Where auth/authz checked |
|
|
110
|
+
| **Assets** | Secrets, PII, business data |
|
|
111
|
+
|
|
112
|
+
### Prioritization Matrix
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
Risk = Likelihood × Impact
|
|
116
|
+
|
|
117
|
+
High Impact + High Likelihood → CRITICAL
|
|
118
|
+
High Impact + Low Likelihood → HIGH
|
|
119
|
+
Low Impact + High Likelihood → MEDIUM
|
|
120
|
+
Low Impact + Low Likelihood → LOW
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 5. Risk Prioritization
|
|
126
|
+
|
|
127
|
+
### CVSS + Context
|
|
128
|
+
|
|
129
|
+
| Factor | Weight | Question |
|
|
130
|
+
|--------|--------|----------|
|
|
131
|
+
| **CVSS Score** | Base severity | How severe is the vuln? |
|
|
132
|
+
| **EPSS Score** | Exploit likelihood | Is it being exploited? |
|
|
133
|
+
| **Asset Value** | Business context | What's at risk? |
|
|
134
|
+
| **Exposure** | Attack surface | Internet-facing? |
|
|
135
|
+
|
|
136
|
+
### Prioritization Decision Tree
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Is it actively exploited (EPSS >0.5)?
|
|
140
|
+
├── YES → CRITICAL: Immediate action
|
|
141
|
+
└── NO → Check CVSS
|
|
142
|
+
├── CVSS ≥9.0 → HIGH
|
|
143
|
+
├── CVSS 7.0-8.9 → Consider asset value
|
|
144
|
+
└── CVSS <7.0 → Schedule for later
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 6. Exceptional Conditions (A10 - New)
|
|
150
|
+
|
|
151
|
+
### Fail-Open vs Fail-Closed
|
|
152
|
+
|
|
153
|
+
| Scenario | Fail-Open (BAD) | Fail-Closed (GOOD) |
|
|
154
|
+
|----------|-----------------|---------------------|
|
|
155
|
+
| Auth error | Allow access | Deny access |
|
|
156
|
+
| Parsing fails | Accept input | Reject input |
|
|
157
|
+
| Timeout | Retry forever | Limit + abort |
|
|
158
|
+
|
|
159
|
+
### What to Check
|
|
160
|
+
|
|
161
|
+
- Exception handlers that catch-all and ignore
|
|
162
|
+
- Missing error handling on security operations
|
|
163
|
+
- Race conditions in auth/authz
|
|
164
|
+
- Resource exhaustion scenarios
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 7. Scanning Methodology
|
|
169
|
+
|
|
170
|
+
### Phase-Based Approach
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
1. RECONNAISSANCE
|
|
174
|
+
└── Understand the target
|
|
175
|
+
├── Technology stack
|
|
176
|
+
├── Entry points
|
|
177
|
+
└── Data flows
|
|
178
|
+
|
|
179
|
+
2. DISCOVERY
|
|
180
|
+
└── Identify potential issues
|
|
181
|
+
├── Configuration review
|
|
182
|
+
├── Dependency analysis
|
|
183
|
+
└── Code pattern search
|
|
184
|
+
|
|
185
|
+
3. ANALYSIS
|
|
186
|
+
└── Validate and prioritize
|
|
187
|
+
├── False positive elimination
|
|
188
|
+
├── Risk scoring
|
|
189
|
+
└── Attack chain mapping
|
|
190
|
+
|
|
191
|
+
4. REPORTING
|
|
192
|
+
└── Actionable findings
|
|
193
|
+
├── Clear reproduction steps
|
|
194
|
+
├── Business impact
|
|
195
|
+
└── Remediation guidance
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 8. Code Pattern Analysis
|
|
201
|
+
|
|
202
|
+
### High-Risk Patterns
|
|
203
|
+
|
|
204
|
+
| Pattern | Risk | Look For |
|
|
205
|
+
|---------|------|----------|
|
|
206
|
+
| **String concat in queries** | Injection | `"SELECT * FROM " + user_input` |
|
|
207
|
+
| **Dynamic code execution** | RCE | `eval()`, `exec()`, `Function()` |
|
|
208
|
+
| **Unsafe deserialization** | RCE | `pickle.loads()`, `unserialize()` |
|
|
209
|
+
| **Path manipulation** | Traversal | User input in file paths |
|
|
210
|
+
| **Disabled security** | Various | `verify=False`, `--insecure` |
|
|
211
|
+
|
|
212
|
+
### Secret Patterns
|
|
213
|
+
|
|
214
|
+
| Type | Indicators |
|
|
215
|
+
|------|-----------|
|
|
216
|
+
| API Keys | `api_key`, `apikey`, high entropy |
|
|
217
|
+
| Tokens | `token`, `bearer`, `jwt` |
|
|
218
|
+
| Credentials | `password`, `secret`, `key` |
|
|
219
|
+
| Cloud | `AWS_`, `AZURE_`, `GCP_` prefixes |
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## 9. Cloud Security Considerations
|
|
224
|
+
|
|
225
|
+
### Shared Responsibility
|
|
226
|
+
|
|
227
|
+
| Layer | You Own | Provider Owns |
|
|
228
|
+
|-------|---------|---------------|
|
|
229
|
+
| Data | ✅ | ❌ |
|
|
230
|
+
| Application | ✅ | ❌ |
|
|
231
|
+
| OS/Runtime | Depends | Depends |
|
|
232
|
+
| Infrastructure | ❌ | ✅ |
|
|
233
|
+
|
|
234
|
+
### Cloud-Specific Checks
|
|
235
|
+
|
|
236
|
+
- IAM: Least privilege applied?
|
|
237
|
+
- Storage: Public buckets?
|
|
238
|
+
- Network: Security groups tightened?
|
|
239
|
+
- Secrets: Using secrets manager?
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 10. Anti-Patterns
|
|
244
|
+
|
|
245
|
+
| ❌ Don't | ✅ Do |
|
|
246
|
+
|----------|-------|
|
|
247
|
+
| Scan without understanding | Map attack surface first |
|
|
248
|
+
| Alert on every CVE | Prioritize by exploitability + asset |
|
|
249
|
+
| Ignore false positives | Maintain verified baseline |
|
|
250
|
+
| Fix symptoms only | Address root causes |
|
|
251
|
+
| Scan once before deploy | Continuous scanning |
|
|
252
|
+
| Trust third-party deps blindly | Verify integrity, audit code |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 11. Reporting Principles
|
|
257
|
+
|
|
258
|
+
### Finding Structure
|
|
259
|
+
|
|
260
|
+
Each finding should answer:
|
|
261
|
+
1. **What?** - Clear vulnerability description
|
|
262
|
+
2. **Where?** - Exact location (file, line, endpoint)
|
|
263
|
+
3. **Why?** - Root cause explanation
|
|
264
|
+
4. **Impact?** - Business consequence
|
|
265
|
+
5. **How to fix?** - Specific remediation
|
|
266
|
+
|
|
267
|
+
### Severity Classification
|
|
268
|
+
|
|
269
|
+
| Severity | Criteria |
|
|
270
|
+
|----------|----------|
|
|
271
|
+
| **Critical** | RCE, auth bypass, mass data exposure |
|
|
272
|
+
| **High** | Data exposure, privilege escalation |
|
|
273
|
+
| **Medium** | Limited scope, requires conditions |
|
|
274
|
+
| **Low** | Informational, best practice |
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
> **Remember:** Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Bob's Workshop Integration
|
|
283
|
+
|
|
284
|
+
This skill is used by **bob-rev (reviewer)** agent during VERIFY phase and **trace (debugger)** during FIX phase.
|
|
285
|
+
|
|
286
|
+
### MANUAL Integration
|
|
287
|
+
|
|
288
|
+
Add security section to MANUAL:
|
|
289
|
+
```markdown
|
|
290
|
+
## 🔍 Review Notes
|
|
291
|
+
|
|
292
|
+
### Security Checklist
|
|
293
|
+
|
|
294
|
+
#### OWASP Top 10:2025
|
|
295
|
+
- [ ] **A01 Broken Access Control**: IDOR, SSRF, authorization checks
|
|
296
|
+
- [ ] **A02 Security Misconfiguration**: Default credentials, exposed admin panels
|
|
297
|
+
- [ ] **A03 Software Supply Chain**: Dependency audit, lock files, build integrity
|
|
298
|
+
- [ ] **A04 Cryptographic Failures**: Weak encryption, hardcoded secrets
|
|
299
|
+
- [ ] **A05 Injection**: SQL, NoSQL, command injection
|
|
300
|
+
- [ ] **A06 Insecure Design**: Architectural flaws
|
|
301
|
+
- [ ] **A07 Authentication Failures**: Session management, password policy
|
|
302
|
+
- [ ] **A08 Integrity Failures**: Unsigned artifacts, tampered data
|
|
303
|
+
- [ ] **A09 Logging & Alerting**: Security events, error handling
|
|
304
|
+
- [ ] **A10 Exceptional Conditions**: Fail-closed, error handling, resource limits
|
|
305
|
+
|
|
306
|
+
#### Attack Surface Mapping
|
|
307
|
+
- [ ] Entry points identified (APIs, forms, uploads)
|
|
308
|
+
- [ ] Data flows documented (input → process → output)
|
|
309
|
+
- [ ] Trust boundaries mapped (auth/authz locations)
|
|
310
|
+
- [ ] Assets cataloged (secrets, PII, business data)
|
|
311
|
+
|
|
312
|
+
#### Supply Chain Security
|
|
313
|
+
- [ ] Dependencies audited (npm audit, Snyk, etc.)
|
|
314
|
+
- [ ] Lock files committed
|
|
315
|
+
- [ ] CI/CD pipeline secured
|
|
316
|
+
- [ ] Registry verified (npm, PyPI, etc.)
|
|
317
|
+
|
|
318
|
+
#### Cloud Security (if applicable)
|
|
319
|
+
- [ ] IAM: Least privilege applied
|
|
320
|
+
- [ ] Storage: No public buckets
|
|
321
|
+
- [ ] Network: Security groups tightened
|
|
322
|
+
- [ ] Secrets: Using secrets manager (not hardcoded)
|
|
323
|
+
|
|
324
|
+
### Security Findings
|
|
325
|
+
|
|
326
|
+
| Severity | Finding | Location | Status |
|
|
327
|
+
|----------|-----------|-----------|--------|
|
|
328
|
+
| 🔴 CRITICAL | [Description] | [File:Line] | [Open/Resolved] |
|
|
329
|
+
| 🟠 HIGH | [Description] | [File:Line] | [Open/Resolved] |
|
|
330
|
+
| 🟡 MEDIUM | [Description] | [File:Line] | [Open/Resolved] |
|
|
331
|
+
| 🟢 LOW | [Description] | [File:Line] | [Open/Resolved] |
|
|
332
|
+
|
|
333
|
+
### Risk Prioritization
|
|
334
|
+
|
|
335
|
+
| Finding | CVSS | EPSS | Asset Value | Priority |
|
|
336
|
+
|----------|-------|-------|-------------|----------|
|
|
337
|
+
| [Finding] | [Score] | [Score] | [High/Med/Low] | [P0/P1/P2] |
|
|
338
|
+
|
|
339
|
+
### Review Decision (Security-Focused)
|
|
340
|
+
|
|
341
|
+
#### PASS Conditions
|
|
342
|
+
- No 🔴 CRITICAL issues
|
|
343
|
+
- No 🟠 HIGH issues
|
|
344
|
+
- Supply chain secure (dependencies audited)
|
|
345
|
+
- No hardcoded secrets in code
|
|
346
|
+
- Authentication and authorization properly implemented
|
|
347
|
+
|
|
348
|
+
#### FAIL Conditions
|
|
349
|
+
- Any 🔴 CRITICAL vulnerabilities
|
|
350
|
+
- Unresolved 🟠 HIGH vulnerabilities
|
|
351
|
+
- Hardcoded secrets/API keys found
|
|
352
|
+
- Supply chain vulnerabilities present
|
|
353
|
+
- Authentication bypass possible
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Handoff Format
|
|
357
|
+
|
|
358
|
+
```markdown
|
|
359
|
+
## 🤝 Agent Handoffs
|
|
360
|
+
|
|
361
|
+
🤝 bob-rev: Security review complete - 0 critical, 2 medium
|
|
362
|
+
🤝 bob-rev → trace: [FAIL - Security vulnerabilities found, please fix]
|
|
363
|
+
🤝 bob-rev → bob-send: [PASS - Security checks passed]
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Debugging Integration
|
|
367
|
+
|
|
368
|
+
When trace (debugger) investigates security issues:
|
|
369
|
+
```markdown
|
|
370
|
+
## 🔍 Debug Logs
|
|
371
|
+
|
|
372
|
+
### Security Issue Analysis
|
|
373
|
+
|
|
374
|
+
#### Issue Summary
|
|
375
|
+
- **Finding ID:** [SEC-001]
|
|
376
|
+
- **Severity:** [Critical/High/Medium/Low]
|
|
377
|
+
- **Category:** [OWASP Category]
|
|
378
|
+
|
|
379
|
+
#### Root Cause Analysis
|
|
380
|
+
- **Vulnerability:** [Description]
|
|
381
|
+
- **Location:** [File:Line]
|
|
382
|
+
- **Root Cause:** [Why does this exist?]
|
|
383
|
+
|
|
384
|
+
#### Attack Scenario
|
|
385
|
+
1. [Attacker step 1]
|
|
386
|
+
2. [Attacker step 2]
|
|
387
|
+
3. [Impact: data theft/access breach]
|
|
388
|
+
|
|
389
|
+
#### Fix Verification
|
|
390
|
+
- [ ] Fix implemented
|
|
391
|
+
- [ ] Vulnerability no longer exploitable
|
|
392
|
+
- [ ] Similar code reviewed and fixed
|
|
393
|
+
- [ ] Security test added
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Best Practices Reminder
|
|
397
|
+
|
|
398
|
+
**When reviewing security:**
|
|
399
|
+
- Always prioritize by exploitability + asset value
|
|
400
|
+
- Don't just scan - understand the business context
|
|
401
|
+
- Map attack surfaces before diving into code
|
|
402
|
+
- Consider supply chain security (not just your code)
|
|
403
|
+
- Think like an attacker: "What would I do?"
|
|
404
|
+
|
|
405
|
+
**Common mistakes to avoid:**
|
|
406
|
+
- Trusting third-party dependencies blindly
|
|
407
|
+
- Ignoring error handling (fail-open vs fail-closed)
|
|
408
|
+
- Hardcoding secrets in config files
|
|
409
|
+
- Assuming user input is safe
|
|
410
|
+
- Forgetting to revoke access/permissions
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: simplification
|
|
3
|
+
description: "Optional polish pass for verified code. Simplifies without changing behavior. Use when: 'cleanup', 'polish', 'simplify', 'reduce complexity', 'dead code', 'refactor for clarity'. CRITICAL: Tests MUST pass after each change."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Simplification Skill
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
Use this skill as an **optional polish pass** after code has been verified and reviewed. It's for simplification, not rewriting.
|
|
11
|
+
|
|
12
|
+
**Good triggers**:
|
|
13
|
+
- "Clean up this implementation"
|
|
14
|
+
- "Remove unnecessary complexity"
|
|
15
|
+
- "Polish before shipping"
|
|
16
|
+
- "Simplify without changing behavior"
|
|
17
|
+
|
|
18
|
+
**Bad triggers**:
|
|
19
|
+
- "Rewrite this module" (too broad)
|
|
20
|
+
- "Improve performance" (different goal)
|
|
21
|
+
- "Add features" (wrong skill entirely)
|
|
22
|
+
|
|
23
|
+
## Core Principle
|
|
24
|
+
|
|
25
|
+
> "Preserve exact behavior. Tests MUST still pass after each change."
|
|
26
|
+
|
|
27
|
+
You're not here to improve architecture. You're here to remove unnecessary complexity from **working code**.
|
|
28
|
+
|
|
29
|
+
## Prerequisites (GATE)
|
|
30
|
+
|
|
31
|
+
Before running this skill:
|
|
32
|
+
|
|
33
|
+
1. **Code must be verified working** - Tests pass, lint clean
|
|
34
|
+
2. **Human approved the polish pass** - Not automatic
|
|
35
|
+
3. **All changes are committed** - Clean working directory
|
|
36
|
+
|
|
37
|
+
**If any prerequisite fails, DO NOT PROCEED.**
|
|
38
|
+
|
|
39
|
+
## The Simplification Process
|
|
40
|
+
|
|
41
|
+
**One change at a time. Test after each. Revert on failure.**
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1. Read implementation
|
|
45
|
+
└─► Identify ONE simplification opportunity
|
|
46
|
+
|
|
47
|
+
2. Make the change
|
|
48
|
+
└─► Use edit tool (not complete rewrite)
|
|
49
|
+
|
|
50
|
+
3. Run tests
|
|
51
|
+
└─► npm test | pytest | cargo test
|
|
52
|
+
|
|
53
|
+
4. Tests pass?
|
|
54
|
+
├─► Yes: Record change, continue to step 1
|
|
55
|
+
└─► No: Revert change, try different simplification
|
|
56
|
+
|
|
57
|
+
5. Repeat until:
|
|
58
|
+
├─► No more improvements found, OR
|
|
59
|
+
├─► 3 passes complete, OR
|
|
60
|
+
└─► 3 consecutive failures (THREE-STRIKE RULE)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Simplification Targets
|
|
64
|
+
|
|
65
|
+
| Target | Action | Example |
|
|
66
|
+
|--------|--------|---------|
|
|
67
|
+
| Single-use helper | Inline it | `getUser()` called once → inline the query |
|
|
68
|
+
| Dead code | Delete it | Unused function → remove entirely |
|
|
69
|
+
| Unclear name | Rename it | `x` → `connectionPool` |
|
|
70
|
+
| Deep nesting | Flatten it | if/if/if → early returns |
|
|
71
|
+
| Redundant wrapper | Remove it | Class that just wraps another class |
|
|
72
|
+
| Unnecessary abstraction | Inline it | Factory that creates one type |
|
|
73
|
+
|
|
74
|
+
### Single-Use Helper Detection
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// BEFORE: Helper used once
|
|
78
|
+
function formatUserName(user: User): string {
|
|
79
|
+
return `${user.firstName} ${user.lastName}`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function displayUser(user: User) {
|
|
83
|
+
console.log(formatUserName(user)); // Only usage
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// AFTER: Inlined
|
|
87
|
+
function displayUser(user: User) {
|
|
88
|
+
console.log(`${user.firstName} ${user.lastName}`);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Flatten Nesting
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// BEFORE: Deep nesting
|
|
96
|
+
function process(data: Data) {
|
|
97
|
+
if (data) {
|
|
98
|
+
if (data.valid) {
|
|
99
|
+
if (data.items.length > 0) {
|
|
100
|
+
return transform(data.items);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// AFTER: Early returns
|
|
108
|
+
function process(data: Data) {
|
|
109
|
+
if (!data) return null;
|
|
110
|
+
if (!data.valid) return null;
|
|
111
|
+
if (data.items.length === 0) return null;
|
|
112
|
+
return transform(data.items);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Red Flags — DON'T Simplify These
|
|
117
|
+
|
|
118
|
+
| Pattern | Risk |
|
|
119
|
+
|---------|------|
|
|
120
|
+
| Helper with `console.log` | Side effect will be lost |
|
|
121
|
+
| Helper with `await` | Timing may change |
|
|
122
|
+
| Helper with global mutation | Side effect will be lost |
|
|
123
|
+
| Helper with event emission | Subscribers may break |
|
|
124
|
+
| Code used via reflection | Static analysis misses it |
|
|
125
|
+
| Code in hot path | Performance may degrade |
|
|
126
|
+
|
|
127
|
+
**If in doubt, don't simplify it.**
|
|
128
|
+
|
|
129
|
+
## Three-Strike Rule
|
|
130
|
+
|
|
131
|
+
After 3 consecutive failed simplifications, **STOP**:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
Simplification 1 → Tests fail → Revert
|
|
135
|
+
Simplification 2 → Tests fail → Revert
|
|
136
|
+
Simplification 3 → Tests fail → Revert
|
|
137
|
+
STOP: Code is more fragile than expected
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Report this clearly. Don't keep trying.**
|
|
141
|
+
|
|
142
|
+
## Rollback Procedure
|
|
143
|
+
|
|
144
|
+
If tests fail after a change:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Revert the specific file
|
|
148
|
+
git checkout -- path/to/modified/file.ts
|
|
149
|
+
|
|
150
|
+
# Or revert all unstaged changes
|
|
151
|
+
git checkout -- .
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Record the failure** for the report.
|
|
155
|
+
|
|
156
|
+
## Running Tests
|
|
157
|
+
|
|
158
|
+
After EVERY change, run tests:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Detect test command
|
|
162
|
+
if [ -f "package.json" ]; then
|
|
163
|
+
npm test
|
|
164
|
+
elif [ -f "pytest.ini" ] || [ -f "pyproject.toml" ]; then
|
|
165
|
+
pytest
|
|
166
|
+
elif [ -f "Cargo.toml" ]; then
|
|
167
|
+
cargo test
|
|
168
|
+
fi
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Test timeout**: 2 minutes. If tests hang, revert and skip this simplification.
|
|
172
|
+
|
|
173
|
+
## Forbidden Changes
|
|
174
|
+
|
|
175
|
+
| Forbidden | Why |
|
|
176
|
+
|-----------|-----|
|
|
177
|
+
| Add features | Scope creep |
|
|
178
|
+
| Change public APIs | Breaks consumers |
|
|
179
|
+
| Refactor unrelated code | Stay focused |
|
|
180
|
+
| Subjective style changes | Not simplification |
|
|
181
|
+
| "Improve" clear code | If it works and is clear, leave it |
|
|
182
|
+
|
|
183
|
+
## Output Format
|
|
184
|
+
|
|
185
|
+
Document all changes made:
|
|
186
|
+
|
|
187
|
+
```markdown
|
|
188
|
+
## Simplification Report
|
|
189
|
+
|
|
190
|
+
**Started**: [Timestamp]
|
|
191
|
+
**Completed**: [Timestamp]
|
|
192
|
+
|
|
193
|
+
### Changes Made
|
|
194
|
+
1. **[file:line]** - Inlined single-use helper `formatDate()`
|
|
195
|
+
- Lines removed: 8
|
|
196
|
+
- Lines added: 2
|
|
197
|
+
|
|
198
|
+
2. **[file:line]** - Removed unused function `legacyAuth()`
|
|
199
|
+
- Lines removed: 15
|
|
200
|
+
- Lines added: 0
|
|
201
|
+
|
|
202
|
+
### Changes Reverted
|
|
203
|
+
1. **[file:line]** - Attempted to flatten query builder conditionals
|
|
204
|
+
- Reason: Test 'db.handles-concurrent' failed
|
|
205
|
+
- Reverted: ✓
|
|
206
|
+
|
|
207
|
+
### Summary
|
|
208
|
+
- Simplifications made: 2
|
|
209
|
+
- Simplifications reverted: 1
|
|
210
|
+
- Passes completed: 2
|
|
211
|
+
- Tests still pass: ✓
|
|
212
|
+
- Net lines: -21
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Quality Over Quantity
|
|
216
|
+
|
|
217
|
+
**A good polish pass might change nothing.**
|
|
218
|
+
|
|
219
|
+
If the code is already simple and clear:
|
|
220
|
+
- Report "No simplifications needed"
|
|
221
|
+
- This is a valid outcome
|
|
222
|
+
- Don't force changes for the sake of it
|
|
223
|
+
|
|
224
|
+
## Anti-Patterns
|
|
225
|
+
|
|
226
|
+
**Don't do these:**
|
|
227
|
+
|
|
228
|
+
- Making changes without testing
|
|
229
|
+
- Batch-changing multiple files at once
|
|
230
|
+
- Subjective "this would be cleaner" changes
|
|
231
|
+
- Ignoring test failures
|
|
232
|
+
- Continuing after 3 consecutive failures
|
|
233
|
+
- Simplifying code you don't understand
|
|
234
|
+
- Removing "unused" code without checking for dynamic access
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
**Remember**: This is a POLISH pass, not a rewrite. Preserve behavior. Test constantly. Stop when the code is clean or when you hit resistance.
|