@lenne.tech/cli 1.2.0 → 1.3.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/build/commands/claude/install-plugin.js +339 -0
- package/package.json +1 -1
- package/build/commands/claude/install-commands.js +0 -337
- package/build/commands/claude/install-mcps.js +0 -258
- package/build/commands/claude/install-skills.js +0 -693
- package/build/lib/mcp-registry.js +0 -80
- package/build/templates/claude-commands/code-cleanup.md +0 -82
- package/build/templates/claude-commands/commit-message.md +0 -21
- package/build/templates/claude-commands/create-story.md +0 -435
- package/build/templates/claude-commands/mr-description-clipboard.md +0 -48
- package/build/templates/claude-commands/mr-description.md +0 -33
- package/build/templates/claude-commands/sec-review.md +0 -62
- package/build/templates/claude-commands/skill-optimize.md +0 -481
- package/build/templates/claude-commands/test-generate.md +0 -45
- package/build/templates/claude-skills/building-stories-with-tdd/SKILL.md +0 -265
- package/build/templates/claude-skills/building-stories-with-tdd/code-quality.md +0 -276
- package/build/templates/claude-skills/building-stories-with-tdd/database-indexes.md +0 -182
- package/build/templates/claude-skills/building-stories-with-tdd/examples.md +0 -1383
- package/build/templates/claude-skills/building-stories-with-tdd/handling-existing-tests.md +0 -197
- package/build/templates/claude-skills/building-stories-with-tdd/reference.md +0 -1427
- package/build/templates/claude-skills/building-stories-with-tdd/security-review.md +0 -307
- package/build/templates/claude-skills/building-stories-with-tdd/workflow.md +0 -1004
- package/build/templates/claude-skills/generating-nest-servers/SKILL.md +0 -303
- package/build/templates/claude-skills/generating-nest-servers/configuration.md +0 -285
- package/build/templates/claude-skills/generating-nest-servers/declare-keyword-warning.md +0 -133
- package/build/templates/claude-skills/generating-nest-servers/description-management.md +0 -226
- package/build/templates/claude-skills/generating-nest-servers/examples.md +0 -893
- package/build/templates/claude-skills/generating-nest-servers/framework-guide.md +0 -259
- package/build/templates/claude-skills/generating-nest-servers/quality-review.md +0 -864
- package/build/templates/claude-skills/generating-nest-servers/reference.md +0 -487
- package/build/templates/claude-skills/generating-nest-servers/security-rules.md +0 -371
- package/build/templates/claude-skills/generating-nest-servers/verification-checklist.md +0 -262
- package/build/templates/claude-skills/generating-nest-servers/workflow-process.md +0 -1061
- package/build/templates/claude-skills/using-lt-cli/SKILL.md +0 -284
- package/build/templates/claude-skills/using-lt-cli/examples.md +0 -546
- package/build/templates/claude-skills/using-lt-cli/reference.md +0 -513
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: story-tdd-security-review
|
|
3
|
-
version: 1.0.0
|
|
4
|
-
description: Security review checklist for Test-Driven Development - ensures no vulnerabilities are introduced
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 🔐 Security Review Checklist
|
|
8
|
-
|
|
9
|
-
## Table of Contents
|
|
10
|
-
- [Security Checklist](#security-checklist)
|
|
11
|
-
- [Security Decision Tree](#security-decision-tree)
|
|
12
|
-
- [Red Flags - STOP and Review](#red-flags---stop-and-review)
|
|
13
|
-
- [If ANY Red Flag Found](#if-any-red-flag-found)
|
|
14
|
-
- [Remember](#remember)
|
|
15
|
-
- [Quick Security Checklist](#quick-security-checklist)
|
|
16
|
-
|
|
17
|
-
**CRITICAL: Perform security review before final testing!**
|
|
18
|
-
|
|
19
|
-
**ALWAYS review all code changes for security vulnerabilities before marking complete.**
|
|
20
|
-
|
|
21
|
-
Security issues can be introduced during implementation without realizing it. A systematic review prevents:
|
|
22
|
-
- Unauthorized access to data
|
|
23
|
-
- Privilege escalation
|
|
24
|
-
- Data leaks
|
|
25
|
-
- Injection attacks
|
|
26
|
-
- Authentication bypasses
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Security Checklist
|
|
31
|
-
|
|
32
|
-
### 1. Authentication & Authorization
|
|
33
|
-
|
|
34
|
-
✅ **Check decorators are NOT weakened:**
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
// ❌ WRONG: Removing security to make tests pass
|
|
38
|
-
// OLD:
|
|
39
|
-
@Restricted(RoleEnum.ADMIN)
|
|
40
|
-
async deleteUser(id: string) { ... }
|
|
41
|
-
|
|
42
|
-
// NEW (DANGEROUS):
|
|
43
|
-
async deleteUser(id: string) { ... } // ⚠️ No restriction!
|
|
44
|
-
|
|
45
|
-
// ✅ CORRECT: Keep or strengthen security
|
|
46
|
-
@Restricted(RoleEnum.ADMIN)
|
|
47
|
-
async deleteUser(id: string) { ... }
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
✅ **Verify @Roles decorators:**
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
// ❌ WRONG: Making endpoint too permissive
|
|
54
|
-
@Roles(RoleEnum.S_USER) // Everyone can delete!
|
|
55
|
-
async deleteOrder(id: string) { ... }
|
|
56
|
-
|
|
57
|
-
// ✅ CORRECT: Proper role restriction
|
|
58
|
-
@Roles(RoleEnum.ADMIN) // Only admins can delete
|
|
59
|
-
async deleteOrder(id: string) { ... }
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
✅ **Check ownership verification:**
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
// ❌ WRONG: No ownership check
|
|
66
|
-
async updateProfile(userId: string, data: UpdateProfileInput, currentUser: User) {
|
|
67
|
-
return this.userService.update(userId, data); // Any user can update any profile!
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ✅ CORRECT: Verify ownership or admin role
|
|
71
|
-
async updateProfile(userId: string, data: UpdateProfileInput, currentUser: User) {
|
|
72
|
-
// Check if user is updating their own profile or is admin
|
|
73
|
-
if (userId !== currentUser.id && !currentUser.roles.includes(RoleEnum.ADMIN)) {
|
|
74
|
-
throw new ForbiddenException('Cannot update other users');
|
|
75
|
-
}
|
|
76
|
-
return this.userService.update(userId, data);
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 2. Input Validation
|
|
81
|
-
|
|
82
|
-
✅ **Verify all inputs are validated:**
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
// ❌ WRONG: No validation
|
|
86
|
-
async createProduct(input: any) {
|
|
87
|
-
return this.productService.create(input); // Dangerous!
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// ✅ CORRECT: Proper DTO with validation
|
|
91
|
-
export class CreateProductInput {
|
|
92
|
-
@UnifiedField({
|
|
93
|
-
description: 'Product name',
|
|
94
|
-
isOptional: false,
|
|
95
|
-
mongoose: { type: String, required: true, minlength: 1, maxlength: 100 }
|
|
96
|
-
})
|
|
97
|
-
name: string;
|
|
98
|
-
|
|
99
|
-
@UnifiedField({
|
|
100
|
-
description: 'Price',
|
|
101
|
-
isOptional: false,
|
|
102
|
-
mongoose: { type: Number, required: true, min: 0 }
|
|
103
|
-
})
|
|
104
|
-
price: number;
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
✅ **Check for injection vulnerabilities:**
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
// ❌ WRONG: Direct string interpolation in queries
|
|
112
|
-
async findByName(name: string) {
|
|
113
|
-
return this.productModel.find({ $where: `this.name === '${name}'` }); // SQL Injection!
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// ✅ CORRECT: Parameterized queries
|
|
117
|
-
async findByName(name: string) {
|
|
118
|
-
return this.productModel.find({ name }); // Safe
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### 3. Data Exposure
|
|
123
|
-
|
|
124
|
-
✅ **Verify sensitive data is protected:**
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
// ❌ WRONG: Exposing passwords
|
|
128
|
-
export class User {
|
|
129
|
-
@UnifiedField({ description: 'Email' })
|
|
130
|
-
email: string;
|
|
131
|
-
|
|
132
|
-
@UnifiedField({ description: 'Password' })
|
|
133
|
-
password: string; // ⚠️ Will be exposed in API!
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// ✅ CORRECT: Hide sensitive fields
|
|
137
|
-
export class User {
|
|
138
|
-
@UnifiedField({ description: 'Email' })
|
|
139
|
-
email: string;
|
|
140
|
-
|
|
141
|
-
@UnifiedField({
|
|
142
|
-
description: 'Password hash',
|
|
143
|
-
hideField: true, // ✅ Never expose in API
|
|
144
|
-
mongoose: { type: String, required: true }
|
|
145
|
-
})
|
|
146
|
-
password: string;
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
✅ **Check error messages don't leak data:**
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
// ❌ WRONG: Exposing sensitive info in errors
|
|
154
|
-
catch (error) {
|
|
155
|
-
throw new BadRequestException(`Query failed: ${error.message}, SQL: ${query}`);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// ✅ CORRECT: Generic error messages
|
|
159
|
-
catch (error) {
|
|
160
|
-
this.logger.error(`Query failed: ${error.message}`, error.stack);
|
|
161
|
-
throw new BadRequestException('Invalid request');
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### 4. Authorization in Services
|
|
166
|
-
|
|
167
|
-
✅ **Verify service methods check permissions:**
|
|
168
|
-
|
|
169
|
-
```typescript
|
|
170
|
-
// ❌ WRONG: Service doesn't check who can access
|
|
171
|
-
async getOrder(orderId: string) {
|
|
172
|
-
return this.orderModel.findById(orderId); // Anyone can see any order!
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// ✅ CORRECT: Service checks ownership or role
|
|
176
|
-
async getOrder(orderId: string, currentUser: User) {
|
|
177
|
-
const order = await this.orderModel.findById(orderId);
|
|
178
|
-
|
|
179
|
-
// Check if user owns the order or is admin
|
|
180
|
-
if (order.customerId !== currentUser.id && !currentUser.roles.includes(RoleEnum.ADMIN)) {
|
|
181
|
-
throw new ForbiddenException('Access denied');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return order;
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### 5. Security Model Checks
|
|
189
|
-
|
|
190
|
-
✅ **Verify checkSecurity methods:**
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
// In model file
|
|
194
|
-
async checkSecurity(user: User, mode: SecurityMode): Promise<void> {
|
|
195
|
-
// ❌ WRONG: No security check
|
|
196
|
-
return;
|
|
197
|
-
|
|
198
|
-
// ✅ CORRECT: Proper security implementation
|
|
199
|
-
if (mode === SecurityMode.CREATE && !user.roles.includes(RoleEnum.ADMIN)) {
|
|
200
|
-
throw new ForbiddenException('Only admins can create');
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (mode === SecurityMode.UPDATE && this.createdBy !== user.id && !user.roles.includes(RoleEnum.ADMIN)) {
|
|
204
|
-
throw new ForbiddenException('Can only update own items');
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### 6. Cross-Cutting Concerns
|
|
210
|
-
|
|
211
|
-
✅ **Rate limiting for sensitive endpoints:**
|
|
212
|
-
- Password reset endpoints
|
|
213
|
-
- Authentication endpoints
|
|
214
|
-
- Payment processing
|
|
215
|
-
- Email sending
|
|
216
|
-
|
|
217
|
-
✅ **HTTPS/TLS enforcement (production)**
|
|
218
|
-
|
|
219
|
-
✅ **Proper CORS configuration**
|
|
220
|
-
|
|
221
|
-
✅ **No hardcoded secrets or API keys**
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## Security Decision Tree
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
Code changes made?
|
|
229
|
-
│
|
|
230
|
-
├─► Modified @Restricted or @Roles?
|
|
231
|
-
│ └─► ⚠️ CRITICAL: Verify this was intentional and justified
|
|
232
|
-
│
|
|
233
|
-
├─► New endpoint added?
|
|
234
|
-
│ └─► ✅ Ensure proper authentication + authorization decorators
|
|
235
|
-
│
|
|
236
|
-
├─► Service method modified?
|
|
237
|
-
│ └─► ✅ Verify ownership checks still in place
|
|
238
|
-
│
|
|
239
|
-
├─► New input/query parameters?
|
|
240
|
-
│ └─► ✅ Ensure validation and sanitization
|
|
241
|
-
│
|
|
242
|
-
└─► Sensitive data accessed?
|
|
243
|
-
└─► ✅ Verify access control and data hiding
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## Red Flags - STOP and Review
|
|
249
|
-
|
|
250
|
-
🚩 **Authentication/Authorization:**
|
|
251
|
-
- @Restricted decorator removed or changed
|
|
252
|
-
- @Roles changed to more permissive role
|
|
253
|
-
- Endpoints without authentication
|
|
254
|
-
- Missing ownership checks
|
|
255
|
-
|
|
256
|
-
🚩 **Data Security:**
|
|
257
|
-
- Sensitive fields not marked with hideField
|
|
258
|
-
- Password or token fields exposed
|
|
259
|
-
- User data accessible without permission check
|
|
260
|
-
- Error messages revealing internal details
|
|
261
|
-
|
|
262
|
-
🚩 **Input Validation:**
|
|
263
|
-
- Missing validation decorators
|
|
264
|
-
- Any type used instead of DTO
|
|
265
|
-
- Direct use of user input in queries
|
|
266
|
-
- No sanitization of string inputs
|
|
267
|
-
|
|
268
|
-
🚩 **Business Logic:**
|
|
269
|
-
- Bypassing security checks "for convenience"
|
|
270
|
-
- Commented out authorization code
|
|
271
|
-
- Admin-only actions available to regular users
|
|
272
|
-
- Price/amount manipulation possible
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
## If ANY Red Flag Found
|
|
277
|
-
|
|
278
|
-
1. **STOP implementation**
|
|
279
|
-
2. **Fix the security issue immediately**
|
|
280
|
-
3. **Review surrounding code for similar issues**
|
|
281
|
-
4. **Re-run security checklist**
|
|
282
|
-
5. **Update tests to verify security works**
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## Remember
|
|
287
|
-
|
|
288
|
-
- **Security > Convenience**
|
|
289
|
-
- **Better to over-restrict than under-restrict**
|
|
290
|
-
- **Always preserve existing security mechanisms**
|
|
291
|
-
- **When in doubt, ask the developer**
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
## Quick Security Checklist
|
|
296
|
-
|
|
297
|
-
Before marking complete:
|
|
298
|
-
|
|
299
|
-
- [ ] **@Restricted/@Roles decorators NOT removed or weakened**
|
|
300
|
-
- [ ] **Ownership checks in place (users can only access own data)**
|
|
301
|
-
- [ ] **All inputs validated with proper DTOs**
|
|
302
|
-
- [ ] **Sensitive fields marked with hideField: true**
|
|
303
|
-
- [ ] **No SQL/NoSQL injection vulnerabilities**
|
|
304
|
-
- [ ] **Error messages don't expose sensitive data**
|
|
305
|
-
- [ ] **checkSecurity methods implemented in models**
|
|
306
|
-
- [ ] **Authorization tests pass**
|
|
307
|
-
- [ ] **No hardcoded secrets or credentials**
|