|
4 | 4 |
|
5 | 5 | **Problem:** Developers ship code quickly but often miss basic security checks (secrets, stale deps, known CVEs).
|
6 | 6 | **Solution:** A zero‑config CLI that scans a repo for secrets, outdated packages, and CVEs, then generates an AI‑powered risk report.
|
7 |
| -**MVP Goal:** Enable any developer to run `vibesafe scan` and get a readable security summary—including file paths and line numbers—in under 60 s. |
| 7 | +**MVP Goal:** Enable any developer to run `vibesafe scan` and get a readable security summary—including file paths and line numbers—in under 60 s. |
8 | 8 |
|
9 | 9 | ## 2. Personas & Use Cases
|
10 | 10 |
|
|
26 | 26 | - Automatic patching (`--fix`)
|
27 | 27 | - Remote‑repo scanning
|
28 | 28 | - Real‑time IDE plugins
|
29 |
| -- Telemetry collection (opt‑in only) |
| 29 | +- Telemetry collection (opt‑in only) |
30 | 30 | - TODO: Proactively check `.gitignore` for `.env` exclusion patterns
|
31 | 31 |
|
32 | 32 | ## 4. Success Metrics
|
33 | 33 |
|
34 |
| -1. **Performance:** Full scan < 60 s on a 100 MB repo |
35 |
| -2. **Coverage:** Detects ≥ 5 unique issues in standard test repos |
36 |
| -3. **Adoption:** ≥ 10 installs in first week (npm/pip downloads) |
| 34 | +1. **Performance:** Full scan < 60 s on a 100 MB repo |
| 35 | +2. **Coverage:** Detects ≥ 5 unique issues in standard test repos |
| 36 | +3. **Adoption:** ≥ 10 installs in first week (npm/pip downloads) |
37 | 37 | 4. **Reliability:** CI exit code behavior consistent (HIGH → non-zero)
|
38 | 38 |
|
39 | 39 | ## 5. Phases & Atomic Tasks
|
40 | 40 |
|
41 |
| -### Phase 1: Setup & CI Integration |
| 41 | +### Phase 1: Setup & CI Integration |
42 | 42 | 1. **Repo scaffold**
|
43 | 43 | - [x] `mkdir vibesafe && cd vibesafe`
|
44 | 44 | - [x] Initialize Git + add `.gitignore`, `LICENSE`, `README.md`
|
45 |
| - - [x] Choose language: TypeScript (commander.js) ~~_or_ Python (argparse)~~ |
| 45 | + - [x] Choose language: TypeScript (commander.js) |
46 | 46 | - [x] Add basic `vibesafe scan` command stub
|
47 | 47 | 2. **CI hook**
|
48 | 48 | - [x] Write a GitHub Actions workflow that runs `vibesafe scan --high-only`
|
49 | 49 | - [x] Ensure exit code propagates
|
50 | 50 |
|
51 |
| -### Phase 2: Secrets Scanner |
| 51 | +### Phase 2: Secrets Scanner |
52 | 52 | 1. **Regex & entropy engine**
|
53 |
| - - [x] Define regex patterns for `.env`, AWS, JWT, SSH keys |
54 |
| - - [x] Integrate an entropy checker (e.g., Shannon entropy > threshold) |
| 53 | + - [x] Define regex patterns for `.env`, AWS, JWT, SSH keys |
| 54 | + - [x] Integrate an entropy checker (e.g., Shannon entropy > threshold) |
55 | 55 | 2. **File traversal**
|
56 |
| - - [x] Walk directory tree, skip default excludes (`node_modules`, `dist`, lockfiles, tsconfig.json, README.md) |
57 |
| - - [x] Honor `.vibesafeignore` entries |
| 56 | + - [x] Walk directory tree, skip default excludes (`node_modules`, `dist`, lockfiles, tsconfig.json, README.md) |
| 57 | + - [x] Honor `.vibesafeignore` entries |
58 | 58 | 3. **Scoring & output**
|
59 |
| - - [x] Assign Low/Med/High severity based on pattern + entropy |
| 59 | + - [x] Assign Low/Med/High severity based on pattern + entropy |
60 | 60 | - [x] Emit JSON record per finding including `file`, `line`, `pattern`, and `severity`
|
61 |
| - - [x] Added 'Info' severity for secrets in `.env` files (reduces noise) |
| 61 | + - [x] Added 'Info' severity for secrets in `.env` files (reduces noise) |
62 | 62 |
|
63 |
| -### Phase 3: Dependency & CVE Scanner |
| 63 | +### Phase 3: Dependency & CVE Scanner |
64 | 64 | 1. **Detect package manager**
|
65 | 65 | - [x] Inspect files: `package.json`, `yarn.lock`, `requirements.txt`
|
66 | 66 | 2. **Parse deps**
|
67 |
| - - [x] Extract name + version pairs |
| 67 | + - [x] Extract name + version pairs |
68 | 68 | 3. **CVE lookup**
|
69 | 69 | - [x] Call OSV.dev or NVD API with each dep
|
70 | 70 | - [x] Capture CVE IDs, severity, published date
|
71 | 71 | 4. **Threshold filtering**
|
72 |
| - - [x] Mark HIGH if any dep ≥ 7.0 severity |
| 72 | + - [x] Mark HIGH if any dep ≥ 7.0 severity |
73 | 73 |
|
74 |
| -### Phase 4: AI Risk Report |
| 74 | +### Phase 4: AI Risk Report |
75 | 75 | 1. **Markdown skeleton**
|
76 |
| - - [x] Build template: |
77 |
| - ```md |
78 |
| - # VibeSafe Report |
79 |
| - |
80 |
| - ## Summary |
81 |
| - - Total Issues: 5 (2 High, 2 Medium, 1 Low) |
82 |
| - |
83 |
| - ## Details |
84 |
| - | File | Location | Issue | Severity | CVE/Pattern | |
85 |
| - | ------------------ | ---------- | ---------------- | -------- | ------------- | |
86 |
| - | `.env` | line 10 | AWS Key exposed | High | — | |
87 |
| - | `config/app.js` | line 45 | JWT secret | Medium | — | |
88 |
| - | `package.json` | line 23 | lodash 4.17 | Medium | CVE-2024-123 | |
89 |
| - | `requirements.txt` | line 12 | Django 2.2 | High | CVE-2023-456 | |
90 |
| - | `src/utils.ts` | line 80 | Hardcoded token | Low | — | |
91 |
| - |
92 |
| - ## Fix Suggestions |
93 |
| - 1. Remove AWS keys from code; use environment variables and a secrets vault. |
94 |
| - 2. Rotate JWT secret and move to env vars. |
95 |
| - 3. Upgrade `lodash` to ≥ 4.17.21. |
96 |
| - 4. Update Django to ≥ 3.2. |
97 |
| - 5. Replace hardcoded tokens with secure storage. |
98 |
| - ``` |
| 76 | + - [x] Build template |
99 | 77 | 2. **LLM integration**
|
100 |
| - - [x] Send JSON findings + skeleton to GPT‑4o-mini |
| 78 | + - [x] Send JSON findings + skeleton to GPT‑4o‑mini |
101 | 79 | - [x] Parse human‑readable summary & per‑issue suggestions
|
102 | 80 | - [x] Merge into final MD
|
103 | 81 |
|
104 |
| -### Phase 5: CLI UX & Packaging |
| 82 | +### Phase 5: CLI UX & Packaging |
105 | 83 | 1. **Terminal polish**
|
106 |
| - - [x] Colorize severities (e.g., red for High) |
107 |
| - - [x] Add progress spinner during scans |
| 84 | + - [x] Colorize severities (e.g., red for High) |
| 85 | + - [x] Add progress spinner during scans |
108 | 86 | 2. **Flags & outputs**
|
109 |
| - - [x] `--output <file.json>` |
110 |
| - - [x] `--report <file.md>` |
111 |
| - - [x] `--high-only` filter |
| 87 | + - [x] `--output <file.json>` |
| 88 | + - [x] `--report <file.md>` |
| 89 | + - [x] `--high-only` filter |
112 | 90 | 3. **Distribution**
|
113 |
| - - [x] Set up npm `bin` entry_point |
114 |
| - - [x] Test on macOS |
115 |
| - |
116 |
| -## 6. Timeline & Ownership |
117 |
| - |
118 |
| -| Week | Focus | Owner | |
119 |
| -| ------ | ------------------------------ | ------------ | |
120 |
| -| Week 1 | Phase 1 scaffold + CI | @you | |
121 |
| -| Week 2 | Phase 2 secrets scanner | @security | |
122 |
| -| Week 3 | Phase 3 dep & CVE scanner | @sec‑lead | |
123 |
| -| Week 4 | Phase 4 AI report & polish | @AI‑engineer | |
124 |
| -| Week 5 | Phase 5 packaging & QA | @release | |
125 |
| - |
126 |
| -## 7. Risks & Mitigations |
| 91 | + - [x] Set up npm `bin` entry_point |
| 92 | + - [x] Test on macOS |
| 93 | + |
| 94 | +### Phase 6: Additional Common Checks |
| 95 | +1. **Insecure Default Configurations** |
| 96 | + - [ ] Scan config files (JSON/YAML) for flags like `DEBUG=true`, `devMode`, or permissive CORS (`*` origins) |
| 97 | +2. **Unvalidated File Uploads** |
| 98 | + - [ ] Detect code handling file uploads (e.g., multer, busboy) without size/type restrictions |
| 99 | +3. **Exposed Debug/Admin Endpoints** |
| 100 | + - [ ] Search for routes named `/debug`, `/admin`, `/console` |
| 101 | + - [ ] Flag those without authentication or middleware checks |
| 102 | +4. **Lack of Rate‑Limiting** |
| 103 | + - [ ] Identify HTTP handlers or clients missing rate‑limiter middleware (e.g., express-rate-limit) |
| 104 | + - [ ] Flag missing throttle/retry settings in HTTP client code |
| 105 | +5. **Insufficient Logging & Error Sanitization** |
| 106 | + - [ ] Find logging of full error objects or stack traces (e.g., `console.error(err)`) |
| 107 | + - [ ] Detect logging of PII or sensitive data in plain text |
| 108 | + |
| 109 | +## 6. Risks & Mitigations |
127 | 110 |
|
128 | 111 | - **API rate limits (OSV/NVD):** cache results locally; implement exponential back‑off
|
129 | 112 | - **False positives (secrets):** tune regex & entropy thresholds; allow exclusions
|
130 | 113 | - **LLM costs:** only call on `--report` mode; support a dry‑run without AI
|
131 | 114 |
|
132 |
| -## 8. In Cursor |
| 115 | +## 7. In Cursor |
133 | 116 |
|
134 | 117 | - **Check progress:**
|
135 |
| - > “What is the current status of Phase 2: Secrets Scanner?” |
| 118 | + > “What is the current status of Phase 6: Additional Common Checks?” |
136 | 119 | - **Mark tasks done:**
|
137 |
| - > “Mark Phase 3.3 (CVE lookup) as complete.” |
| 120 | + > “Mark Insecure Default Configurations check as complete.” |
138 | 121 |
|
139 | 122 | ---
|
140 | 123 |
|
141 | 124 | **Next Steps:**
|
142 |
| -1. Review personas & success metrics. |
143 |
| -2. Assign owners & adjust timeline as needed. |
144 |
| -3. Kick off Week 1! |
| 125 | +1. Tackle Phase 6 atomic tasks in order. |
| 126 | +2. Validate each check against representative repos. |
| 127 | +3. Prepare to expand into “Most Dangerous” vulnerability scans once Phase 6 is done. |
0 commit comments