telo3-ai 5.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/AI-CONTEXT.md +263 -0
- package/LICENSE +21 -0
- package/ONBOARDING-SKILL.md +728 -0
- package/README.md +801 -0
- package/SKILL-METADATA.json +237 -0
- package/SKILL.md +666 -0
- package/cli.js +84 -0
- package/index.js +65 -0
- package/package.json +97 -0
- package/references/accessibility-quality.md +278 -0
- package/references/ai-behavior.md +363 -0
- package/references/document-specification.md +425 -0
- package/references/legal-compliance.md +408 -0
- package/references/performance-quality.md +351 -0
- package/references/privacy-compliance.md +494 -0
- package/references/project-audit.md +468 -0
- package/references/security-quality.md +254 -0
- package/references/seo-quality.md +347 -0
- package/references/smart-skill-delegation.md +451 -0
- package/references/token-optimization.md +481 -0
- package/references/ui-quality.md +491 -0
- package/references/workflow.md +474 -0
- package/scripts/init-project-context.sh +139 -0
- package/scripts/validate-project-context.sh +164 -0
- package/templates/architecture.md +418 -0
- package/templates/design.md +654 -0
- package/templates/memory.md +368 -0
- package/templates/prd.md +320 -0
- package/templates/rules.md +619 -0
- package/templates/tasks.md +220 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# Project Audit Framework
|
|
2
|
+
|
|
3
|
+
> Comprehensive audit procedures for systematic project review.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to Run an Audit
|
|
8
|
+
|
|
9
|
+
- Starting work on an existing project
|
|
10
|
+
- After significant implementation phase
|
|
11
|
+
- Before major release
|
|
12
|
+
- When quality concerns arise
|
|
13
|
+
- Periodically (quarterly or milestone-based)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Audit Categories
|
|
18
|
+
|
|
19
|
+
### 1. Product Alignment
|
|
20
|
+
### 2. Architecture Consistency
|
|
21
|
+
### 3. Code Quality
|
|
22
|
+
### 4. UI/UX Quality
|
|
23
|
+
### 5. SEO (if applicable)
|
|
24
|
+
### 6. Security
|
|
25
|
+
### 7. Privacy
|
|
26
|
+
### 8. Legal/Compliance
|
|
27
|
+
### 9. Accessibility
|
|
28
|
+
### 10. Performance
|
|
29
|
+
### 11. Documentation
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 1. Product Alignment Audit
|
|
34
|
+
|
|
35
|
+
**Check against prd.md:**
|
|
36
|
+
|
|
37
|
+
- [ ] Implemented features match documented requirements
|
|
38
|
+
- [ ] Scope hasn't drifted from documented goals
|
|
39
|
+
- [ ] Non-goals are still respected
|
|
40
|
+
- [ ] Success criteria are measurable
|
|
41
|
+
- [ ] Product decisions are documented
|
|
42
|
+
|
|
43
|
+
**Red flags:**
|
|
44
|
+
- Features that don't match PRD
|
|
45
|
+
- Scope creep
|
|
46
|
+
- Forgotten requirements
|
|
47
|
+
- Undocumented product decisions
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. Architecture Consistency Audit
|
|
52
|
+
|
|
53
|
+
**Check against architecture.md:**
|
|
54
|
+
|
|
55
|
+
- [ ] Tech stack matches documentation
|
|
56
|
+
- [ ] File structure follows documented organization
|
|
57
|
+
- [ ] Data flow matches documented patterns
|
|
58
|
+
- [ ] APIs follow documented conventions
|
|
59
|
+
- [ ] External services match documentation
|
|
60
|
+
- [ ] Architectural decisions are followed
|
|
61
|
+
|
|
62
|
+
**Red flags:**
|
|
63
|
+
- Undocumented technology additions
|
|
64
|
+
- Inconsistent file organization
|
|
65
|
+
- Multiple patterns for the same thing
|
|
66
|
+
- Architectural drift
|
|
67
|
+
- Ignored architectural decisions
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 3. Code Quality Audit
|
|
72
|
+
|
|
73
|
+
**Check against rules.md:**
|
|
74
|
+
|
|
75
|
+
- [ ] Naming conventions are consistent
|
|
76
|
+
- [ ] Code organization follows standards
|
|
77
|
+
- [ ] Functions are appropriately sized
|
|
78
|
+
- [ ] Duplication is minimal
|
|
79
|
+
- [ ] Error handling is present
|
|
80
|
+
- [ ] Comments explain "why" not "what"
|
|
81
|
+
- [ ] Dead code is removed
|
|
82
|
+
- [ ] Dependencies are justified
|
|
83
|
+
|
|
84
|
+
**Red flags:**
|
|
85
|
+
- Inconsistent naming
|
|
86
|
+
- God functions/classes
|
|
87
|
+
- Copy-paste code
|
|
88
|
+
- Missing error handling
|
|
89
|
+
- Excessive complexity
|
|
90
|
+
- Unjustified dependencies
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 4. UI/UX Quality Audit
|
|
95
|
+
|
|
96
|
+
**Check against design.md and ui-quality.md:**
|
|
97
|
+
|
|
98
|
+
- [ ] Design system is followed consistently
|
|
99
|
+
- [ ] Colors are from documented palette
|
|
100
|
+
- [ ] Typography follows type scale
|
|
101
|
+
- [ ] Spacing uses documented scale
|
|
102
|
+
- [ ] Components reuse existing patterns
|
|
103
|
+
- [ ] No generic AI aesthetic without justification
|
|
104
|
+
- [ ] Interactive patterns are consistent
|
|
105
|
+
- [ ] Responsive behavior works
|
|
106
|
+
|
|
107
|
+
**Red flags:**
|
|
108
|
+
- Vibe-coded patterns (harsh gradients, excessive effects)
|
|
109
|
+
- Inconsistent component styles
|
|
110
|
+
- Random color choices
|
|
111
|
+
- Inconsistent spacing
|
|
112
|
+
- Duplicated components
|
|
113
|
+
- Generic "AI aesthetic" without purpose
|
|
114
|
+
|
|
115
|
+
**See `ui-quality.md` for detailed anti-vibe-coding checks.**
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 5. SEO Audit (if applicable)
|
|
120
|
+
|
|
121
|
+
**Check against seo-quality.md:**
|
|
122
|
+
|
|
123
|
+
- [ ] Unique meta titles on all pages
|
|
124
|
+
- [ ] Unique meta descriptions on all pages
|
|
125
|
+
- [ ] Canonical URLs set
|
|
126
|
+
- [ ] Open Graph tags present
|
|
127
|
+
- [ ] Sitemap.xml exists and is current
|
|
128
|
+
- [ ] robots.txt configured correctly
|
|
129
|
+
- [ ] Images have descriptive alt text
|
|
130
|
+
- [ ] Heading hierarchy is correct
|
|
131
|
+
- [ ] URLs are clean and descriptive
|
|
132
|
+
- [ ] Core Web Vitals are good
|
|
133
|
+
- [ ] Mobile-friendly
|
|
134
|
+
|
|
135
|
+
**Red flags:**
|
|
136
|
+
- Duplicate or missing meta tags
|
|
137
|
+
- Missing sitemap
|
|
138
|
+
- Broken internal links
|
|
139
|
+
- Poor mobile experience
|
|
140
|
+
- Slow page load
|
|
141
|
+
- Missing alt text
|
|
142
|
+
|
|
143
|
+
**See `seo-quality.md` for complete checklist.**
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 6. Security Audit
|
|
148
|
+
|
|
149
|
+
**Check against security-quality.md:**
|
|
150
|
+
|
|
151
|
+
- [ ] Passwords are hashed properly
|
|
152
|
+
- [ ] Authorization is enforced on all endpoints
|
|
153
|
+
- [ ] Input validation is comprehensive
|
|
154
|
+
- [ ] SQL/NoSQL injection is prevented
|
|
155
|
+
- [ ] XSS is prevented
|
|
156
|
+
- [ ] CSRF protection is implemented
|
|
157
|
+
- [ ] Secrets are not exposed
|
|
158
|
+
- [ ] Security headers are set
|
|
159
|
+
- [ ] HTTPS is enforced
|
|
160
|
+
- [ ] Dependencies are audited
|
|
161
|
+
|
|
162
|
+
**Red flags:**
|
|
163
|
+
- Hardcoded secrets
|
|
164
|
+
- Missing authorization checks
|
|
165
|
+
- SQL queries with string interpolation
|
|
166
|
+
- Unvalidated user input
|
|
167
|
+
- Missing security headers
|
|
168
|
+
- Vulnerable dependencies
|
|
169
|
+
|
|
170
|
+
**See `security-quality.md` for detailed security checks.**
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 7. Privacy Audit
|
|
175
|
+
|
|
176
|
+
**Check against privacy-compliance.md:**
|
|
177
|
+
|
|
178
|
+
- [ ] Data collection is documented
|
|
179
|
+
- [ ] Third-party services are documented
|
|
180
|
+
- [ ] Cookies are documented
|
|
181
|
+
- [ ] Privacy policy exists and is accurate
|
|
182
|
+
- [ ] Consent mechanisms where required
|
|
183
|
+
- [ ] Data deletion is supported where required
|
|
184
|
+
- [ ] Sensitive data is protected
|
|
185
|
+
- [ ] External resources reviewed (fonts, CDNs)
|
|
186
|
+
- [ ] Session replay configured appropriately
|
|
187
|
+
- [ ] Children's privacy considered if applicable
|
|
188
|
+
|
|
189
|
+
**Red flags:**
|
|
190
|
+
- Undocumented data collection
|
|
191
|
+
- Undocumented third-party sharing
|
|
192
|
+
- Missing or inaccurate privacy policy
|
|
193
|
+
- Invasive tracking without disclosure
|
|
194
|
+
- External fonts without privacy consideration
|
|
195
|
+
- Children's data collected without safeguards
|
|
196
|
+
|
|
197
|
+
**See `privacy-compliance.md` for detailed privacy checks.**
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 8. Legal/Compliance Audit
|
|
202
|
+
|
|
203
|
+
**Check against legal-compliance.md:**
|
|
204
|
+
|
|
205
|
+
- [ ] Age restrictions implemented if required
|
|
206
|
+
- [ ] Marketing emails have unsubscribe if applicable
|
|
207
|
+
- [ ] Subscription terms are clear if applicable
|
|
208
|
+
- [ ] Copyright/DMCA considered for user content
|
|
209
|
+
- [ ] Applicable legal requirements identified
|
|
210
|
+
- [ ] Technical controls implemented
|
|
211
|
+
- [ ] Legal review recommended where appropriate
|
|
212
|
+
|
|
213
|
+
**Red flags:**
|
|
214
|
+
- Children can use service without age gate
|
|
215
|
+
- Marketing emails without unsubscribe
|
|
216
|
+
- Hidden subscription terms
|
|
217
|
+
- User content without copyright policy
|
|
218
|
+
- Fabricated compliance claims
|
|
219
|
+
|
|
220
|
+
**See `legal-compliance.md` for detailed compliance checks.**
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 9. Accessibility Audit
|
|
225
|
+
|
|
226
|
+
**Check against accessibility-quality.md:**
|
|
227
|
+
|
|
228
|
+
- [ ] Semantic HTML used
|
|
229
|
+
- [ ] Keyboard navigation works
|
|
230
|
+
- [ ] Focus indicators visible
|
|
231
|
+
- [ ] Forms have labels
|
|
232
|
+
- [ ] Images have alt text
|
|
233
|
+
- [ ] Color contrast meets WCAG AA
|
|
234
|
+
- [ ] Heading hierarchy is logical
|
|
235
|
+
- [ ] ARIA used appropriately
|
|
236
|
+
- [ ] Respects prefers-reduced-motion
|
|
237
|
+
- [ ] Touch targets are adequate
|
|
238
|
+
|
|
239
|
+
**Red flags:**
|
|
240
|
+
- `<div>` used as buttons
|
|
241
|
+
- Missing alt text
|
|
242
|
+
- Poor color contrast
|
|
243
|
+
- Keyboard inaccessible controls
|
|
244
|
+
- No focus indicators
|
|
245
|
+
- Missing form labels
|
|
246
|
+
|
|
247
|
+
**See `accessibility-quality.md` for complete WCAG checklist.**
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 10. Performance Audit
|
|
252
|
+
|
|
253
|
+
**Check against performance-quality.md:**
|
|
254
|
+
|
|
255
|
+
- [ ] Core Web Vitals are good (LCP, INP, CLS)
|
|
256
|
+
- [ ] Images are optimized
|
|
257
|
+
- [ ] Lazy loading implemented
|
|
258
|
+
- [ ] Code splitting used
|
|
259
|
+
- [ ] Bundle size is reasonable
|
|
260
|
+
- [ ] Caching configured
|
|
261
|
+
- [ ] Fonts optimized
|
|
262
|
+
- [ ] Third-party scripts minimized
|
|
263
|
+
|
|
264
|
+
**Red flags:**
|
|
265
|
+
- Unoptimized images
|
|
266
|
+
- Large JavaScript bundles
|
|
267
|
+
- No lazy loading
|
|
268
|
+
- Poor Core Web Vitals scores
|
|
269
|
+
- No caching strategy
|
|
270
|
+
- Too many third-party scripts
|
|
271
|
+
|
|
272
|
+
**See `performance-quality.md` for detailed performance optimization.**
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 11. Documentation Audit
|
|
277
|
+
|
|
278
|
+
**Check all project context documents:**
|
|
279
|
+
|
|
280
|
+
- [ ] prd.md is current and accurate
|
|
281
|
+
- [ ] architecture.md matches implementation
|
|
282
|
+
- [ ] rules.md is followed
|
|
283
|
+
- [ ] design.md matches actual design
|
|
284
|
+
- [ ] tasks.md is up to date
|
|
285
|
+
- [ ] memory.md contains relevant context
|
|
286
|
+
- [ ] No secrets in documentation
|
|
287
|
+
- [ ] No stale information
|
|
288
|
+
|
|
289
|
+
**Red flags:**
|
|
290
|
+
- Documentation out of sync with code
|
|
291
|
+
- Stale decisions
|
|
292
|
+
- Missing important context
|
|
293
|
+
- Secrets in documentation
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Audit Report Template
|
|
298
|
+
|
|
299
|
+
```markdown
|
|
300
|
+
# Project Audit Report
|
|
301
|
+
|
|
302
|
+
**Date:** [Date]
|
|
303
|
+
**Auditor:** [Name or "AI Agent"]
|
|
304
|
+
**Project:** [Project name]
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Executive Summary
|
|
309
|
+
|
|
310
|
+
[Brief overview of audit findings: overall health, critical issues, recommendations]
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Findings by Category
|
|
315
|
+
|
|
316
|
+
### 1. Product Alignment
|
|
317
|
+
**Status:** 🟢 Good / 🟡 Needs Attention / 🔴 Critical Issues
|
|
318
|
+
|
|
319
|
+
**Findings:**
|
|
320
|
+
- ✅ [Positive finding]
|
|
321
|
+
- ⚠️ [Issue requiring attention]
|
|
322
|
+
- ❌ [Critical issue]
|
|
323
|
+
|
|
324
|
+
### 2. Architecture Consistency
|
|
325
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
326
|
+
|
|
327
|
+
**Findings:**
|
|
328
|
+
- ...
|
|
329
|
+
|
|
330
|
+
### 3. Code Quality
|
|
331
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
332
|
+
|
|
333
|
+
**Findings:**
|
|
334
|
+
- ...
|
|
335
|
+
|
|
336
|
+
### 4. UI/UX Quality
|
|
337
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
338
|
+
|
|
339
|
+
**Findings:**
|
|
340
|
+
- ...
|
|
341
|
+
|
|
342
|
+
### 5. SEO (if applicable)
|
|
343
|
+
**Status:** 🟢 / 🟡 / 🔴 / N/A
|
|
344
|
+
|
|
345
|
+
**Findings:**
|
|
346
|
+
- ...
|
|
347
|
+
|
|
348
|
+
### 6. Security
|
|
349
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
350
|
+
|
|
351
|
+
**Findings:**
|
|
352
|
+
- ...
|
|
353
|
+
|
|
354
|
+
### 7. Privacy
|
|
355
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
356
|
+
|
|
357
|
+
**Findings:**
|
|
358
|
+
- ...
|
|
359
|
+
|
|
360
|
+
### 8. Legal/Compliance
|
|
361
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
362
|
+
|
|
363
|
+
**Findings:**
|
|
364
|
+
- ...
|
|
365
|
+
|
|
366
|
+
### 9. Accessibility
|
|
367
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
368
|
+
|
|
369
|
+
**Findings:**
|
|
370
|
+
- ...
|
|
371
|
+
|
|
372
|
+
### 10. Performance
|
|
373
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
374
|
+
|
|
375
|
+
**Findings:**
|
|
376
|
+
- ...
|
|
377
|
+
|
|
378
|
+
### 11. Documentation
|
|
379
|
+
**Status:** 🟢 / 🟡 / 🔴
|
|
380
|
+
|
|
381
|
+
**Findings:**
|
|
382
|
+
- ...
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Critical Issues (Immediate Action Required)
|
|
387
|
+
|
|
388
|
+
1. **[Issue]:** [Description]
|
|
389
|
+
- **Impact:** [What's the risk?]
|
|
390
|
+
- **Recommendation:** [How to fix]
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## High Priority Issues
|
|
395
|
+
|
|
396
|
+
1. **[Issue]:** [Description]
|
|
397
|
+
- **Impact:**
|
|
398
|
+
- **Recommendation:**
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Medium Priority Issues
|
|
403
|
+
|
|
404
|
+
1. **[Issue]:** [Description]
|
|
405
|
+
- **Impact:**
|
|
406
|
+
- **Recommendation:**
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Low Priority Improvements
|
|
411
|
+
|
|
412
|
+
1. **[Improvement]:** [Description]
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Positive Findings
|
|
417
|
+
|
|
418
|
+
- [What's working well]
|
|
419
|
+
- [Good practices observed]
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Recommendations
|
|
424
|
+
|
|
425
|
+
### Immediate Actions
|
|
426
|
+
1. [Action 1]
|
|
427
|
+
2. [Action 2]
|
|
428
|
+
|
|
429
|
+
### Short-Term (1-4 weeks)
|
|
430
|
+
1. [Action 1]
|
|
431
|
+
2. [Action 2]
|
|
432
|
+
|
|
433
|
+
### Long-Term
|
|
434
|
+
1. [Action 1]
|
|
435
|
+
2. [Action 2]
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Next Audit
|
|
440
|
+
|
|
441
|
+
**Recommended:** [Date or milestone]
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Audit Automation
|
|
447
|
+
|
|
448
|
+
### Automated Tools
|
|
449
|
+
- Lighthouse (performance, accessibility, SEO)
|
|
450
|
+
- ESLint (code quality)
|
|
451
|
+
- npm audit / yarn audit (dependencies)
|
|
452
|
+
- axe DevTools (accessibility)
|
|
453
|
+
- WAVE (accessibility)
|
|
454
|
+
|
|
455
|
+
### Manual Review Required
|
|
456
|
+
- Product alignment
|
|
457
|
+
- Architecture consistency
|
|
458
|
+
- Design consistency
|
|
459
|
+
- Privacy practices
|
|
460
|
+
- Legal compliance
|
|
461
|
+
- Security logic
|
|
462
|
+
- Business logic
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
**Summary:** Audits identify drift, technical debt, quality issues, and compliance gaps. Run audits regularly, document findings, prioritize issues, and track resolution.
|
|
467
|
+
|
|
468
|
+
**Remember:** Audits should be constructive, not punitive. The goal is improvement, not perfection.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Security Quality Standards
|
|
2
|
+
|
|
3
|
+
> Security audit framework and best practices for AI agents.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Security Audit Framework
|
|
8
|
+
|
|
9
|
+
### 1. Authentication
|
|
10
|
+
- [ ] Passwords are hashed (bcrypt, scrypt, Argon2)
|
|
11
|
+
- [ ] Never store plaintext passwords
|
|
12
|
+
- [ ] Session management is secure
|
|
13
|
+
- [ ] Rate limiting on auth endpoints
|
|
14
|
+
- [ ] Password reset is secure (token expiration, one-time use)
|
|
15
|
+
- [ ] MFA available if appropriate
|
|
16
|
+
|
|
17
|
+
### 2. Authorization
|
|
18
|
+
- [ ] Permissions checked on every request
|
|
19
|
+
- [ ] Authorization at API level (not just UI)
|
|
20
|
+
- [ ] Principle of least privilege
|
|
21
|
+
- [ ] Resource ownership validated
|
|
22
|
+
- [ ] Role-based access control if applicable
|
|
23
|
+
|
|
24
|
+
### 3. Input Validation
|
|
25
|
+
- [ ] All user input is validated
|
|
26
|
+
- [ ] Server-side validation (don't trust client)
|
|
27
|
+
- [ ] Type validation
|
|
28
|
+
- [ ] Length/bounds validation
|
|
29
|
+
- [ ] Format validation (email, URL, etc.)
|
|
30
|
+
- [ ] Use schema validation libraries (Zod, Yup, Joi)
|
|
31
|
+
|
|
32
|
+
### 4. Injection Prevention
|
|
33
|
+
- [ ] SQL injection: Use parameterized queries or ORM
|
|
34
|
+
- [ ] NoSQL injection: Validate and sanitize
|
|
35
|
+
- [ ] Command injection: Avoid shell execution with user input
|
|
36
|
+
- [ ] XSS: Encode output, use CSP headers
|
|
37
|
+
- [ ] Path traversal: Validate file paths
|
|
38
|
+
|
|
39
|
+
### 5. Secrets Management
|
|
40
|
+
- [ ] No secrets in code
|
|
41
|
+
- [ ] Use environment variables
|
|
42
|
+
- [ ] Use secret managers for production
|
|
43
|
+
- [ ] No secrets in logs
|
|
44
|
+
- [ ] No secrets in error messages
|
|
45
|
+
- [ ] Rotate secrets regularly
|
|
46
|
+
|
|
47
|
+
### 6. Session Security
|
|
48
|
+
- [ ] HttpOnly flag on cookies
|
|
49
|
+
- [ ] Secure flag on cookies (HTTPS)
|
|
50
|
+
- [ ] SameSite attribute for CSRF protection
|
|
51
|
+
- [ ] Reasonable session expiration
|
|
52
|
+
- [ ] Session invalidation on logout
|
|
53
|
+
|
|
54
|
+
### 7. API Security
|
|
55
|
+
- [ ] HTTPS everywhere
|
|
56
|
+
- [ ] Rate limiting
|
|
57
|
+
- [ ] CORS configured correctly
|
|
58
|
+
- [ ] Security headers (CSP, X-Frame-Options, etc.)
|
|
59
|
+
- [ ] Content-Type validation
|
|
60
|
+
- [ ] Authentication required where appropriate
|
|
61
|
+
|
|
62
|
+
### 8. Data Security
|
|
63
|
+
- [ ] Sensitive data encrypted at rest
|
|
64
|
+
- [ ] Sensitive data encrypted in transit
|
|
65
|
+
- [ ] PII handled appropriately
|
|
66
|
+
- [ ] No sensitive data in logs
|
|
67
|
+
- [ ] Secure file uploads
|
|
68
|
+
- [ ] Access controls on data
|
|
69
|
+
|
|
70
|
+
### 9. Dependencies
|
|
71
|
+
- [ ] Dependencies kept updated
|
|
72
|
+
- [ ] Regular security audits (`npm audit`, Dependabot)
|
|
73
|
+
- [ ] Minimize dependencies
|
|
74
|
+
- [ ] Review new dependencies
|
|
75
|
+
- [ ] Use lock files
|
|
76
|
+
|
|
77
|
+
### 10. Error Handling
|
|
78
|
+
- [ ] Don't expose stack traces to users
|
|
79
|
+
- [ ] Don't expose system details
|
|
80
|
+
- [ ] Log errors with context
|
|
81
|
+
- [ ] Don't log secrets or PII
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Common Vulnerabilities
|
|
86
|
+
|
|
87
|
+
### SQL Injection
|
|
88
|
+
❌ **Vulnerable:**
|
|
89
|
+
```javascript
|
|
90
|
+
const query = `SELECT * FROM users WHERE id = ${req.params.id}`;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
✅ **Secure:**
|
|
94
|
+
```javascript
|
|
95
|
+
const query = 'SELECT * FROM users WHERE id = ?';
|
|
96
|
+
db.query(query, [req.params.id]);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### XSS (Cross-Site Scripting)
|
|
100
|
+
❌ **Vulnerable:**
|
|
101
|
+
```jsx
|
|
102
|
+
<div dangerouslySetInnerHTML={{__html: userInput}} />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
✅ **Secure:**
|
|
106
|
+
```jsx
|
|
107
|
+
<div>{userInput}</div> {/* React escapes by default */}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### CSRF (Cross-Site Request Forgery)
|
|
111
|
+
✅ **Mitigations:**
|
|
112
|
+
- CSRF tokens
|
|
113
|
+
- SameSite cookie attribute
|
|
114
|
+
- Check Origin/Referer headers
|
|
115
|
+
|
|
116
|
+
### Insecure Direct Object References
|
|
117
|
+
❌ **Vulnerable:**
|
|
118
|
+
```javascript
|
|
119
|
+
// No ownership check
|
|
120
|
+
const doc = await getDocument(req.params.id);
|
|
121
|
+
return doc;
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
✅ **Secure:**
|
|
125
|
+
```javascript
|
|
126
|
+
const doc = await getDocument(req.params.id);
|
|
127
|
+
if (doc.userId !== req.user.id) {
|
|
128
|
+
throw new UnauthorizedError();
|
|
129
|
+
}
|
|
130
|
+
return doc;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Secrets Management Rules
|
|
136
|
+
|
|
137
|
+
### Never Commit:
|
|
138
|
+
- API keys
|
|
139
|
+
- Passwords
|
|
140
|
+
- Private keys/certificates
|
|
141
|
+
- OAuth client secrets
|
|
142
|
+
- Database credentials
|
|
143
|
+
- Encryption keys
|
|
144
|
+
- Third-party service credentials
|
|
145
|
+
|
|
146
|
+
### Store Securely:
|
|
147
|
+
- Environment variables (development)
|
|
148
|
+
- Secret managers (production: AWS Secrets Manager, HashiCorp Vault, etc.)
|
|
149
|
+
- .env files (gitignored)
|
|
150
|
+
|
|
151
|
+
### Document Requirements:
|
|
152
|
+
```markdown
|
|
153
|
+
## Required Environment Variables
|
|
154
|
+
|
|
155
|
+
- `DATABASE_URL`: PostgreSQL connection string
|
|
156
|
+
- `JWT_SECRET`: Secret for JWT signing (generate random 32+ chars)
|
|
157
|
+
- `STRIPE_SECRET_KEY`: Stripe API key from dashboard
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Security Headers
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
// Example security headers
|
|
166
|
+
{
|
|
167
|
+
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
|
|
168
|
+
'X-Frame-Options': 'DENY',
|
|
169
|
+
'X-Content-Type-Options': 'nosniff',
|
|
170
|
+
'X-XSS-Protection': '1; mode=block',
|
|
171
|
+
'Content-Security-Policy': "default-src 'self'",
|
|
172
|
+
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Security Checklist
|
|
179
|
+
|
|
180
|
+
- [ ] Authentication is secure
|
|
181
|
+
- [ ] Authorization is enforced
|
|
182
|
+
- [ ] Input is validated (server-side)
|
|
183
|
+
- [ ] Injection attacks prevented
|
|
184
|
+
- [ ] Secrets are not exposed
|
|
185
|
+
- [ ] Sessions are secure
|
|
186
|
+
- [ ] APIs are protected
|
|
187
|
+
- [ ] Data is encrypted
|
|
188
|
+
- [ ] Dependencies are audited
|
|
189
|
+
- [ ] Errors don't leak information
|
|
190
|
+
- [ ] Security headers configured
|
|
191
|
+
- [ ] Rate limiting implemented
|
|
192
|
+
- [ ] HTTPS enforced
|
|
193
|
+
- [ ] CORS configured correctly
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Security Documentation Template
|
|
198
|
+
|
|
199
|
+
```markdown
|
|
200
|
+
## Security
|
|
201
|
+
|
|
202
|
+
### Authentication
|
|
203
|
+
- **Method:** [e.g., JWT with bcrypt password hashing]
|
|
204
|
+
- **Session management:** [e.g., HttpOnly cookies]
|
|
205
|
+
- **Rate limiting:** [Implemented on /api/auth/*]
|
|
206
|
+
|
|
207
|
+
### Authorization
|
|
208
|
+
- **Model:** [e.g., RBAC with roles: user, admin]
|
|
209
|
+
- **Enforcement:** [API middleware checks permissions]
|
|
210
|
+
|
|
211
|
+
### Input Validation
|
|
212
|
+
- **Library:** [e.g., Zod for schema validation]
|
|
213
|
+
- **Coverage:** [All API endpoints]
|
|
214
|
+
|
|
215
|
+
### Secrets Management
|
|
216
|
+
- **Storage:** [Environment variables]
|
|
217
|
+
- **Production:** [AWS Secrets Manager]
|
|
218
|
+
|
|
219
|
+
### Data Security
|
|
220
|
+
- **Encryption at rest:** [Database encryption enabled]
|
|
221
|
+
- **Encryption in transit:** [HTTPS enforced]
|
|
222
|
+
|
|
223
|
+
### Security Headers
|
|
224
|
+
- **CSP:** [Configured]
|
|
225
|
+
- **Other headers:** [HSTS, X-Frame-Options, etc.]
|
|
226
|
+
|
|
227
|
+
### Dependencies
|
|
228
|
+
- **Audit frequency:** [Monthly via npm audit]
|
|
229
|
+
- **Update policy:** [Critical updates within 48h]
|
|
230
|
+
|
|
231
|
+
### Known Security Issues
|
|
232
|
+
- [None currently / List issues]
|
|
233
|
+
|
|
234
|
+
### Security Review
|
|
235
|
+
- **Last security review:** [Date or "Not performed"]
|
|
236
|
+
- **Penetration testing:** [Date or "Not performed"]
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## When to Escalate
|
|
242
|
+
|
|
243
|
+
Consult security professionals for:
|
|
244
|
+
- Payment processing implementation
|
|
245
|
+
- Healthcare data handling
|
|
246
|
+
- Authentication system design
|
|
247
|
+
- Encryption implementation
|
|
248
|
+
- High-risk applications
|
|
249
|
+
- Compliance requirements (PCI-DSS, HIPAA, etc.)
|
|
250
|
+
- Incident response
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
**Summary:** Security is not an afterthought. Build it in from the start. Validate input, protect secrets, enforce authorization, encrypt data.
|