qa-workflow-cc 1.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.
Files changed (39) hide show
  1. package/README.md +461 -0
  2. package/VERSION +1 -0
  3. package/bin/install.js +116 -0
  4. package/commands/qa/continue.md +77 -0
  5. package/commands/qa/full.md +149 -0
  6. package/commands/qa/init.md +105 -0
  7. package/commands/qa/resume.md +91 -0
  8. package/commands/qa/status.md +66 -0
  9. package/package.json +28 -0
  10. package/skills/qa/SKILL.md +420 -0
  11. package/skills/qa/references/continuation-format.md +58 -0
  12. package/skills/qa/references/exit-criteria.md +53 -0
  13. package/skills/qa/references/lifecycle.md +181 -0
  14. package/skills/qa/references/model-profiles.md +77 -0
  15. package/skills/qa/templates/agent-skeleton.md +733 -0
  16. package/skills/qa/templates/component-test.md +1088 -0
  17. package/skills/qa/templates/domain-research-queries.md +101 -0
  18. package/skills/qa/templates/domain-security-profiles.md +182 -0
  19. package/skills/qa/templates/e2e-test.md +1200 -0
  20. package/skills/qa/templates/nielsen-heuristics.md +274 -0
  21. package/skills/qa/templates/performance-benchmarks-base.md +321 -0
  22. package/skills/qa/templates/qa-report-template.md +271 -0
  23. package/skills/qa/templates/security-checklist-owasp.md +451 -0
  24. package/skills/qa/templates/stop-points/bootstrap-complete.md +36 -0
  25. package/skills/qa/templates/stop-points/certified.md +25 -0
  26. package/skills/qa/templates/stop-points/escalated.md +32 -0
  27. package/skills/qa/templates/stop-points/fix-ready.md +43 -0
  28. package/skills/qa/templates/stop-points/phase-transition.md +4 -0
  29. package/skills/qa/templates/stop-points/status-dashboard.md +32 -0
  30. package/skills/qa/templates/test-standards.md +652 -0
  31. package/skills/qa/templates/unit-test.md +998 -0
  32. package/skills/qa/templates/visual-regression.md +418 -0
  33. package/skills/qa/workflows/bootstrap.md +45 -0
  34. package/skills/qa/workflows/decision-gate.md +66 -0
  35. package/skills/qa/workflows/fix-execute.md +132 -0
  36. package/skills/qa/workflows/fix-plan.md +52 -0
  37. package/skills/qa/workflows/report-phase.md +64 -0
  38. package/skills/qa/workflows/test-phase.md +86 -0
  39. package/skills/qa/workflows/verify-phase.md +65 -0
@@ -0,0 +1,451 @@
1
+ # Security Checklist -- OWASP API Top 10 (Generic Template)
2
+
3
+ Category B template for QA bootstrapping. Contains the universal OWASP API Security Top 10 (2023) framework with `{{variable}}` placeholders for project-specific content.
4
+
5
+ Reference: OWASP API Security Top 10 (2023) -- owasp.org/API-Security
6
+
7
+ ## Variables
8
+
9
+ | Variable | Description | Example |
10
+ |----------|-------------|---------|
11
+ | `{{routerMatrix}}` | Complete list of API routers/endpoints with auth types and isolation requirements | lead.ts: 11 procedures, protected, tenantId required |
12
+ | `{{authTypes}}` | Authentication mechanisms used in this project | Clerk JWT, Magic Link sessions, API keys |
13
+ | `{{externalAPIs}}` | Third-party APIs consumed by the backend | Twilio, Stripe, Cloudinary, OpenAI |
14
+ | `{{tenantIsolationField}}` | The database field used for multi-tenant isolation | orgId, tenantId, workspaceId, userId |
15
+ | `{{projectName}}` | Name of the project | TruLine, Acme CRM |
16
+ | `{{procedureTypes}}` | Named procedure types in the API framework | protectedProcedure, publicProcedure, adminProcedure |
17
+
18
+ ---
19
+
20
+ ## 1. Tenant Isolation Matrix (CRITICAL)
21
+
22
+ Every API router/endpoint must be verified for tenant isolation using the `{{tenantIsolationField}}` field. This is the single most important security check for any multi-tenant application.
23
+
24
+ Status values: `VERIFIED` / `UNVERIFIED` / `VIOLATION` / `N/A` (public endpoint)
25
+
26
+ ### Router Isolation Audit
27
+
28
+ {{routerMatrix}}
29
+
30
+ <!-- BOOTSTRAP INSTRUCTIONS:
31
+ Replace {{routerMatrix}} with a complete audit of every router/controller in your API.
32
+ To generate this list, scan your API source code for all route handlers.
33
+
34
+ For tRPC projects:
35
+ grep -r "router(" apps/api/src/trpc/routers/ --include="*.ts" -l
36
+
37
+ For Express/Fastify projects:
38
+ grep -r "router\.\(get\|post\|put\|delete\|patch\)" apps/api/src/ --include="*.ts" -l
39
+
40
+ For Next.js API routes:
41
+ find apps/*/app/api -name "route.ts" -o -name "route.js"
42
+
43
+ Format each router as a row in this table:
44
+
45
+ | Router | File | Procedures/Endpoints | Auth Type | {{tenantIsolationField}} Required |
46
+ |--------|------|---------------------|-----------|----------------------------------|
47
+ | user | routers/user.ts | 5 | protected | YES -- all queries |
48
+ | auth | routers/auth.ts | 3 | public | NO -- authentication endpoints |
49
+ | billing | routers/billing.ts | 4 | protected | YES -- org-scoped billing |
50
+ | webhook | routers/webhook.ts | 2 | webhook-signature | N/A -- validated via signature |
51
+
52
+ Auth type values:
53
+ - "protected" -- requires authenticated session
54
+ - "public" -- no auth required
55
+ - "mixed" -- some procedures public, some protected
56
+ - "webhook-signature" -- validated via webhook signature verification
57
+ - "api-key" -- validated via API key
58
+ - (use your project's {{authTypes}} names)
59
+
60
+ {{tenantIsolationField}} Required values:
61
+ - "YES -- {reason}" -- every query must filter by this field
62
+ - "NO -- {reason}" -- public/global data, no tenant scoping needed
63
+ - "MIXED -- {explanation}" -- some procedures need it, some don't
64
+ -->
65
+
66
+ ### Isolation Verification Pattern
67
+
68
+ For each procedure/endpoint, verify that tenant isolation is enforced at the data access layer:
69
+
70
+ ```
71
+ // READ: Must include {{tenantIsolationField}} in WHERE clause
72
+ db.model.findMany({ where: { {{tenantIsolationField}}: ctx.{{tenantIsolationField}}, ... } })
73
+
74
+ // CREATE: Must set {{tenantIsolationField}} from authenticated context
75
+ db.model.create({ data: { {{tenantIsolationField}}: ctx.{{tenantIsolationField}}, ... } })
76
+
77
+ // UPDATE: Must verify ownership before updating
78
+ const record = await db.model.findFirst({
79
+ where: { id, {{tenantIsolationField}}: ctx.{{tenantIsolationField}} }
80
+ })
81
+ if (!record) throw new AuthorizationError('Not found')
82
+
83
+ // DELETE: Must verify ownership before deleting
84
+ const record = await db.model.findFirst({
85
+ where: { id, {{tenantIsolationField}}: ctx.{{tenantIsolationField}} }
86
+ })
87
+ if (!record) throw new AuthorizationError('Not found')
88
+
89
+ // TRANSACTION: Must use {{tenantIsolationField}} inside transaction
90
+ db.$transaction(async (tx) => {
91
+ const record = await tx.model.findFirst({
92
+ where: { id, {{tenantIsolationField}}: ctx.{{tenantIsolationField}} }
93
+ })
94
+ // ...
95
+ })
96
+ ```
97
+
98
+ ### Common Isolation Violations to Check
99
+
100
+ | Violation Pattern | Risk | How to Detect |
101
+ |-------------------|------|---------------|
102
+ | Missing WHERE clause filter | Cross-tenant data leak | Search for `findMany` without `{{tenantIsolationField}}` |
103
+ | ID-only lookups (no tenant check) | Direct object reference attack | Search for `findUnique({ where: { id } })` |
104
+ | Aggregation without tenant scope | Cross-tenant analytics leak | Search for `aggregate`, `groupBy`, `count` without tenant filter |
105
+ | Nested relation traversal | Indirect data leak | Check if `include` relations cross tenant boundaries |
106
+ | Raw SQL without tenant filter | SQL injection + data leak | Search for `$queryRaw`, `$executeRaw` |
107
+ | Batch operations without scope | Mass data modification | Search for `updateMany`, `deleteMany` without tenant filter |
108
+
109
+ ---
110
+
111
+ ## 2. Authentication Boundary Matrix
112
+
113
+ ### Procedure/Middleware Types
114
+
115
+ {{authTypes}}
116
+
117
+ <!-- BOOTSTRAP INSTRUCTIONS:
118
+ Replace {{authTypes}} with your project's authentication mechanisms.
119
+
120
+ Example for a project using JWT + API keys:
121
+
122
+ | Type | Auth Mechanism | Context Fields Available |
123
+ |------|---------------|------------------------|
124
+ | `authenticatedProcedure` | Bearer JWT (Auth0/Clerk/etc.) | ctx.userId, ctx.orgId, ctx.userRole |
125
+ | `apiKeyProcedure` | X-API-Key header | ctx.apiKeyId, ctx.orgId, ctx.scopes |
126
+ | `webhookProcedure` | Webhook signature verification | ctx.webhookSource |
127
+ | `publicProcedure` | None | ctx.db only |
128
+
129
+ Example for a project using session auth + magic links:
130
+
131
+ | Type | Auth Mechanism | Context Fields Available |
132
+ |------|---------------|------------------------|
133
+ | `protectedProcedure` | Session cookie (NextAuth/Lucia) | ctx.userId, ctx.tenantId, ctx.role |
134
+ | `magicLinkProcedure` | Token in URL -> session | ctx.customerId, ctx.tenantId |
135
+ | `publicProcedure` | None | ctx.db only |
136
+
137
+ Example for a simple API key project:
138
+
139
+ | Type | Auth Mechanism | Context Fields Available |
140
+ |------|---------------|------------------------|
141
+ | `authenticatedRoute` | Bearer token / API key | ctx.userId, ctx.orgId |
142
+ | `publicRoute` | None | ctx.db only |
143
+ -->
144
+
145
+ ### Auth Boundary Checks (Universal)
146
+
147
+ These checks apply regardless of which authentication system you use.
148
+
149
+ | Check | Test Method | Expected Result |
150
+ |-------|-------------|-----------------|
151
+ | Protected routes reject unauthenticated requests | Call without auth token/session | 401 UNAUTHORIZED |
152
+ | Token expiration is enforced | Call with expired token | 401 UNAUTHORIZED |
153
+ | Invalid tokens are rejected | Call with malformed/tampered token | 401 UNAUTHORIZED |
154
+ | Public routes do not leak tenant data | Inspect response body of public endpoints | No tenant IDs, no user data, no internal references |
155
+ | Role checks on privileged operations | Call admin endpoint as regular user | 403 FORBIDDEN |
156
+ | Session invalidation works | Call after explicit logout | 401 UNAUTHORIZED |
157
+ | Rate limiting on auth endpoints | Send 100+ requests to login/token endpoint | 429 TOO MANY REQUESTS |
158
+
159
+ ### Known Public Endpoints (Verify These Do Not Expose Sensitive Data)
160
+
161
+ <!-- BOOTSTRAP INSTRUCTIONS:
162
+ List all endpoints/procedures that do NOT require authentication.
163
+ For each one, assess the sensitive data risk.
164
+
165
+ Example:
166
+
167
+ | Router/Path | Procedure/Method | Purpose | Sensitive Data Risk |
168
+ |------------|-----------------|---------|-------------------|
169
+ | auth | register | User registration | LOW -- writes only |
170
+ | auth | login | User authentication | MEDIUM -- returns token |
171
+ | health | check | Health check endpoint | NONE -- status only |
172
+ | webhook | stripe | Stripe webhook receiver | LOW -- signature verified |
173
+ | public | productList | Public product listing | NONE -- public data |
174
+ -->
175
+
176
+ ---
177
+
178
+ ## 3. OWASP API Security Top 10 (2023) Checks
179
+
180
+ ### API1: Broken Object Level Authorization (BOLA)
181
+
182
+ The most common and impactful API vulnerability. Every endpoint that accesses a resource by ID must verify the caller owns or has permission to access that resource.
183
+
184
+ | Check | How to Test |
185
+ |-------|-------------|
186
+ | Direct object reference | Verify `GET /resource/{id}` checks tenant ownership |
187
+ | Nested object access | Verify `GET /parent/{id}/children` checks parent belongs to tenant |
188
+ | Bulk operations | Verify batch status changes filter by tenant |
189
+ | Related object traversal | Verify linked resources (parent -> child -> grandchild) maintain isolation at every level |
190
+ | ID enumeration | Verify sequential/guessable IDs cannot be used to access other tenants' data |
191
+ | Cross-reference integrity | Verify assigning resource A to resource B checks both belong to same tenant |
192
+
193
+ #### BOLA Testing Script (Conceptual)
194
+
195
+ ```
196
+ 1. Authenticate as Tenant A
197
+ 2. Create a resource (get resource_id)
198
+ 3. Authenticate as Tenant B
199
+ 4. Attempt to GET /resource/{resource_id} -> Must return 404 or 403
200
+ 5. Attempt to PUT /resource/{resource_id} -> Must return 404 or 403
201
+ 6. Attempt to DELETE /resource/{resource_id} -> Must return 404 or 403
202
+ 7. Attempt to list resources -> Must NOT include Tenant A's resources
203
+ ```
204
+
205
+ ### API2: Broken Authentication
206
+
207
+ | Check | How to Test |
208
+ |-------|-------------|
209
+ | Token/session validation | Verify auth is validated on every protected request |
210
+ | Token/session expiration | Verify expired credentials are rejected |
211
+ | Session invalidation on logout | Verify tokens/sessions are revoked on logout |
212
+ | Credential stuffing protection | Verify rate limiting on login/auth endpoints |
213
+ | Sensitive tokens not in URLs | Verify tokens are not passed as URL query parameters (except one-time use) |
214
+ | Token not in server logs | Verify auth tokens are redacted in application logs |
215
+ | Password/credential rotation | Verify API keys can be rotated without downtime |
216
+
217
+ ### API3: Broken Object Property Level Authorization
218
+
219
+ | Check | How to Test |
220
+ |-------|-------------|
221
+ | Mass assignment prevention | Verify input schemas restrict writable fields (no extra fields accepted) |
222
+ | Excessive data exposure | Verify responses do not include internal fields (createdById, internalNotes, etc.) |
223
+ | Role-based field access | Verify regular users cannot set privileged fields (role, permissions, billing tier) |
224
+ | Partial update restrictions | Verify PATCH endpoints only allow updating permitted fields |
225
+ | Hidden field injection | Send unexpected fields in request body, verify they are ignored |
226
+
227
+ ### API4: Unrestricted Resource Consumption
228
+
229
+ | Check | How to Test |
230
+ |-------|-------------|
231
+ | Pagination limits enforced | All list queries have a maximum limit (e.g., 100 items) |
232
+ | Upload size limits | File uploads have size caps enforced server-side |
233
+ | Query complexity bounds | No unbounded JOINs, recursive queries, or unlimited aggregations |
234
+ | Rate limiting on all public endpoints | Public endpoints return 429 after threshold |
235
+ | Request body size limits | API rejects oversized payloads (e.g., > 10MB) |
236
+ | Concurrent request limits | Per-user/per-IP connection limits enforced |
237
+ | Timeout enforcement | Long-running requests are terminated after timeout |
238
+
239
+ ### API5: Broken Function Level Authorization
240
+
241
+ | Check | How to Test |
242
+ |-------|-------------|
243
+ | Role enforcement on admin routes | Non-admin users cannot access admin-only endpoints |
244
+ | Feature gating by subscription | Free-tier users cannot access premium features |
245
+ | Privilege escalation prevention | Regular user cannot promote themselves to admin |
246
+ | Horizontal privilege separation | User A cannot perform actions as User B within same tenant |
247
+ | Method-level authorization | Verify read-only roles cannot call mutation endpoints |
248
+
249
+ ### API6: Unrestricted Access to Sensitive Business Flows
250
+
251
+ | Check | How to Test |
252
+ |-------|-------------|
253
+ | Resource creation rate limiting | Cannot mass-create resources via automated scripts |
254
+ | Transactional operation protection | Financial/billing operations have additional confirmation |
255
+ | AI/LLM abuse prevention | Rate limit on AI generation endpoints |
256
+ | Communication abuse prevention | Rate limit on email/SMS/notification sending |
257
+ | Export/download throttling | Cannot bulk-export all data via repeated API calls |
258
+ | Account creation abuse | Registration has CAPTCHA or rate limiting |
259
+
260
+ ### API7: Server Side Request Forgery (SSRF)
261
+
262
+ | Check | How to Test |
263
+ |-------|-------------|
264
+ | User-supplied URL validation | Verify URLs are validated against allowlist |
265
+ | Internal network protection | Verify requests cannot reach internal services (169.254.x.x, 10.x.x.x, localhost) |
266
+ | URL scheme restriction | Only allow https:// (block file://, ftp://, gopher://) |
267
+ | Redirect following | Verify redirects do not lead to internal resources |
268
+ | Image/media URL construction | Verify CDN URLs are constructed server-side, not from user input |
269
+ | Webhook URL validation | Verify webhook destination URLs are validated |
270
+ | Integration callback URLs | Verify OAuth/integration callbacks use whitelisted URLs |
271
+
272
+ ### API8: Security Misconfiguration
273
+
274
+ | Check | How to Test |
275
+ |-------|-------------|
276
+ | Error detail leakage | Production errors do not expose stack traces, file paths, or SQL |
277
+ | CORS configuration | Only explicitly allowed origins can make cross-origin requests |
278
+ | Debug endpoints in production | Test/debug endpoints are disabled or gated in production |
279
+ | Default credentials | No hardcoded API keys, passwords, or tokens in source code |
280
+ | HTTPS enforcement | All production traffic requires HTTPS, HTTP redirects to HTTPS |
281
+ | Security headers | X-Content-Type-Options, X-Frame-Options, CSP, HSTS present |
282
+ | Server version headers | Server software version not exposed in response headers |
283
+ | Directory listing disabled | Web server does not expose directory listings |
284
+ | Source maps in production | JavaScript source maps not publicly accessible |
285
+
286
+ #### Security Headers Checklist
287
+
288
+ | Header | Expected Value |
289
+ |--------|---------------|
290
+ | `Strict-Transport-Security` | `max-age=31536000; includeSubDomains` |
291
+ | `X-Content-Type-Options` | `nosniff` |
292
+ | `X-Frame-Options` | `DENY` or `SAMEORIGIN` |
293
+ | `Content-Security-Policy` | Appropriate CSP for your app |
294
+ | `Referrer-Policy` | `strict-origin-when-cross-origin` |
295
+ | `Permissions-Policy` | Restrict unused browser features |
296
+ | `X-XSS-Protection` | `0` (rely on CSP instead) |
297
+
298
+ ### API9: Improper Inventory Management
299
+
300
+ | Check | How to Test |
301
+ |-------|-------------|
302
+ | No unused/deprecated endpoints mounted | Audit all registered routes against active features |
303
+ | Debug/test procedures gated | Test endpoints (ping, health-debug, test-error) gated behind env flag |
304
+ | API documentation not exposed | Swagger/OpenAPI docs not publicly accessible in production |
305
+ | Old API versions decommissioned | No /v1/ routes serving data if /v2/ is current |
306
+ | Shadow/undocumented endpoints | All endpoints appear in the route inventory |
307
+ | Orphaned middleware | No authentication middleware that is registered but not enforcing |
308
+
309
+ ### API10: Unsafe Consumption of APIs
310
+
311
+ {{externalAPIs}}
312
+
313
+ <!-- BOOTSTRAP INSTRUCTIONS:
314
+ Replace {{externalAPIs}} with checks for each third-party API your project consumes.
315
+
316
+ For each external API, verify:
317
+ 1. Response validation -- do you validate the structure before using the data?
318
+ 2. Error handling -- do you handle malformed/unexpected responses gracefully?
319
+ 3. Credential security -- are API keys stored in env vars, not code?
320
+ 4. Webhook signature verification -- if receiving webhooks, do you verify signatures?
321
+ 5. Timeout handling -- do you set timeouts on outbound requests?
322
+ 6. Data sanitization -- do you sanitize data from external APIs before storing/displaying?
323
+
324
+ Example:
325
+
326
+ | External API | Response Validated | Webhook Signature Verified | Timeout Set | Credentials in Env |
327
+ |-------------|-------------------|---------------------------|-------------|-------------------|
328
+ | Stripe | Verify event structure | Yes (stripe-signature header) | 10s | Yes (STRIPE_SECRET_KEY) |
329
+ | OpenAI/Anthropic | Handle malformed AI responses | N/A | 30s | Yes (OPENAI_API_KEY) |
330
+ | Twilio | Validate webhook body | Yes (X-Twilio-Signature) | 10s | Yes (TWILIO_AUTH_TOKEN) |
331
+ | Cloudinary | Validate upload response | N/A | 15s | Yes (CLOUDINARY_API_SECRET) |
332
+ | SendGrid/Brevo | Validate send response | Yes (if receiving events) | 10s | Yes (SENDGRID_API_KEY) |
333
+ | AWS S3 | Validate presigned URL response | N/A | 10s | Yes (AWS credentials) |
334
+
335
+ If your project consumes no external APIs, replace this section with:
336
+ "No external APIs consumed. This section is not applicable."
337
+ -->
338
+
339
+ ---
340
+
341
+ ## 4. Data Protection Checks (Universal)
342
+
343
+ These checks apply to every project regardless of technology stack.
344
+
345
+ | Check | How to Verify | Severity if Violated |
346
+ |-------|---------------|---------------------|
347
+ | PII not logged in plain text | Search logs for email/phone patterns; review logging middleware | Critical |
348
+ | Secrets in environment variables, not code | `grep -r "sk_live\|password\|secret" --include="*.ts" --include="*.js"` | Critical |
349
+ | Session tokens stored securely | Verify HttpOnly, Secure, SameSite cookie flags | Major |
350
+ | No custom password hashing | Use auth provider's hashing; verify no bcrypt/argon2 DIY code | Major |
351
+ | Data retention policies implemented | Verify cleanup jobs for old sessions, logs, temporary data | Minor |
352
+ | PII encryption at rest | Verify sensitive fields are encrypted in database or use encrypted storage | Major |
353
+ | Backup security | Database backups encrypted, access-controlled | Major |
354
+ | Data export controls | User data export (GDPR) does not leak other users' data | Critical |
355
+ | Soft delete for audit trail | Verify hard deletes are not used for auditable records | Minor |
356
+ | Input sanitization | Verify HTML/script injection is prevented in user inputs | Major |
357
+
358
+ ### Secrets Scanning Checklist
359
+
360
+ | Pattern to Search For | What It Indicates |
361
+ |-----------------------|-------------------|
362
+ | `sk_live_`, `sk_test_` | Stripe API keys in code |
363
+ | `AKIA`, `ASIA` | AWS access keys in code |
364
+ | `ghp_`, `gho_` | GitHub tokens in code |
365
+ | `-----BEGIN RSA PRIVATE KEY-----` | Private keys in code |
366
+ | `password`, `passwd`, `pwd` (as string values) | Hardcoded passwords |
367
+ | `Bearer ` (in source, not test files) | Hardcoded auth tokens |
368
+ | `.env` files committed to git | Environment file exposure |
369
+ | Base64-encoded secrets | Obfuscated but not secured credentials |
370
+
371
+ ---
372
+
373
+ ## 5. Severity Guide for Security Findings (Universal)
374
+
375
+ | Severity | Definition | Response Time | Release Impact |
376
+ |----------|-----------|---------------|----------------|
377
+ | **Critical** | Cross-tenant data access, authentication bypass, data leak to unauthorized party, remote code execution | Fix immediately. Stop all other work. | Blocks release unconditionally. |
378
+ | **Major** | Missing auth on sensitive route, weak input validation on mutation, CSRF vulnerability, privilege escalation | Fix before release. | Blocks release. |
379
+ | **Minor** | Missing rate limit on non-sensitive endpoint, verbose error messages in production, minor information disclosure | Fix within 1 sprint. | Does not block release. |
380
+ | **Info** | Best practice suggestion, defense-in-depth improvement, future-proofing recommendation | Track in backlog. | Does not block release. |
381
+
382
+ ### Escalation Matrix
383
+
384
+ | Finding | Action |
385
+ |---------|--------|
386
+ | Any Critical finding | Immediately notify project lead. Halt deploys until fixed. |
387
+ | 3+ Major findings in same area | Consider architectural review of that module. |
388
+ | Pattern of Minor findings | Investigate root cause (e.g., missing middleware, incomplete code review). |
389
+ | External dependency vulnerability | Check if exploitable in current usage; upgrade if yes. |
390
+
391
+ ---
392
+
393
+ ## 6. Testing Methodology
394
+
395
+ ### Static Analysis (Code Review)
396
+
397
+ For each router/controller in `{{routerMatrix}}`:
398
+
399
+ 1. Open the source file
400
+ 2. List every procedure/endpoint
401
+ 3. For each procedure, verify:
402
+ - [ ] Authentication middleware is applied (or intentionally public)
403
+ - [ ] `{{tenantIsolationField}}` is in every database query WHERE clause
404
+ - [ ] Input is validated with a schema (Zod, Joi, class-validator, etc.)
405
+ - [ ] Output does not include internal-only fields
406
+ - [ ] Error handling does not leak internal details
407
+ - [ ] No raw SQL without parameterization
408
+
409
+ ### Dynamic Testing (Runtime)
410
+
411
+ 1. Set up two test tenant accounts (Tenant A and Tenant B)
412
+ 2. For each protected endpoint:
413
+ - [ ] Call as Tenant A, verify success
414
+ - [ ] Call as Tenant B with Tenant A's resource IDs, verify rejection
415
+ - [ ] Call without authentication, verify rejection
416
+ 3. For each public endpoint:
417
+ - [ ] Verify response contains no tenant-specific data
418
+ - [ ] Verify rate limiting is active
419
+ 4. For each webhook endpoint:
420
+ - [ ] Send request without valid signature, verify rejection
421
+ - [ ] Send request with valid signature, verify acceptance
422
+
423
+ ### Automated Scanning
424
+
425
+ | Tool | Purpose | Run Frequency |
426
+ |------|---------|---------------|
427
+ | npm audit / pnpm audit | Dependency vulnerability scan | Every CI run |
428
+ | Semgrep / ESLint security rules | Static code analysis | Every CI run |
429
+ | OWASP ZAP (lightweight scan) | Dynamic application security testing | Weekly or pre-release |
430
+ | Trivy / Snyk | Container and dependency scanning | Every CI run |
431
+ | git-secrets / trufflehog | Secrets detection in git history | Every CI run |
432
+
433
+ ---
434
+
435
+ ## Report Format
436
+
437
+ When reporting security audit findings, use this format for each finding:
438
+
439
+ ```
440
+ ### SEC-{NNN}: {Finding Title}
441
+
442
+ - **OWASP Category:** API{1-10} -- {Category Name}
443
+ - **Severity:** Critical / Major / Minor / Info
444
+ - **Router/Endpoint:** {router name or endpoint path}
445
+ - **File:** {file path}:{line number}
446
+ - **Description:** {what the vulnerability is}
447
+ - **Proof of Concept:** {steps to reproduce or code showing the issue}
448
+ - **Impact:** {what an attacker could do}
449
+ - **Remediation:** {specific fix with code example}
450
+ - **Status:** OPEN / FIXED / ACCEPTED RISK
451
+ ```
@@ -0,0 +1,36 @@
1
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2
+ QA ► BOOTSTRAP COMPLETE
3
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4
+
5
+ **{project.name}** — {N} files generated
6
+
7
+ | Category | Details |
8
+ |----------|---------|
9
+ | Apps | {app list with frameworks} |
10
+ | Test runner | {testRunner} / E2E: {e2eFramework} |
11
+ | Auth | {authMethods} / Multi-tenant: {yes/no} |
12
+ | PRD | {found at path / not found — testing inferred features} |
13
+ | Domain | {domain label} |
14
+ | Anthropic docs | {Verified current / Using local copies} |
15
+
16
+ ---
17
+
18
+ ## ▶ Next Up
19
+
20
+ **QA Cycle 1** — full test suite against {N} feature categories
21
+
22
+ `/qa:full`
23
+
24
+ <sub>`/clear` first → fresh context window</sub>
25
+
26
+ ---
27
+
28
+ **Also available:**
29
+ - `/qa:full api` — API/backend tests only
30
+ - `/qa:full security` — security audit only
31
+ - `/qa:full ux` — UX heuristic evaluation only
32
+ - `/qa:status` — check current state
33
+
34
+ ---
35
+ If session interrupted → `/qa:resume`
36
+ ---
@@ -0,0 +1,25 @@
1
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2
+ QA ► CERTIFIED ✓
3
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4
+
5
+ **{project.name}** — QA complete in {N} cycle(s)
6
+
7
+ {pass}/{total} tests passing ({percent}%)
8
+ All exit criteria met
9
+
10
+ | Gate | Threshold | Result |
11
+ |------|-----------|--------|
12
+ {for each gate: threshold, actual value, ✓}
13
+
14
+ Certification: `docs/qa-reports/final-certification-{date}.md`
15
+
16
+ ---
17
+
18
+ ## ✓ QA Complete
19
+
20
+ **Also available:**
21
+ - `/qa:full cycle-{N+1}` — start a new cycle (regression testing after changes)
22
+ - `/qa:status` — review full cycle history
23
+ - `cat docs/qa-reports/final-certification-{date}.md` — view certification report
24
+
25
+ ---
@@ -0,0 +1,32 @@
1
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2
+ QA ► BLOCKED — MANUAL INTERVENTION NEEDED
3
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4
+
5
+ **Cycle {N}:** {pass}/{total} passing ({percent}%)
6
+ **Stuck defects:** {n} defects unchanged across {m} cycles
7
+
8
+ ### Stuck Defects
9
+
10
+ {For each stuck defect:}
11
+ - **{defect-id}** ({severity}): {description}
12
+ Attempted: {what was tried across cycles}
13
+
14
+ Analysis: `docs/qa-reports/escalation-cycle-{N}.md`
15
+
16
+ ---
17
+
18
+ ## ▶ Next Up
19
+
20
+ **Manual intervention required.** After resolving stuck defects:
21
+
22
+ `/qa:full cycle-{N+1}`
23
+
24
+ <sub>`/clear` first → fresh context window</sub>
25
+
26
+ ---
27
+
28
+ **Also available:**
29
+ - `cat docs/qa-reports/escalation-cycle-{N}.md` — full escalation analysis
30
+ - `/qa:status` — review cycle history and defect trends
31
+
32
+ ---
@@ -0,0 +1,43 @@
1
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2
+ QA ► CYCLE {N} — FIX PLAN READY
3
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4
+
5
+ **Cycle {N}:** {pass}/{total} passing ({percent}%)
6
+
7
+ | Severity | Count |
8
+ |----------|-------|
9
+ | Critical | {n} |
10
+ | Major | {n} |
11
+ | Minor | {n} |
12
+ | Cosmetic | {n} |
13
+
14
+ ### Fix Plan Summary
15
+
16
+ {For each fix batch:}
17
+ **P{X} Batch** ({n} fixes):
18
+ {For each fix: one-line summary — severity, file, approach}
19
+
20
+ Full report: `docs/qa-reports/cycle-{N}-{date}.md`
21
+ Fix plan: `docs/qa-reports/fix-plan-cycle-{N}.md`
22
+
23
+ ---
24
+
25
+ ## ▶ Next Up
26
+
27
+ **Execute fixes** — applies {N} fixes, verifies each, then re-tests automatically
28
+
29
+ `/qa:continue`
30
+
31
+ <sub>`/clear` first → fresh context window</sub>
32
+
33
+ ---
34
+
35
+ **Also available:**
36
+ - `cat docs/qa-reports/fix-plan-cycle-{N}.md` — review full fix plan before approving
37
+ - `cat docs/qa-reports/cycle-{N}-{date}.md` — review full test report
38
+ - `/qa:full cycle-{N}` — re-test without fixing (if you made manual changes)
39
+ - `/qa:status` — check current state
40
+
41
+ ---
42
+ If session interrupted → `/qa:resume`
43
+ ---
@@ -0,0 +1,4 @@
1
+ ───────────────────────────────────────────────────────────────
2
+ Phase {X} complete → continuing autonomously to Phase {Y}...
3
+ If session interrupted → `/qa:resume`
4
+ ───────────────────────────────────────────────────────────────
@@ -0,0 +1,32 @@
1
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2
+ QA ► STATUS
3
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4
+
5
+ **{project.name}** — Cycle {N}, Phase: {phase label}
6
+
7
+ | Cycle | Date | Pass Rate | Defects | Verdict |
8
+ |-------|------|-----------|---------|---------|
9
+ {for each cycle: summary row}
10
+
11
+ **Current state:** {human-readable phase description}
12
+ **Blocked defects:** {n} ({list if any})
13
+
14
+ ---
15
+
16
+ ## ▶ Next Action
17
+
18
+ {Based on current state.phase:}
19
+
20
+ - bootstrap_complete → `/qa:full` — start first QA cycle
21
+ - testing → `/qa:resume` — test agents may still be running
22
+ - testing_complete → `/qa:resume` — consolidate results
23
+ - reporting_complete → `/qa:resume` — evaluate exit criteria
24
+ - awaiting_fix_approval → `/qa:continue` — execute approved fixes
25
+ - fixing → `/qa:resume` — resume fix execution
26
+ - verifying → `/qa:resume` — resume verification
27
+ - certified → `/qa:full cycle-{N+1}` — start new cycle
28
+ - escalated → review `docs/qa-reports/escalation-cycle-{N}.md`
29
+
30
+ <sub>`/clear` first → fresh context window</sub>
31
+
32
+ ---