vaspera 2.10.0 → 2.10.1
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/dist/__tests__/scanners/ai-code/ai-detector.test.d.ts +2 -0
- package/dist/__tests__/scanners/ai-code/ai-detector.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/ai-code/ai-detector.test.js +188 -0
- package/dist/__tests__/scanners/ai-code/ai-detector.test.js.map +1 -0
- package/dist/__tests__/scanners/ai-code/confidence-scorer.test.d.ts +2 -0
- package/dist/__tests__/scanners/ai-code/confidence-scorer.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/ai-code/confidence-scorer.test.js +363 -0
- package/dist/__tests__/scanners/ai-code/confidence-scorer.test.js.map +1 -0
- package/dist/__tests__/scanners/ai-code/hallucination-checker.test.d.ts +2 -0
- package/dist/__tests__/scanners/ai-code/hallucination-checker.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/ai-code/hallucination-checker.test.js +226 -0
- package/dist/__tests__/scanners/ai-code/hallucination-checker.test.js.map +1 -0
- package/dist/__tests__/scanners/ai-code/index.test.d.ts +2 -0
- package/dist/__tests__/scanners/ai-code/index.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/ai-code/index.test.js +214 -0
- package/dist/__tests__/scanners/ai-code/index.test.js.map +1 -0
- package/dist/__tests__/scanners/deploy/health-checker.test.d.ts +2 -0
- package/dist/__tests__/scanners/deploy/health-checker.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/deploy/health-checker.test.js +67 -0
- package/dist/__tests__/scanners/deploy/health-checker.test.js.map +1 -0
- package/dist/__tests__/scanners/deploy/index.test.d.ts +2 -0
- package/dist/__tests__/scanners/deploy/index.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/deploy/index.test.js +84 -0
- package/dist/__tests__/scanners/deploy/index.test.js.map +1 -0
- package/dist/__tests__/scanners/deploy/provider-detector.test.d.ts +2 -0
- package/dist/__tests__/scanners/deploy/provider-detector.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/deploy/provider-detector.test.js +88 -0
- package/dist/__tests__/scanners/deploy/provider-detector.test.js.map +1 -0
- package/dist/__tests__/scanners/deploy/types.test.d.ts +2 -0
- package/dist/__tests__/scanners/deploy/types.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/deploy/types.test.js +126 -0
- package/dist/__tests__/scanners/deploy/types.test.js.map +1 -0
- package/dist/__tests__/scanners/fp-feedback.test.js +1 -1
- package/dist/__tests__/scanners/fp-feedback.test.js.map +1 -1
- package/dist/__tests__/scanners/fp-tracker.test.js +1 -1
- package/dist/__tests__/scanners/fp-tracker.test.js.map +1 -1
- package/dist/__tests__/scanners/runtime/app-launcher.test.d.ts +2 -0
- package/dist/__tests__/scanners/runtime/app-launcher.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/runtime/app-launcher.test.js +94 -0
- package/dist/__tests__/scanners/runtime/app-launcher.test.js.map +1 -0
- package/dist/__tests__/scanners/runtime/golden-path-runner.test.d.ts +2 -0
- package/dist/__tests__/scanners/runtime/golden-path-runner.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/runtime/golden-path-runner.test.js +195 -0
- package/dist/__tests__/scanners/runtime/golden-path-runner.test.js.map +1 -0
- package/dist/__tests__/scanners/runtime/index.test.d.ts +2 -0
- package/dist/__tests__/scanners/runtime/index.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/runtime/index.test.js +120 -0
- package/dist/__tests__/scanners/runtime/index.test.js.map +1 -0
- package/dist/__tests__/scanners/runtime/types.test.d.ts +2 -0
- package/dist/__tests__/scanners/runtime/types.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/runtime/types.test.js +126 -0
- package/dist/__tests__/scanners/runtime/types.test.js.map +1 -0
- package/dist/__tests__/scanners/scale/bottleneck-detector.test.d.ts +2 -0
- package/dist/__tests__/scanners/scale/bottleneck-detector.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/scale/bottleneck-detector.test.js +187 -0
- package/dist/__tests__/scanners/scale/bottleneck-detector.test.js.map +1 -0
- package/dist/__tests__/scanners/scale/index.test.d.ts +2 -0
- package/dist/__tests__/scanners/scale/index.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/scale/index.test.js +87 -0
- package/dist/__tests__/scanners/scale/index.test.js.map +1 -0
- package/dist/__tests__/scanners/scale/load-profiler.test.d.ts +2 -0
- package/dist/__tests__/scanners/scale/load-profiler.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/scale/load-profiler.test.js +122 -0
- package/dist/__tests__/scanners/scale/load-profiler.test.js.map +1 -0
- package/dist/__tests__/scanners/scale/types.test.d.ts +2 -0
- package/dist/__tests__/scanners/scale/types.test.d.ts.map +1 -0
- package/dist/__tests__/scanners/scale/types.test.js +129 -0
- package/dist/__tests__/scanners/scale/types.test.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +874 -0
- package/dist/index.js.map +1 -1
- package/dist/install-skills.d.ts +11 -0
- package/dist/install-skills.d.ts.map +1 -0
- package/dist/install-skills.js +81 -0
- package/dist/install-skills.js.map +1 -0
- package/dist/scanners/ai-code/ai-detector.d.ts +25 -0
- package/dist/scanners/ai-code/ai-detector.d.ts.map +1 -0
- package/dist/scanners/ai-code/ai-detector.js +192 -0
- package/dist/scanners/ai-code/ai-detector.js.map +1 -0
- package/dist/scanners/ai-code/confidence-scorer.d.ts +40 -0
- package/dist/scanners/ai-code/confidence-scorer.d.ts.map +1 -0
- package/dist/scanners/ai-code/confidence-scorer.js +148 -0
- package/dist/scanners/ai-code/confidence-scorer.js.map +1 -0
- package/dist/scanners/ai-code/hallucination-checker.d.ts +36 -0
- package/dist/scanners/ai-code/hallucination-checker.d.ts.map +1 -0
- package/dist/scanners/ai-code/hallucination-checker.js +298 -0
- package/dist/scanners/ai-code/hallucination-checker.js.map +1 -0
- package/dist/scanners/ai-code/index.d.ts +30 -0
- package/dist/scanners/ai-code/index.d.ts.map +1 -0
- package/dist/scanners/ai-code/index.js +224 -0
- package/dist/scanners/ai-code/index.js.map +1 -0
- package/dist/scanners/ai-code/types.d.ts +192 -0
- package/dist/scanners/ai-code/types.d.ts.map +1 -0
- package/dist/scanners/ai-code/types.js +37 -0
- package/dist/scanners/ai-code/types.js.map +1 -0
- package/dist/scanners/deploy/health-checker.d.ts +38 -0
- package/dist/scanners/deploy/health-checker.d.ts.map +1 -0
- package/dist/scanners/deploy/health-checker.js +272 -0
- package/dist/scanners/deploy/health-checker.js.map +1 -0
- package/dist/scanners/deploy/index.d.ts +44 -0
- package/dist/scanners/deploy/index.d.ts.map +1 -0
- package/dist/scanners/deploy/index.js +208 -0
- package/dist/scanners/deploy/index.js.map +1 -0
- package/dist/scanners/deploy/provider-detector.d.ts +25 -0
- package/dist/scanners/deploy/provider-detector.d.ts.map +1 -0
- package/dist/scanners/deploy/provider-detector.js +177 -0
- package/dist/scanners/deploy/provider-detector.js.map +1 -0
- package/dist/scanners/deploy/types.d.ts +406 -0
- package/dist/scanners/deploy/types.d.ts.map +1 -0
- package/dist/scanners/deploy/types.js +58 -0
- package/dist/scanners/deploy/types.js.map +1 -0
- package/dist/scanners/deploy/vercel-integration.d.ts +52 -0
- package/dist/scanners/deploy/vercel-integration.d.ts.map +1 -0
- package/dist/scanners/deploy/vercel-integration.js +280 -0
- package/dist/scanners/deploy/vercel-integration.js.map +1 -0
- package/dist/scanners/runtime/app-launcher.d.ts +33 -0
- package/dist/scanners/runtime/app-launcher.d.ts.map +1 -0
- package/dist/scanners/runtime/app-launcher.js +419 -0
- package/dist/scanners/runtime/app-launcher.js.map +1 -0
- package/dist/scanners/runtime/golden-path-runner.d.ts +48 -0
- package/dist/scanners/runtime/golden-path-runner.d.ts.map +1 -0
- package/dist/scanners/runtime/golden-path-runner.js +373 -0
- package/dist/scanners/runtime/golden-path-runner.js.map +1 -0
- package/dist/scanners/runtime/index.d.ts +41 -0
- package/dist/scanners/runtime/index.d.ts.map +1 -0
- package/dist/scanners/runtime/index.js +164 -0
- package/dist/scanners/runtime/index.js.map +1 -0
- package/dist/scanners/runtime/playwright-executor.d.ts +50 -0
- package/dist/scanners/runtime/playwright-executor.d.ts.map +1 -0
- package/dist/scanners/runtime/playwright-executor.js +387 -0
- package/dist/scanners/runtime/playwright-executor.js.map +1 -0
- package/dist/scanners/runtime/types.d.ts +215 -0
- package/dist/scanners/runtime/types.d.ts.map +1 -0
- package/dist/scanners/runtime/types.js +40 -0
- package/dist/scanners/runtime/types.js.map +1 -0
- package/dist/scanners/scale/bottleneck-detector.d.ts +17 -0
- package/dist/scanners/scale/bottleneck-detector.d.ts.map +1 -0
- package/dist/scanners/scale/bottleneck-detector.js +250 -0
- package/dist/scanners/scale/bottleneck-detector.js.map +1 -0
- package/dist/scanners/scale/capacity-estimator.d.ts +17 -0
- package/dist/scanners/scale/capacity-estimator.d.ts.map +1 -0
- package/dist/scanners/scale/capacity-estimator.js +197 -0
- package/dist/scanners/scale/capacity-estimator.js.map +1 -0
- package/dist/scanners/scale/index.d.ts +37 -0
- package/dist/scanners/scale/index.d.ts.map +1 -0
- package/dist/scanners/scale/index.js +101 -0
- package/dist/scanners/scale/index.js.map +1 -0
- package/dist/scanners/scale/load-profiler.d.ts +48 -0
- package/dist/scanners/scale/load-profiler.d.ts.map +1 -0
- package/dist/scanners/scale/load-profiler.js +377 -0
- package/dist/scanners/scale/load-profiler.js.map +1 -0
- package/dist/scanners/scale/types.d.ts +529 -0
- package/dist/scanners/scale/types.d.ts.map +1 -0
- package/dist/scanners/scale/types.js +57 -0
- package/dist/scanners/scale/types.js.map +1 -0
- package/dist/scanners/secrets.d.ts.map +1 -1
- package/dist/scanners/secrets.js +13 -2
- package/dist/scanners/secrets.js.map +1 -1
- package/package.json +4 -2
- package/skills/vaspera-add-tests/SKILL.md +102 -0
- package/skills/vaspera-ai-verify/SKILL.md +166 -0
- package/skills/vaspera-audit/SKILL.md +67 -0
- package/skills/vaspera-certify/SKILL.md +130 -0
- package/skills/vaspera-deploy/SKILL.md +152 -0
- package/skills/vaspera-fix-critical/SKILL.md +52 -0
- package/skills/vaspera-fix-high/SKILL.md +81 -0
- package/skills/vaspera-fix-medium/SKILL.md +56 -0
- package/skills/vaspera-fix-rls/SKILL.md +85 -0
- package/skills/vaspera-harden/SKILL.md +102 -0
- package/skills/vaspera-help/SKILL.md +61 -0
- package/skills/vaspera-load-test/SKILL.md +167 -0
- package/skills/vaspera-verify/SKILL.md +70 -0
- package/skills/vaspera-verify-e2e/SKILL.md +117 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix all CRITICAL severity security findings
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Remediate all CRITICAL severity findings with verification loop.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Load audit findings**
|
|
12
|
+
- Read latest from `.vaspera/audit/*.json` (most recent by timestamp)
|
|
13
|
+
- If no audit exists, run `/vaspera-audit` first
|
|
14
|
+
- Filter findings where `severity === "critical"`
|
|
15
|
+
|
|
16
|
+
2. **Categorize critical findings**
|
|
17
|
+
Critical categories:
|
|
18
|
+
- Unhandled async/await (crashes)
|
|
19
|
+
- Missing auth checks (unauthorized access)
|
|
20
|
+
- Missing RLS policies (data leakage)
|
|
21
|
+
- Hardcoded secrets (credential exposure)
|
|
22
|
+
- Raw SQL injection (CWE-89)
|
|
23
|
+
- dangerouslySetInnerHTML (XSS, CWE-79)
|
|
24
|
+
- Publicly exposed endpoints
|
|
25
|
+
- Missing CORS configuration
|
|
26
|
+
|
|
27
|
+
3. **For each finding**
|
|
28
|
+
- Show file location with context (3 lines before/after)
|
|
29
|
+
- Preview the fix (before/after diff)
|
|
30
|
+
- Apply fix:
|
|
31
|
+
- Auto-apply if pattern has `safeToAutoApply: true`
|
|
32
|
+
- Otherwise, confirm with user
|
|
33
|
+
- Run `npm run build` to verify no compile errors
|
|
34
|
+
|
|
35
|
+
4. **Verification loop**
|
|
36
|
+
- After fixing a group of related findings, re-run the targeted scanner
|
|
37
|
+
- Example: after fixing gitleaks findings, run gitleaks again
|
|
38
|
+
- Confirm finding count decreased
|
|
39
|
+
- If new findings appear (regressions), flag immediately
|
|
40
|
+
|
|
41
|
+
5. **Final report**
|
|
42
|
+
- N critical findings fixed
|
|
43
|
+
- M critical findings remaining (with reasons)
|
|
44
|
+
- Any regressions introduced
|
|
45
|
+
- Suggest `/vaspera-fix-high` as next step
|
|
46
|
+
|
|
47
|
+
## Important
|
|
48
|
+
|
|
49
|
+
- ALWAYS run `npm run build` after each fix to catch compile errors early
|
|
50
|
+
- NEVER skip the verification loop — re-scan to confirm fixes worked
|
|
51
|
+
- Stage changes but do NOT commit unless user requests
|
|
52
|
+
- If a fix requires manual intervention, explain why and provide guidance
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix HIGH severity findings in 4 rounds
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Remediate HIGH severity findings systematically in 4 rounds.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Load audit findings**
|
|
12
|
+
- Read latest from `.vaspera/audit/*.json`
|
|
13
|
+
- Filter findings where `severity === "high"`
|
|
14
|
+
- Group by category for round assignment
|
|
15
|
+
|
|
16
|
+
2. **Round A: Input Validation**
|
|
17
|
+
Target findings related to:
|
|
18
|
+
- Missing Zod schemas
|
|
19
|
+
- Missing safeParse calls
|
|
20
|
+
- Missing 400 responses for invalid input
|
|
21
|
+
- Unvalidated user input
|
|
22
|
+
|
|
23
|
+
For each:
|
|
24
|
+
- Add Zod schema if missing
|
|
25
|
+
- Replace direct access with safeParse
|
|
26
|
+
- Add proper error responses
|
|
27
|
+
- Run `npm run build` to verify
|
|
28
|
+
|
|
29
|
+
3. **Round B: TypeScript Strictness**
|
|
30
|
+
Target findings related to:
|
|
31
|
+
- `any` type annotations
|
|
32
|
+
- Missing explicit return types
|
|
33
|
+
- Unsafe type assertions (`as unknown as T`)
|
|
34
|
+
|
|
35
|
+
For each:
|
|
36
|
+
- Replace `any` with proper types or `unknown`
|
|
37
|
+
- Add explicit return types to functions
|
|
38
|
+
- Replace unsafe casts with type guards
|
|
39
|
+
- Run `npm run build` to verify
|
|
40
|
+
|
|
41
|
+
4. **Round C: UI Resilience**
|
|
42
|
+
Target findings related to:
|
|
43
|
+
- Missing loading states
|
|
44
|
+
- Missing error states
|
|
45
|
+
- Missing empty states
|
|
46
|
+
- Missing cleanup for subscriptions/listeners
|
|
47
|
+
- Missing Error Boundaries
|
|
48
|
+
|
|
49
|
+
For each:
|
|
50
|
+
- Add loading/error/empty state handling
|
|
51
|
+
- Add cleanup in useEffect return
|
|
52
|
+
- Wrap risky components in Error Boundaries
|
|
53
|
+
- Run `npm run build` to verify
|
|
54
|
+
|
|
55
|
+
5. **Round D: API Hardening**
|
|
56
|
+
Target findings related to:
|
|
57
|
+
- Error response leaking internal details
|
|
58
|
+
- Missing revalidatePath calls
|
|
59
|
+
- Inconsistent response shapes
|
|
60
|
+
|
|
61
|
+
For each:
|
|
62
|
+
- Sanitize error responses
|
|
63
|
+
- Add cache invalidation
|
|
64
|
+
- Standardize response format
|
|
65
|
+
- Run `npm run build` to verify
|
|
66
|
+
|
|
67
|
+
6. **After each round**
|
|
68
|
+
- Commit with: `fix: resolve high-severity issues (round X)`
|
|
69
|
+
- Re-scan to verify finding count decreased
|
|
70
|
+
- Report progress: N fixed in round X
|
|
71
|
+
|
|
72
|
+
7. **Final report**
|
|
73
|
+
- Total high findings fixed across all rounds
|
|
74
|
+
- Remaining high findings (if any)
|
|
75
|
+
- Suggest `/vaspera-fix-medium` as next step
|
|
76
|
+
|
|
77
|
+
## Important
|
|
78
|
+
|
|
79
|
+
- Complete each round fully before moving to next
|
|
80
|
+
- Commit after each round for clean rollback if needed
|
|
81
|
+
- If a fix is unclear, ask for guidance rather than guessing
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix MEDIUM severity findings
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Remediate MEDIUM severity findings in a single pass.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Load audit findings**
|
|
12
|
+
- Read latest from `.vaspera/audit/*.json`
|
|
13
|
+
- Filter findings where `severity === "medium"`
|
|
14
|
+
|
|
15
|
+
2. **Categorize and fix**
|
|
16
|
+
Medium categories:
|
|
17
|
+
|
|
18
|
+
**Code Quality**
|
|
19
|
+
- Missing test files → Add basic test coverage
|
|
20
|
+
- Code duplication → Extract shared utilities
|
|
21
|
+
- Components >300 lines → Split into smaller components
|
|
22
|
+
- Hardcoded strings → Extract to constants/i18n
|
|
23
|
+
|
|
24
|
+
**Type Safety**
|
|
25
|
+
- Missing return types → Add explicit return types
|
|
26
|
+
- Implicit any (not explicit) → Add proper typing
|
|
27
|
+
|
|
28
|
+
**Error Handling**
|
|
29
|
+
- No structured logging → Add logger calls
|
|
30
|
+
- Inconsistent error responses → Standardize format
|
|
31
|
+
- No error boundaries → Add React Error Boundaries
|
|
32
|
+
|
|
33
|
+
**Architecture**
|
|
34
|
+
- Manual schema management → Add migration files
|
|
35
|
+
- Scattered Supabase clients → Centralize client creation
|
|
36
|
+
|
|
37
|
+
3. **For each finding**
|
|
38
|
+
- Show context and proposed fix
|
|
39
|
+
- Apply fix with user confirmation
|
|
40
|
+
- Run `npm run build` to verify
|
|
41
|
+
|
|
42
|
+
4. **Verification**
|
|
43
|
+
- After all fixes, re-run audit
|
|
44
|
+
- Confirm medium count decreased
|
|
45
|
+
- Flag any regressions
|
|
46
|
+
|
|
47
|
+
5. **Final report**
|
|
48
|
+
- N medium findings fixed
|
|
49
|
+
- Remaining medium findings
|
|
50
|
+
- Suggest `/vaspera-add-tests` as next step
|
|
51
|
+
|
|
52
|
+
## Important
|
|
53
|
+
|
|
54
|
+
- Medium fixes are lower priority but improve maintainability
|
|
55
|
+
- Some fixes may require architectural decisions — ask if unclear
|
|
56
|
+
- Stage changes but do NOT commit unless user requests
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate and apply Supabase Row Level Security policies
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Read, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Generate RLS policies for Supabase tables to prevent unauthorized data access.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Discover tables**
|
|
12
|
+
- Scan `supabase/migrations/` for CREATE TABLE statements
|
|
13
|
+
- Scan seed files for table references
|
|
14
|
+
- Scan codebase for `supabase.from('table_name')` calls
|
|
15
|
+
- Build complete table inventory
|
|
16
|
+
|
|
17
|
+
2. **Detect existing policies**
|
|
18
|
+
- Look for `CREATE POLICY` statements in migrations
|
|
19
|
+
- Look for `ALTER TABLE ... ENABLE ROW LEVEL SECURITY`
|
|
20
|
+
- Identify tables with RLS enabled vs disabled
|
|
21
|
+
|
|
22
|
+
3. **Analyze access patterns**
|
|
23
|
+
For each `supabase.from()` call:
|
|
24
|
+
- What columns are selected?
|
|
25
|
+
- Is there a `.eq('user_id', ...)` filter?
|
|
26
|
+
- Is it in an authenticated context?
|
|
27
|
+
- Infer ownership column (usually `user_id` or `owner_id`)
|
|
28
|
+
|
|
29
|
+
4. **Generate migration**
|
|
30
|
+
For tables missing RLS:
|
|
31
|
+
```sql
|
|
32
|
+
-- Enable RLS
|
|
33
|
+
ALTER TABLE table_name ENABLE ROW LEVEL SECURITY;
|
|
34
|
+
|
|
35
|
+
-- SELECT: users can only read their own rows
|
|
36
|
+
CREATE POLICY "Users can view own rows"
|
|
37
|
+
ON table_name FOR SELECT
|
|
38
|
+
USING (auth.uid() = user_id);
|
|
39
|
+
|
|
40
|
+
-- INSERT: users can only insert with their user_id
|
|
41
|
+
CREATE POLICY "Users can insert own rows"
|
|
42
|
+
ON table_name FOR INSERT
|
|
43
|
+
WITH CHECK (auth.uid() = user_id);
|
|
44
|
+
|
|
45
|
+
-- UPDATE: users can only update their own rows
|
|
46
|
+
CREATE POLICY "Users can update own rows"
|
|
47
|
+
ON table_name FOR UPDATE
|
|
48
|
+
USING (auth.uid() = user_id);
|
|
49
|
+
|
|
50
|
+
-- DELETE: users can only delete their own rows
|
|
51
|
+
CREATE POLICY "Users can delete own rows"
|
|
52
|
+
ON table_name FOR DELETE
|
|
53
|
+
USING (auth.uid() = user_id);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
5. **Write migration file**
|
|
57
|
+
- Create `supabase/migrations/{timestamp}_add_rls_policies.sql`
|
|
58
|
+
- Include all generated policies
|
|
59
|
+
|
|
60
|
+
6. **Generate RLS-REPORT.md**
|
|
61
|
+
```markdown
|
|
62
|
+
# RLS Policy Report
|
|
63
|
+
|
|
64
|
+
## Tables with RLS
|
|
65
|
+
| Table | SELECT | INSERT | UPDATE | DELETE |
|
|
66
|
+
|-------|--------|--------|--------|--------|
|
|
67
|
+
| users | ✅ | ✅ | ✅ | ✅ |
|
|
68
|
+
|
|
69
|
+
## Tables MISSING RLS (CRITICAL)
|
|
70
|
+
- orders (no policies, added in migration)
|
|
71
|
+
|
|
72
|
+
## Service Role Usage (review required)
|
|
73
|
+
- src/api/admin.ts:42 — uses service role key
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
7. **Optionally apply**
|
|
77
|
+
- If user confirms: `supabase db push`
|
|
78
|
+
- Otherwise: leave migration file for manual review
|
|
79
|
+
|
|
80
|
+
## Important
|
|
81
|
+
|
|
82
|
+
- RLS is the MOST IMPORTANT security control for multi-tenant Supabase apps
|
|
83
|
+
- Missing RLS = any authenticated user can read ALL data
|
|
84
|
+
- Service role key bypasses RLS — flag all usages for review
|
|
85
|
+
- Always test policies locally before pushing to production
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run complete 6-phase hardening pipeline
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Execute the full hardening pipeline with verification at each phase.
|
|
8
|
+
|
|
9
|
+
## Pipeline Overview
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Phase 1: Audit → Baseline assessment
|
|
13
|
+
Phase 2: Fix Critical → Resolve all CRITICAL findings
|
|
14
|
+
Phase 3: Fix High → Resolve HIGH findings (4 rounds)
|
|
15
|
+
Phase 4: Fix Medium → Resolve MEDIUM findings
|
|
16
|
+
Phase 5: Add Tests → Generate security tests
|
|
17
|
+
Phase 6: Verify → Before/after comparison
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Execution
|
|
21
|
+
|
|
22
|
+
### Phase 1: Audit
|
|
23
|
+
Run `/vaspera-audit` to establish baseline.
|
|
24
|
+
- Record initial Production Readiness Score
|
|
25
|
+
- Save finding counts by severity
|
|
26
|
+
|
|
27
|
+
### Phase 2: Fix Critical
|
|
28
|
+
Run `/vaspera-fix-critical`
|
|
29
|
+
- Must resolve ALL critical findings before proceeding
|
|
30
|
+
- Commit: `fix: resolve critical security issues`
|
|
31
|
+
- **Gate**: If any critical remains, STOP and report
|
|
32
|
+
|
|
33
|
+
### Phase 3: Fix High
|
|
34
|
+
Run `/vaspera-fix-high`
|
|
35
|
+
- 4 rounds: validation → types → UI → API
|
|
36
|
+
- Commit after each round: `fix: resolve high-severity issues (round X)`
|
|
37
|
+
- **Verification**: Re-scan after each round
|
|
38
|
+
|
|
39
|
+
### Phase 4: Fix Medium
|
|
40
|
+
Run `/vaspera-fix-medium`
|
|
41
|
+
- Single pass through medium findings
|
|
42
|
+
- Commit: `fix: resolve medium-severity issues`
|
|
43
|
+
|
|
44
|
+
### Phase 5: Add Tests
|
|
45
|
+
Run `/vaspera-add-tests`
|
|
46
|
+
- Priority: API routes → data layer → UI → utilities
|
|
47
|
+
- Commit: `test: add security tests for critical paths`
|
|
48
|
+
- **Gate**: `npm test` must pass
|
|
49
|
+
|
|
50
|
+
### Phase 6: Verify
|
|
51
|
+
Run `/vaspera-verify`
|
|
52
|
+
- Generate HARDENING-REPORT.md
|
|
53
|
+
- Compare before/after scores
|
|
54
|
+
- Flag any regressions
|
|
55
|
+
|
|
56
|
+
## Pre-commit Gate
|
|
57
|
+
|
|
58
|
+
Before each commit, verify:
|
|
59
|
+
- [ ] `npm run build` passes (TypeScript)
|
|
60
|
+
- [ ] `npm test` passes (all tests)
|
|
61
|
+
- [ ] No new console.logs introduced
|
|
62
|
+
- [ ] No commented code added
|
|
63
|
+
- [ ] No circular imports
|
|
64
|
+
|
|
65
|
+
## Failure Handling
|
|
66
|
+
|
|
67
|
+
**Build fails**: Pause, report error, suggest fix
|
|
68
|
+
**Tests fail**: Roll back phase changes, report
|
|
69
|
+
**Regressions detected**: Flag prominently, pause for review
|
|
70
|
+
|
|
71
|
+
## Final Report
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
# Hardening Complete
|
|
75
|
+
|
|
76
|
+
## Score Improvement
|
|
77
|
+
Before: XX/100 (LEVEL)
|
|
78
|
+
After: YY/100 (LEVEL)
|
|
79
|
+
Delta: +ZZ points
|
|
80
|
+
|
|
81
|
+
## Findings Resolved
|
|
82
|
+
- Critical: X → 0
|
|
83
|
+
- High: Y → N
|
|
84
|
+
- Medium: Z → M
|
|
85
|
+
|
|
86
|
+
## Commits Made
|
|
87
|
+
1. fix: resolve critical security issues
|
|
88
|
+
2. fix: resolve high-severity issues (round A)
|
|
89
|
+
...
|
|
90
|
+
|
|
91
|
+
## Next Steps
|
|
92
|
+
- Review and merge PR
|
|
93
|
+
- Deploy to staging
|
|
94
|
+
- Run production certification
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Important
|
|
98
|
+
|
|
99
|
+
- This is a LONG-RUNNING operation — may take 30+ minutes
|
|
100
|
+
- Each phase commits independently for clean rollback
|
|
101
|
+
- The pipeline can be resumed from any phase if interrupted
|
|
102
|
+
- Do NOT push to remote unless user explicitly requests
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: List all available Vaspera Hardening skills
|
|
3
|
+
argument-hint: ""
|
|
4
|
+
allowed-tools: Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Display the Vaspera Hardening skill menu.
|
|
8
|
+
|
|
9
|
+
## Output
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Vaspera Hardening Skills
|
|
13
|
+
========================
|
|
14
|
+
|
|
15
|
+
AUDIT & VERIFY
|
|
16
|
+
/vaspera-audit Run security audit, write findings to .vaspera/audit/
|
|
17
|
+
/vaspera-verify Compare before/after audit state, generate report
|
|
18
|
+
/vaspera-verify-e2e Runtime verification (M7) - test app actually works
|
|
19
|
+
|
|
20
|
+
FIX BY SEVERITY
|
|
21
|
+
/vaspera-fix-critical Fix all CRITICAL severity findings
|
|
22
|
+
/vaspera-fix-high Fix HIGH severity findings (4 rounds)
|
|
23
|
+
/vaspera-fix-medium Fix MEDIUM severity findings
|
|
24
|
+
|
|
25
|
+
SPECIALIZED
|
|
26
|
+
/vaspera-fix-rls Generate Supabase RLS policies
|
|
27
|
+
/vaspera-add-tests Generate security tests (priority order)
|
|
28
|
+
|
|
29
|
+
ORCHESTRATION
|
|
30
|
+
/vaspera-harden Full 6-phase hardening pipeline
|
|
31
|
+
(audit → fix-critical → fix-high → fix-medium → add-tests → verify)
|
|
32
|
+
|
|
33
|
+
RUNTIME & SCALE (M7-M8)
|
|
34
|
+
/vaspera-verify-e2e Launch app, run golden paths, calculate runtime score
|
|
35
|
+
/vaspera-load-test Run k6 load tests, detect bottlenecks, estimate capacity
|
|
36
|
+
/vaspera-certify Full production readiness certification (all dimensions)
|
|
37
|
+
|
|
38
|
+
DEPLOYMENT (M9)
|
|
39
|
+
/vaspera-deploy Health checks, smoke tests, Vercel integration
|
|
40
|
+
|
|
41
|
+
AI CODE VERIFICATION (M10)
|
|
42
|
+
/vaspera-ai-verify Detect AI patterns, hallucinations, confidence scoring
|
|
43
|
+
|
|
44
|
+
DISCOVERY
|
|
45
|
+
/vaspera-help This menu
|
|
46
|
+
|
|
47
|
+
MCP TOOLS (stateful operations)
|
|
48
|
+
hardening_dashboard Portfolio view across all projects
|
|
49
|
+
certification_* Stateful certification workflow
|
|
50
|
+
consensus_* Multi-agent consensus calculation
|
|
51
|
+
runtime_* Runtime verification (7 tools)
|
|
52
|
+
scale_* Scale assessment (5 tools)
|
|
53
|
+
deploy_* Deployment verification (7 tools)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage Tips
|
|
57
|
+
|
|
58
|
+
- Start with `/vaspera-audit` to get a baseline
|
|
59
|
+
- Fix by severity: critical → high → medium
|
|
60
|
+
- Run `/vaspera-verify` after fixes to confirm improvement
|
|
61
|
+
- Use `/vaspera-harden` for the full automated pipeline
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run scale assessment and load testing (M8)
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Bash, Read, Write, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Run scale assessment including load testing, bottleneck detection, and capacity estimation.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
Install a load testing tool (k6 recommended):
|
|
12
|
+
```bash
|
|
13
|
+
# macOS
|
|
14
|
+
brew install k6
|
|
15
|
+
|
|
16
|
+
# Linux
|
|
17
|
+
sudo apt install k6
|
|
18
|
+
|
|
19
|
+
# Windows
|
|
20
|
+
choco install k6
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
1. **Validate project path**
|
|
26
|
+
- Default to `.` if no argument provided
|
|
27
|
+
- Confirm the project exists
|
|
28
|
+
|
|
29
|
+
2. **Check load testing tools**
|
|
30
|
+
- Use `scale_tools_check` MCP tool
|
|
31
|
+
- Verify k6 or Artillery is installed
|
|
32
|
+
|
|
33
|
+
3. **Discover load profiles**
|
|
34
|
+
- Look for `.vaspera/load/*.yaml`
|
|
35
|
+
- If no profiles exist, offer to generate sample
|
|
36
|
+
|
|
37
|
+
4. **Start the application**
|
|
38
|
+
- Use `runtime_launch` to start the dev server
|
|
39
|
+
- Wait for health check
|
|
40
|
+
|
|
41
|
+
5. **Run load tests**
|
|
42
|
+
- Execute each profile scenario
|
|
43
|
+
- Collect latency, throughput, error metrics
|
|
44
|
+
|
|
45
|
+
6. **Detect bottlenecks**
|
|
46
|
+
- Scan code for N+1 queries, memory leaks, blocking ops
|
|
47
|
+
- Analyze load test results for slow endpoints
|
|
48
|
+
|
|
49
|
+
7. **Estimate capacity**
|
|
50
|
+
- Calculate max concurrent users
|
|
51
|
+
- Estimate breakpoint (where system fails)
|
|
52
|
+
- Project infrastructure costs
|
|
53
|
+
|
|
54
|
+
8. **Stop the application**
|
|
55
|
+
- Clean shutdown of dev server
|
|
56
|
+
|
|
57
|
+
9. **Present results**
|
|
58
|
+
```
|
|
59
|
+
Scale Assessment Results
|
|
60
|
+
========================
|
|
61
|
+
Load Testing Tool: k6
|
|
62
|
+
|
|
63
|
+
Profile: production
|
|
64
|
+
┌─────────────────┬──────────┬──────────┬──────────┐
|
|
65
|
+
│ Scenario │ VUs │ RPS │ p95 (ms) │
|
|
66
|
+
├─────────────────┼──────────┼──────────┼──────────┤
|
|
67
|
+
│ Ramp Up │ 1→50 │ 245 │ 89 │
|
|
68
|
+
│ Steady State │ 50 │ 312 │ 124 │
|
|
69
|
+
│ Spike │ 50→200 │ 156 │ 456 │
|
|
70
|
+
└─────────────────┴──────────┴──────────┴──────────┘
|
|
71
|
+
|
|
72
|
+
Bottlenecks Found: 3
|
|
73
|
+
- [HIGH] N+1 query in src/api/products.ts
|
|
74
|
+
- [MEDIUM] Blocking readFileSync in lib/config.ts
|
|
75
|
+
- [MEDIUM] No connection pooling detected
|
|
76
|
+
|
|
77
|
+
Capacity Estimate:
|
|
78
|
+
- Max Concurrent Users: ~250
|
|
79
|
+
- Max Requests/sec: ~400
|
|
80
|
+
- Breakpoint: ~300 VUs (60% confidence)
|
|
81
|
+
|
|
82
|
+
Projected Cost: $140/month (2x m5.large)
|
|
83
|
+
|
|
84
|
+
Scale Score: 72/100
|
|
85
|
+
|
|
86
|
+
Certification Level: 🟡 APPROVED
|
|
87
|
+
→ Ship with monitoring
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
10. **Write assessment report**
|
|
91
|
+
- Create `.vaspera/scale/` directory
|
|
92
|
+
- Write to `.vaspera/scale/{ISO-timestamp}.json`
|
|
93
|
+
|
|
94
|
+
## Load Profile Format
|
|
95
|
+
|
|
96
|
+
Profiles are defined in `.vaspera/load/*.yaml`:
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
name: "production"
|
|
100
|
+
description: "Production-like load test"
|
|
101
|
+
tool: k6
|
|
102
|
+
|
|
103
|
+
endpoints:
|
|
104
|
+
- path: "/"
|
|
105
|
+
method: GET
|
|
106
|
+
weight: 50
|
|
107
|
+
- path: "/api/products"
|
|
108
|
+
method: GET
|
|
109
|
+
weight: 30
|
|
110
|
+
- path: "/api/checkout"
|
|
111
|
+
method: POST
|
|
112
|
+
weight: 20
|
|
113
|
+
body:
|
|
114
|
+
items: [{ id: 1, qty: 1 }]
|
|
115
|
+
|
|
116
|
+
thresholds:
|
|
117
|
+
p95: 500 # 95th percentile < 500ms
|
|
118
|
+
p99: 1000 # 99th percentile < 1s
|
|
119
|
+
errorRate: 0.01 # < 1% errors
|
|
120
|
+
|
|
121
|
+
scenarios:
|
|
122
|
+
- name: "Ramp Up"
|
|
123
|
+
type: ramp
|
|
124
|
+
duration: "2m"
|
|
125
|
+
vus:
|
|
126
|
+
start: 1
|
|
127
|
+
end: 50
|
|
128
|
+
|
|
129
|
+
- name: "Steady State"
|
|
130
|
+
type: ramp
|
|
131
|
+
duration: "5m"
|
|
132
|
+
vus:
|
|
133
|
+
start: 50
|
|
134
|
+
end: 50
|
|
135
|
+
|
|
136
|
+
- name: "Spike"
|
|
137
|
+
type: spike
|
|
138
|
+
duration: "30s"
|
|
139
|
+
vus:
|
|
140
|
+
start: 50
|
|
141
|
+
end: 200
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Bottleneck Types
|
|
145
|
+
|
|
146
|
+
| Type | Examples | Severity |
|
|
147
|
+
|------|----------|----------|
|
|
148
|
+
| database | N+1 queries, missing indexes | High |
|
|
149
|
+
| memory | Leaks, unbounded caches | Medium |
|
|
150
|
+
| cpu | Blocking operations, sync crypto | Medium |
|
|
151
|
+
| endpoint | Slow handlers, no caching | High |
|
|
152
|
+
| network | No connection reuse | Low |
|
|
153
|
+
|
|
154
|
+
## MCP Tools Used
|
|
155
|
+
|
|
156
|
+
- `scale_tools_check` — Verify load testing tools
|
|
157
|
+
- `scale_profiles_list` — Discover profiles
|
|
158
|
+
- `scale_profile_generate` — Create sample profile
|
|
159
|
+
- `scale_assess` — Full scale assessment
|
|
160
|
+
- `scale_bottlenecks` — Quick bottleneck scan
|
|
161
|
+
|
|
162
|
+
## Important
|
|
163
|
+
|
|
164
|
+
- Requires k6 or Artillery installed
|
|
165
|
+
- Load tests hit the actual app — use a test environment
|
|
166
|
+
- Results vary by hardware — run on similar specs to production
|
|
167
|
+
- Consider running during off-peak hours for accurate results
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Compare before/after audit state to verify fixes worked
|
|
3
|
+
argument-hint: "[project-path: defaults to .]"
|
|
4
|
+
allowed-tools: Read, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Verify that fixes improved the security posture by comparing audit snapshots.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Preserve baseline**
|
|
12
|
+
- If `AUDIT.md` exists, rename to `AUDIT-BEFORE.md`
|
|
13
|
+
- If `.vaspera/audit/*.json` exists, note the latest as "before" snapshot
|
|
14
|
+
|
|
15
|
+
2. **Run fresh audit**
|
|
16
|
+
- Execute `/vaspera-audit` to generate new findings
|
|
17
|
+
- This creates a new `.vaspera/audit/{timestamp}.json`
|
|
18
|
+
|
|
19
|
+
3. **Compare before vs after**
|
|
20
|
+
Calculate deltas:
|
|
21
|
+
- Critical: before → after (delta)
|
|
22
|
+
- High: before → after (delta)
|
|
23
|
+
- Medium: before → after (delta)
|
|
24
|
+
- Low: before → after (delta)
|
|
25
|
+
- Total: before → after (delta)
|
|
26
|
+
|
|
27
|
+
4. **Calculate Production Readiness Score**
|
|
28
|
+
Score = 100 - (critical×10 + high×5 + medium×2 + low×0.5)
|
|
29
|
+
|
|
30
|
+
Certification levels:
|
|
31
|
+
- 90-100: CERTIFIED (green)
|
|
32
|
+
- 70-89: APPROVED (yellow)
|
|
33
|
+
- 40-69: REVIEW_REQUIRED (orange)
|
|
34
|
+
- 0-39: BLOCKED (red)
|
|
35
|
+
|
|
36
|
+
5. **Detect regressions**
|
|
37
|
+
- New findings that didn't exist in "before" snapshot
|
|
38
|
+
- Flag these prominently — fixes may have introduced new issues
|
|
39
|
+
|
|
40
|
+
6. **Generate HARDENING-REPORT.md**
|
|
41
|
+
```markdown
|
|
42
|
+
# Hardening Report
|
|
43
|
+
|
|
44
|
+
## Summary
|
|
45
|
+
| Severity | Before | After | Delta |
|
|
46
|
+
|----------|--------|-------|-------|
|
|
47
|
+
| Critical | X | Y | -N |
|
|
48
|
+
...
|
|
49
|
+
|
|
50
|
+
## Production Readiness Score
|
|
51
|
+
Before: XX/100 (LEVEL)
|
|
52
|
+
After: YY/100 (LEVEL)
|
|
53
|
+
|
|
54
|
+
## Remaining Issues
|
|
55
|
+
- [file:line] — description
|
|
56
|
+
|
|
57
|
+
## Regressions (NEW)
|
|
58
|
+
- [file:line] — description
|
|
59
|
+
|
|
60
|
+
## Deployment Checklist
|
|
61
|
+
- [ ] All critical fixed
|
|
62
|
+
- [ ] Tests passing
|
|
63
|
+
- [ ] Build succeeds
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Important
|
|
67
|
+
|
|
68
|
+
- This skill is READ-ONLY for code — it generates reports, doesn't fix
|
|
69
|
+
- Always flag regressions prominently
|
|
70
|
+
- The score is informational — use judgment on whether to deploy
|