start-vibing 1.1.2 → 1.1.4
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/package.json +1 -1
- package/template/.claude/CLAUDE.md +129 -168
- package/template/.claude/agents/analyzer.md +0 -14
- package/template/.claude/agents/commit-manager.md +0 -19
- package/template/.claude/agents/documenter.md +0 -10
- package/template/.claude/agents/domain-updater.md +194 -200
- package/template/.claude/agents/final-validator.md +0 -18
- package/template/.claude/agents/orchestrator.md +36 -34
- package/template/.claude/agents/quality-checker.md +0 -24
- package/template/.claude/agents/research.md +299 -262
- package/template/.claude/agents/security-auditor.md +1 -14
- package/template/.claude/agents/tester.md +0 -8
- package/template/.claude/agents/ui-ux-reviewer.md +80 -18
- package/template/.claude/commands/feature.md +48 -102
- package/template/.claude/config/README.md +30 -30
- package/template/.claude/config/project-config.json +53 -53
- package/template/.claude/config/quality-gates.json +46 -46
- package/template/.claude/config/security-rules.json +45 -45
- package/template/.claude/config/testing-config.json +168 -168
- package/template/.claude/hooks/SETUP.md +52 -181
- package/template/.claude/hooks/user-prompt-submit.py +184 -46
- package/template/.claude/settings.json +0 -39
- package/template/.claude/skills/codebase-knowledge/SKILL.md +145 -145
- package/template/.claude/skills/codebase-knowledge/domains/claude-system.md +260 -321
- package/template/.claude/skills/docs-tracker/SKILL.md +239 -239
- package/template/.claude/skills/final-check/SKILL.md +284 -284
- package/template/.claude/skills/quality-gate/SKILL.md +278 -278
- package/template/.claude/skills/research-cache/SKILL.md +207 -207
- package/template/.claude/skills/security-scan/SKILL.md +206 -206
- package/template/.claude/skills/test-coverage/SKILL.md +441 -441
- package/template/.claude/skills/ui-ux-audit/SKILL.md +254 -254
- package/template/.claude/config/domain-mapping.json +0 -26
- package/template/.claude/hooks/post-tool-use.py +0 -155
- package/template/.claude/hooks/pre-tool-use.py +0 -159
- package/template/.claude/hooks/stop-validation.py +0 -155
- package/template/.claude/hooks/validate-commit.py +0 -200
- package/template/.claude/hooks/workflow-manager.py +0 -350
- package/template/.claude/workflow-state.schema.json +0 -200
|
@@ -1,206 +1,206 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: security-scan
|
|
3
|
-
description: Audits code security against OWASP Top 10. Validates user ID from session, detects sensitive data leaks, verifies Zod validation. HAS VETO POWER - blocks insecure code.
|
|
4
|
-
allowed-tools: Read, Grep, Glob, Bash
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Security Scan - Security Audit System
|
|
8
|
-
|
|
9
|
-
## VETO POWER
|
|
10
|
-
|
|
11
|
-
> **WARNING:** This skill HAS VETO POWER.
|
|
12
|
-
> If critical vulnerability detected, MUST:
|
|
13
|
-
>
|
|
14
|
-
> 1. STOP implementation
|
|
15
|
-
> 2. REPORT vulnerability
|
|
16
|
-
> 3. REQUIRE fix before proceeding
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Purpose
|
|
21
|
-
|
|
22
|
-
This skill audits code security:
|
|
23
|
-
|
|
24
|
-
- **Validates** user ID comes from session (NEVER from request)
|
|
25
|
-
- **Detects** sensitive data being sent to frontend
|
|
26
|
-
- **Verifies** Zod validation on all routes
|
|
27
|
-
- **Audits** against OWASP Top 10
|
|
28
|
-
- **Blocks** commits with critical vulnerabilities
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Critical Security Rules
|
|
33
|
-
|
|
34
|
-
### 1. USER ID ALWAYS FROM SESSION
|
|
35
|
-
|
|
36
|
-
> **NEVER** trust user ID from frontend.
|
|
37
|
-
> **ALWAYS** extract from `ctx.session.userId` or `ctx.user._id`.
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
// WRONG - VULNERABLE (IMMEDIATE VETO)
|
|
41
|
-
async function getData({ userId }: { userId: string }) {
|
|
42
|
-
return db.find({ userId }); // userId can be manipulated!
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// CORRECT
|
|
46
|
-
async function getData({ ctx }: { ctx: Context }) {
|
|
47
|
-
const userId = ctx.user._id; // Always from session
|
|
48
|
-
return db.find({ userId });
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 2. SENSITIVE DATA NEVER TO FRONTEND
|
|
53
|
-
|
|
54
|
-
> **NEVER** send to frontend:
|
|
55
|
-
>
|
|
56
|
-
> - Passwords (even hashed)
|
|
57
|
-
> - API tokens
|
|
58
|
-
> - Secret keys
|
|
59
|
-
> - Other users' data
|
|
60
|
-
> - Stack traces in production
|
|
61
|
-
|
|
62
|
-
```typescript
|
|
63
|
-
// WRONG - DATA LEAK (IMMEDIATE VETO)
|
|
64
|
-
return {
|
|
65
|
-
user: await UserModel.findById(id), // Includes passwordHash!
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// CORRECT
|
|
69
|
-
return {
|
|
70
|
-
user: user.toPublic(), // Sanitization method
|
|
71
|
-
};
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 3. ZOD VALIDATION REQUIRED
|
|
75
|
-
|
|
76
|
-
> **EVERY** tRPC route MUST have `.input(z.object({...}))`.
|
|
77
|
-
> Unvalidated inputs are attack vectors.
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
// WRONG - NO VALIDATION (IMMEDIATE VETO)
|
|
81
|
-
.mutation(async ({ input }) => {
|
|
82
|
-
await db.create(input); // input can have anything!
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
// CORRECT
|
|
86
|
-
.input(createSchema) // Zod schema
|
|
87
|
-
.mutation(async ({ input }) => {
|
|
88
|
-
await db.create(input); // input is validated
|
|
89
|
-
})
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## OWASP Top 10 Checklist
|
|
95
|
-
|
|
96
|
-
### A01: Broken Access Control
|
|
97
|
-
|
|
98
|
-
- [ ] All protected routes use `protectedProcedure`?
|
|
99
|
-
- [ ] User ID from session, not input?
|
|
100
|
-
- [ ] Resources filtered by user/tenant?
|
|
101
|
-
|
|
102
|
-
### A02: Cryptographic Failures
|
|
103
|
-
|
|
104
|
-
- [ ] Passwords hashed with bcrypt (salt >= 10)?
|
|
105
|
-
- [ ] Tokens generated with crypto.randomBytes?
|
|
106
|
-
- [ ] Cookies with HttpOnly, Secure, SameSite?
|
|
107
|
-
- [ ] No secrets in code (use env vars)?
|
|
108
|
-
|
|
109
|
-
### A03: Injection
|
|
110
|
-
|
|
111
|
-
- [ ] Queries use Mongoose (prevents NoSQL injection)?
|
|
112
|
-
- [ ] Inputs validated with Zod?
|
|
113
|
-
- [ ] No string concatenation in queries?
|
|
114
|
-
|
|
115
|
-
### A07: Authentication Failures
|
|
116
|
-
|
|
117
|
-
- [ ] Passwords with minimum requirements?
|
|
118
|
-
- [ ] Brute force protection?
|
|
119
|
-
- [ ] Sessions invalidated on logout?
|
|
120
|
-
- [ ] Tokens with expiration?
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Detection Patterns
|
|
125
|
-
|
|
126
|
-
### Detect User ID from Input (VETO)
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
grep -r "input\.userId\|input\.user_id\|{ userId }" server/ --include="*.ts"
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Detect Password Return (VETO)
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
grep -r "passwordHash\|password:" server/ --include="*.ts"
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Detect Route Without Validation (VETO)
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
grep -A5 "Procedure\." server/ --include="*.ts" | grep -v ".input("
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## Output Format
|
|
147
|
-
|
|
148
|
-
### Approved
|
|
149
|
-
|
|
150
|
-
```markdown
|
|
151
|
-
## SECURITY SCAN - APPROVED
|
|
152
|
-
|
|
153
|
-
### Scope
|
|
154
|
-
|
|
155
|
-
- **Files:** X
|
|
156
|
-
- **Routes:** Y
|
|
157
|
-
|
|
158
|
-
### Checks
|
|
159
|
-
|
|
160
|
-
- [x] User ID always from session
|
|
161
|
-
- [x] No sensitive data in response
|
|
162
|
-
- [x] All routes with Zod validation
|
|
163
|
-
- [x] OWASP Top 10 OK
|
|
164
|
-
|
|
165
|
-
**STATUS: APPROVED**
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Vetoed
|
|
169
|
-
|
|
170
|
-
```markdown
|
|
171
|
-
## SECURITY SCAN - VETOED
|
|
172
|
-
|
|
173
|
-
### CRITICAL VULNERABILITY
|
|
174
|
-
|
|
175
|
-
**Type:** User ID from Input
|
|
176
|
-
**File:** `server/routers/example.ts:45`
|
|
177
|
-
**Risk:** Any user can access other users' data
|
|
178
|
-
|
|
179
|
-
**Fix:** Use `ctx.user._id` instead of `input.userId`
|
|
180
|
-
|
|
181
|
-
**STATUS: VETOED** - Fix before proceeding
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
## VETO Rules
|
|
187
|
-
|
|
188
|
-
### IMMEDIATE VETO
|
|
189
|
-
|
|
190
|
-
1. User ID from input/request body
|
|
191
|
-
2. Password returned in response
|
|
192
|
-
3. API tokens exposed
|
|
193
|
-
4. Protected route without `protectedProcedure`
|
|
194
|
-
5. Query without user/tenant filter
|
|
195
|
-
|
|
196
|
-
### VETO BEFORE MERGE
|
|
197
|
-
|
|
198
|
-
1. Route without Zod validation
|
|
199
|
-
2. Unsanitized sensitive data
|
|
200
|
-
3. bun audit (or npm audit) with critical vulnerabilities
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## Version
|
|
205
|
-
|
|
206
|
-
- **v2.0.0** - Generic template
|
|
1
|
+
---
|
|
2
|
+
name: security-scan
|
|
3
|
+
description: Audits code security against OWASP Top 10. Validates user ID from session, detects sensitive data leaks, verifies Zod validation. HAS VETO POWER - blocks insecure code.
|
|
4
|
+
allowed-tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Security Scan - Security Audit System
|
|
8
|
+
|
|
9
|
+
## VETO POWER
|
|
10
|
+
|
|
11
|
+
> **WARNING:** This skill HAS VETO POWER.
|
|
12
|
+
> If critical vulnerability detected, MUST:
|
|
13
|
+
>
|
|
14
|
+
> 1. STOP implementation
|
|
15
|
+
> 2. REPORT vulnerability
|
|
16
|
+
> 3. REQUIRE fix before proceeding
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Purpose
|
|
21
|
+
|
|
22
|
+
This skill audits code security:
|
|
23
|
+
|
|
24
|
+
- **Validates** user ID comes from session (NEVER from request)
|
|
25
|
+
- **Detects** sensitive data being sent to frontend
|
|
26
|
+
- **Verifies** Zod validation on all routes
|
|
27
|
+
- **Audits** against OWASP Top 10
|
|
28
|
+
- **Blocks** commits with critical vulnerabilities
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Critical Security Rules
|
|
33
|
+
|
|
34
|
+
### 1. USER ID ALWAYS FROM SESSION
|
|
35
|
+
|
|
36
|
+
> **NEVER** trust user ID from frontend.
|
|
37
|
+
> **ALWAYS** extract from `ctx.session.userId` or `ctx.user._id`.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// WRONG - VULNERABLE (IMMEDIATE VETO)
|
|
41
|
+
async function getData({ userId }: { userId: string }) {
|
|
42
|
+
return db.find({ userId }); // userId can be manipulated!
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// CORRECT
|
|
46
|
+
async function getData({ ctx }: { ctx: Context }) {
|
|
47
|
+
const userId = ctx.user._id; // Always from session
|
|
48
|
+
return db.find({ userId });
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. SENSITIVE DATA NEVER TO FRONTEND
|
|
53
|
+
|
|
54
|
+
> **NEVER** send to frontend:
|
|
55
|
+
>
|
|
56
|
+
> - Passwords (even hashed)
|
|
57
|
+
> - API tokens
|
|
58
|
+
> - Secret keys
|
|
59
|
+
> - Other users' data
|
|
60
|
+
> - Stack traces in production
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// WRONG - DATA LEAK (IMMEDIATE VETO)
|
|
64
|
+
return {
|
|
65
|
+
user: await UserModel.findById(id), // Includes passwordHash!
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// CORRECT
|
|
69
|
+
return {
|
|
70
|
+
user: user.toPublic(), // Sanitization method
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 3. ZOD VALIDATION REQUIRED
|
|
75
|
+
|
|
76
|
+
> **EVERY** tRPC route MUST have `.input(z.object({...}))`.
|
|
77
|
+
> Unvalidated inputs are attack vectors.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// WRONG - NO VALIDATION (IMMEDIATE VETO)
|
|
81
|
+
.mutation(async ({ input }) => {
|
|
82
|
+
await db.create(input); // input can have anything!
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
// CORRECT
|
|
86
|
+
.input(createSchema) // Zod schema
|
|
87
|
+
.mutation(async ({ input }) => {
|
|
88
|
+
await db.create(input); // input is validated
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## OWASP Top 10 Checklist
|
|
95
|
+
|
|
96
|
+
### A01: Broken Access Control
|
|
97
|
+
|
|
98
|
+
- [ ] All protected routes use `protectedProcedure`?
|
|
99
|
+
- [ ] User ID from session, not input?
|
|
100
|
+
- [ ] Resources filtered by user/tenant?
|
|
101
|
+
|
|
102
|
+
### A02: Cryptographic Failures
|
|
103
|
+
|
|
104
|
+
- [ ] Passwords hashed with bcrypt (salt >= 10)?
|
|
105
|
+
- [ ] Tokens generated with crypto.randomBytes?
|
|
106
|
+
- [ ] Cookies with HttpOnly, Secure, SameSite?
|
|
107
|
+
- [ ] No secrets in code (use env vars)?
|
|
108
|
+
|
|
109
|
+
### A03: Injection
|
|
110
|
+
|
|
111
|
+
- [ ] Queries use Mongoose (prevents NoSQL injection)?
|
|
112
|
+
- [ ] Inputs validated with Zod?
|
|
113
|
+
- [ ] No string concatenation in queries?
|
|
114
|
+
|
|
115
|
+
### A07: Authentication Failures
|
|
116
|
+
|
|
117
|
+
- [ ] Passwords with minimum requirements?
|
|
118
|
+
- [ ] Brute force protection?
|
|
119
|
+
- [ ] Sessions invalidated on logout?
|
|
120
|
+
- [ ] Tokens with expiration?
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Detection Patterns
|
|
125
|
+
|
|
126
|
+
### Detect User ID from Input (VETO)
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
grep -r "input\.userId\|input\.user_id\|{ userId }" server/ --include="*.ts"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Detect Password Return (VETO)
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
grep -r "passwordHash\|password:" server/ --include="*.ts"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Detect Route Without Validation (VETO)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
grep -A5 "Procedure\." server/ --include="*.ts" | grep -v ".input("
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Output Format
|
|
147
|
+
|
|
148
|
+
### Approved
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
## SECURITY SCAN - APPROVED
|
|
152
|
+
|
|
153
|
+
### Scope
|
|
154
|
+
|
|
155
|
+
- **Files:** X
|
|
156
|
+
- **Routes:** Y
|
|
157
|
+
|
|
158
|
+
### Checks
|
|
159
|
+
|
|
160
|
+
- [x] User ID always from session
|
|
161
|
+
- [x] No sensitive data in response
|
|
162
|
+
- [x] All routes with Zod validation
|
|
163
|
+
- [x] OWASP Top 10 OK
|
|
164
|
+
|
|
165
|
+
**STATUS: APPROVED**
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Vetoed
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## SECURITY SCAN - VETOED
|
|
172
|
+
|
|
173
|
+
### CRITICAL VULNERABILITY
|
|
174
|
+
|
|
175
|
+
**Type:** User ID from Input
|
|
176
|
+
**File:** `server/routers/example.ts:45`
|
|
177
|
+
**Risk:** Any user can access other users' data
|
|
178
|
+
|
|
179
|
+
**Fix:** Use `ctx.user._id` instead of `input.userId`
|
|
180
|
+
|
|
181
|
+
**STATUS: VETOED** - Fix before proceeding
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## VETO Rules
|
|
187
|
+
|
|
188
|
+
### IMMEDIATE VETO
|
|
189
|
+
|
|
190
|
+
1. User ID from input/request body
|
|
191
|
+
2. Password returned in response
|
|
192
|
+
3. API tokens exposed
|
|
193
|
+
4. Protected route without `protectedProcedure`
|
|
194
|
+
5. Query without user/tenant filter
|
|
195
|
+
|
|
196
|
+
### VETO BEFORE MERGE
|
|
197
|
+
|
|
198
|
+
1. Route without Zod validation
|
|
199
|
+
2. Unsanitized sensitive data
|
|
200
|
+
3. bun audit (or npm audit) with critical vulnerabilities
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Version
|
|
205
|
+
|
|
206
|
+
- **v2.0.0** - Generic template
|