telo3-ai 5.0.7 → 6.2.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 (47) hide show
  1. package/README.md +32 -791
  2. package/SKILL.md +36 -657
  3. package/bootstrap/TELO3.md +17 -0
  4. package/cli.js +223 -42
  5. package/hooks/inject-contract.mjs +23 -0
  6. package/hooks/session-start.example.json +15 -0
  7. package/index.js +48 -14
  8. package/package.json +32 -69
  9. package/references/accessibility-quality.md +92 -272
  10. package/references/ai-behavior.md +70 -332
  11. package/references/anti-slop.md +71 -0
  12. package/references/document-specification.md +110 -419
  13. package/references/legal-compliance.md +90 -395
  14. package/references/performance-quality.md +100 -351
  15. package/references/privacy-compliance.md +88 -464
  16. package/references/project-audit.md +79 -440
  17. package/references/security-quality.md +68 -220
  18. package/references/seo-quality.md +83 -339
  19. package/references/smart-skill-delegation.md +73 -419
  20. package/references/token-optimization.md +83 -450
  21. package/references/ui-quality.md +106 -481
  22. package/references/workflow.md +91 -447
  23. package/scripts/postinstall.mjs +27 -0
  24. package/src/activate.js +159 -0
  25. package/src/context.js +72 -0
  26. package/src/find-context.js +41 -0
  27. package/src/init.js +38 -0
  28. package/src/install.js +128 -0
  29. package/src/paths.js +20 -0
  30. package/src/status.js +30 -0
  31. package/src/tokens.js +10 -0
  32. package/src/validate.js +220 -0
  33. package/src/version.js +12 -0
  34. package/templates/architecture.md +17 -398
  35. package/templates/design.md +22 -631
  36. package/templates/memory.md +13 -351
  37. package/templates/prd.md +15 -295
  38. package/templates/rules.md +20 -600
  39. package/templates/tasks.md +10 -210
  40. package/AI-CONTEXT.md +0 -272
  41. package/ONBOARDING-SKILL.md +0 -738
  42. package/SKILL-METADATA.json +0 -237
  43. package/scripts/init-project-context.sh +0 -139
  44. package/scripts/validate-project-context.sh +0 -164
  45. package/skills/telo3/SKILL.md +0 -315
  46. package/skills/telo3-context/SKILL.md +0 -272
  47. package/skills/telo3-onboarding/SKILL.md +0 -738
@@ -1,254 +1,102 @@
1
- # Security Quality Standards
1
+ # Security Quality
2
+ **Load when:** any auth, session, input handling, secrets, API, data-storage, or dependency work.
2
3
 
3
- > Security audit framework and best practices for AI agents.
4
+ Build security in from the start: validate input, protect secrets, enforce authorization, encrypt data. Verify changed behavior after every security-relevant fix; skip re-verification only for unrelated areas.
4
5
 
5
- ---
6
-
7
- ## Security Audit Framework
6
+ ## Audit Checklist
8
7
 
9
8
  ### 1. Authentication
10
- - [ ] Passwords are hashed (bcrypt, scrypt, Argon2)
11
- - [ ] Never store plaintext passwords
12
- - [ ] Session management is secure
9
+ - [ ] Hash passwords (bcrypt, scrypt, Argon2); never store plaintext
10
+ - [ ] Secure session management
13
11
  - [ ] Rate limiting on auth endpoints
14
- - [ ] Password reset is secure (token expiration, one-time use)
15
- - [ ] MFA available if appropriate
12
+ - [ ] Password reset is secure: token expiration, one-time use
13
+ - [ ] MFA available where appropriate
16
14
 
17
15
  ### 2. Authorization
18
- - [ ] Permissions checked on every request
19
- - [ ] Authorization at API level (not just UI)
16
+ - [ ] Permissions checked on every request, at API level (not just UI)
20
17
  - [ ] Principle of least privilege
21
18
  - [ ] Resource ownership validated
22
- - [ ] Role-based access control if applicable
19
+ - [ ] Role-based access control where applicable
23
20
 
24
21
  ### 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.)
22
+ - [ ] All user input validated server-side; never trust the client
23
+ - [ ] Type, length/bounds, and format validation (email, URL, etc.)
30
24
  - [ ] Use schema validation libraries (Zod, Yup, Joi)
31
25
 
32
26
  ### 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
27
+ - [ ] SQL injection: parameterized queries or ORM
28
+ - [ ] NoSQL injection: validate and sanitize
29
+ - [ ] Command injection: no shell execution with user input
30
+ - [ ] XSS: encode output; use CSP headers
31
+ - [ ] Path traversal: validate file paths
38
32
 
39
33
  ### 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
34
+ - [ ] No secrets in code, logs, or error messages
35
+ - [ ] Environment variables; secret managers for production
45
36
  - [ ] Rotate secrets regularly
46
37
 
47
38
  ### 6. Session Security
48
- - [ ] HttpOnly flag on cookies
49
- - [ ] Secure flag on cookies (HTTPS)
50
- - [ ] SameSite attribute for CSRF protection
39
+ - [ ] Cookies: HttpOnly flag, Secure flag (HTTPS), SameSite attribute (CSRF protection)
51
40
  - [ ] Reasonable session expiration
52
41
  - [ ] Session invalidation on logout
53
42
 
54
43
  ### 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
44
+ - [ ] HTTPS everywhere; rate limiting; CORS configured correctly
45
+ - [ ] Security headers (CSP, X-Frame-Options, etc.); Content-Type validation
60
46
  - [ ] Authentication required where appropriate
61
47
 
62
48
  ### 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
49
+ - [ ] Sensitive data encrypted at rest and in transit
50
+ - [ ] PII handled appropriately; no sensitive data in logs
51
+ - [ ] Secure file uploads; access controls on data
69
52
 
70
53
  ### 9. Dependencies
71
- - [ ] Dependencies kept updated
72
- - [ ] Regular security audits (`npm audit`, Dependabot)
73
- - [ ] Minimize dependencies
74
- - [ ] Review new dependencies
54
+ - [ ] Keep updated; run regular security audits (npm audit, Dependabot)
55
+ - [ ] Minimize dependencies; review new dependencies
75
56
  - [ ] Use lock files
76
57
 
77
58
  ### 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
- ---
59
+ - [ ] Never expose stack traces or system details to users
60
+ - [ ] Log errors with context; never log secrets or PII
61
+
62
+ ## Vulnerable Patterns and Fixes
63
+
64
+ | Vulnerability | Vulnerable pattern | Required fix |
65
+ |---|---|---|
66
+ | SQL injection | Interpolated SQL: `SELECT ... WHERE id = ${req.params.id}` | Parameterized query (`WHERE id = ?` + params array) or ORM |
67
+ | XSS | `dangerouslySetInnerHTML={{__html: userInput}}` | Render as text (`{userInput}`); React escapes by default |
68
+ | CSRF | Unprotected cookie-authenticated state changes | CSRF tokens; SameSite cookies; check Origin/Referer headers |
69
+ | IDOR | `getDocument(req.params.id)` returned with no ownership check | Reject when `doc.userId !== req.user.id` (UnauthorizedError) |
70
+
71
+ ## Secrets Rules
72
+
73
+ - Never commit: API keys, passwords, private keys/certificates, OAuth client secrets, database credentials, encryption keys, third-party service credentials.
74
+ - Store securely: environment variables (development), gitignored `.env` files, secret managers in production (AWS Secrets Manager, HashiCorp Vault).
75
+ - Document required env vars with purpose, e.g. `DATABASE_URL` (PostgreSQL connection string), `JWT_SECRET` (generate random 32+ chars), `STRIPE_SECRET_KEY` (from provider dashboard).
161
76
 
162
77
  ## Security Headers
163
78
 
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.
79
+ | Header | Value |
80
+ |---|---|
81
+ | Strict-Transport-Security | `max-age=31536000; includeSubDomains` |
82
+ | X-Frame-Options | `DENY` |
83
+ | X-Content-Type-Options | `nosniff` |
84
+ | X-XSS-Protection | `1; mode=block` |
85
+ | Content-Security-Policy | `default-src 'self'` |
86
+ | Referrer-Policy | `strict-origin-when-cross-origin` |
87
+
88
+ ## Security Documentation (record per project)
89
+
90
+ - Authentication: method (e.g., JWT + bcrypt), session management (e.g., HttpOnly cookies), rate-limited routes (e.g., /api/auth/*)
91
+ - Authorization: model (e.g., RBAC roles user/admin), enforcement point (API middleware)
92
+ - Input validation: library (e.g., Zod), coverage (all API endpoints)
93
+ - Secrets: storage (env vars), production manager (e.g., AWS Secrets Manager)
94
+ - Data: encryption at rest (database) and in transit (HTTPS) status
95
+ - Headers: CSP and others (HSTS, X-Frame-Options) configured
96
+ - Dependencies: audit frequency (default monthly via npm audit); critical updates within 48h
97
+ - Known security issues: list or "none"
98
+ - Last security review and penetration testing: date or "Not performed"
99
+
100
+ ## Escalate to Security Professionals
101
+
102
+ Consult experts for: payment processing implementation, healthcare data handling, authentication system design, encryption implementation, high-risk applications, compliance requirements (PCI-DSS, HIPAA), incident response.