codeprobe-scanner 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.
- package/.claude/settings.local.json +19 -0
- package/.dockerignore +17 -0
- package/.env.development +8 -0
- package/.env.example +20 -0
- package/.env.setup +214 -0
- package/.github/workflows/codeprobe-scan.yml +137 -0
- package/.github/workflows/codeprobe.yml +84 -0
- package/.github/workflows/scan-schedule.yml +28 -0
- package/ANALYSIS_SUMMARY.md +365 -0
- package/API_INTEGRATIONS.md +469 -0
- package/BUILD_PLAYBOOK.md +349 -0
- package/CLAUDE.md +106 -0
- package/DEPLOY.md +452 -0
- package/DEPLOYMENT_STATUS.md +240 -0
- package/DEPLOY_CHECKLIST.md +316 -0
- package/Dockerfile +24 -0
- package/EXECUTION_PLAN.html +1086 -0
- package/IMPLEMENTATION_COMPLETE.md +288 -0
- package/IMPLEMENTATION_SUMMARY.md +443 -0
- package/INTERACTIVE_FIX_FLOW.md +308 -0
- package/MIGRATION_COMPLETE.md +327 -0
- package/ORCHESTRATOR_SYNTHESIS.json +80 -0
- package/PENDING_WORK.md +308 -0
- package/PREFLIGHT_PLAN.md +182 -0
- package/QUICKSTART.md +305 -0
- package/README.md +15 -0
- package/STAGE_1_SETUP_ENGINE.md +245 -0
- package/STAGE_2_ARCHITECTURE.md +714 -0
- package/STAGE_2_CLI_VERIFICATION.md +269 -0
- package/STAGE_2_COMPLETE.md +332 -0
- package/STAGE_2_IMPLEMENTATION_PLAN.md +679 -0
- package/STAGE_3_COMPLETE.md +246 -0
- package/STAGE_3_DASHBOARD_POLISH.md +371 -0
- package/STAGE_3_SETUP.md +155 -0
- package/VIDEODB_INTEGRATION.md +237 -0
- package/archived/DASHBOARD_UI_WALKTHROUGH.md +392 -0
- package/archived/FRONTEND_SETUP.md +236 -0
- package/archived/auth.ts +40 -0
- package/archived/dashboard/components/BusinessImpactCard.tsx +48 -0
- package/archived/dashboard/components/CVETable.tsx +104 -0
- package/archived/dashboard/components/ErrorBoundary.tsx +48 -0
- package/archived/dashboard/components/PatchDiffViewer.tsx +43 -0
- package/archived/dashboard/components/RiskGauge.tsx +64 -0
- package/archived/dashboard/frontend.tsx +104 -0
- package/archived/dashboard/hooks/useAuth.ts +32 -0
- package/archived/dashboard/hooks/useScan.ts +65 -0
- package/archived/dashboard/index.html +15 -0
- package/archived/dashboard/pages/LoginPage.tsx +28 -0
- package/archived/dashboard/pages/ScanDetailPage.tsx +143 -0
- package/archived/dashboard/pages/ScansListPage.tsx +160 -0
- package/bin/install-and-run.sh +91 -0
- package/bun.lock +603 -0
- package/codeprobe-prd.md +674 -0
- package/cve-cache.json +25 -0
- package/demo-vulnerable-app/.github/workflows/codeprobe.yml +32 -0
- package/demo-vulnerable-app/README.md +70 -0
- package/demo-vulnerable-app/package-lock.json +27 -0
- package/demo-vulnerable-app/package.json +15 -0
- package/demo-vulnerable-app/server.js +34 -0
- package/demo.sh +45 -0
- package/index.ts +19 -0
- package/package.json +28 -0
- package/patches.json +12 -0
- package/serve-dashboard.ts +23 -0
- package/src/api/server-cli.ts +270 -0
- package/src/api/server.ts +293 -0
- package/src/bot/server.ts +113 -0
- package/src/cli/commands/report.ts +92 -0
- package/src/cli/commands/scan-with-fix.ts +123 -0
- package/src/cli/commands/scan.ts +137 -0
- package/src/cli/config.ts +188 -0
- package/src/cli/errors.ts +120 -0
- package/src/cli/index.ts +137 -0
- package/src/cli/progress.ts +119 -0
- package/src/cli-server.ts +523 -0
- package/src/engine/index.ts +90 -0
- package/src/engine/matcher.ts +115 -0
- package/src/engine/parser.ts +91 -0
- package/src/engine/patcher.ts +280 -0
- package/src/engine/report.ts +137 -0
- package/src/engine/sandbox.ts +222 -0
- package/src/engine/scraper.ts +122 -0
- package/src/integrations/videodb.ts +153 -0
- package/src/mcp/server.ts +149 -0
- package/src/scraper-cron.ts +103 -0
- package/src/shared/constants.ts +88 -0
- package/src/shared/types.ts +123 -0
- package/src/shared/utils.ts +80 -0
- package/src/test/cli.test.ts +211 -0
- package/src/test/dashboard.test.ts +38 -0
- package/src/test/demo-scan.json +32 -0
- package/src/test/engine.test.ts +157 -0
- package/tailwind.config.js +11 -0
- package/tsconfig.json +30 -0
- package/verify-dashboard.ts +87 -0
- package/verify-env.sh +98 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(git init *)",
|
|
5
|
+
"Bash(bun init *)",
|
|
6
|
+
"Bash(git add *)",
|
|
7
|
+
"Bash(git commit -m 'docs: Add 3-stage MVP build playbook with critical fixes *)",
|
|
8
|
+
"Bash(npm view *)",
|
|
9
|
+
"Bash(git commit -m 'fix: Replace HTTP/2 with ejs CVE-2022-29078 \\(Template Injection RCE\\) *)",
|
|
10
|
+
"Bash(bun install *)",
|
|
11
|
+
"Bash(curl -fsSL https://bun.sh/install)",
|
|
12
|
+
"Bash(bash)",
|
|
13
|
+
"Bash(~/.bun/bin/bun install *)",
|
|
14
|
+
"Bash(~/.bun/bin/bun test *)",
|
|
15
|
+
"Bash(~/.bun/bin/bun *)",
|
|
16
|
+
"Bash(git commit -m 'feat: Stage 1 - Core engine complete \\(dependency parser, CVE scraper, sandbox, reporter\\) *)"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
package/.dockerignore
ADDED
package/.env.development
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
BRIGHT_DATA_API_KEY=c9cbd1ab-937a-4ee1-b6b5-13e90f957438
|
|
2
|
+
DAYTONA_API_KEY=dtn_e4e5fd8c6c30f5b9da9453078f6b4e396202e56c0aaa1260e704e34d1380d2dc
|
|
3
|
+
KIMI_API_KEY=sk-lYLn5p8nepNgraaEC63XoOt1ZlHQGkudLJ12QwO4N6teJHVJ
|
|
4
|
+
NOSANA_API_KEY=nos_jNqyjmvmboO-tU5nuuLH9T7oIx6p6Xw7mKHG36yQAI4
|
|
5
|
+
VIDEODB_API_KEY=sk-E1n94jCnG4kXZPC686LZZE1Gm1t6DoJvyXz8N2-xB20
|
|
6
|
+
PORT=8080
|
|
7
|
+
NODE_ENV=development
|
|
8
|
+
DEBUG=false
|
package/.env.example
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# CodeProbe Configuration
|
|
2
|
+
# Copy this to .env and fill in your API keys
|
|
3
|
+
|
|
4
|
+
# Sponsor APIs (required for demo)
|
|
5
|
+
BRIGHT_DATA_API_KEY=your_bright_data_key_here
|
|
6
|
+
DAYTONA_API_KEY=your_daytona_key_here
|
|
7
|
+
NOSANA_API_KEY=your_nosana_key_here
|
|
8
|
+
|
|
9
|
+
# GitHub OAuth (required for CLI login and dashboard auth)
|
|
10
|
+
GITHUB_CLIENT_ID=your_github_client_id_here
|
|
11
|
+
GITHUB_CLIENT_SECRET=your_github_client_secret_here
|
|
12
|
+
|
|
13
|
+
# GitHub Token (for bot PR comments, fallback auth)
|
|
14
|
+
GITHUB_TOKEN=your_github_token_here
|
|
15
|
+
|
|
16
|
+
# Anthropic Claude (fallback for patch generation if Nosana unavailable)
|
|
17
|
+
ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
|
18
|
+
|
|
19
|
+
# Debug mode
|
|
20
|
+
DEBUG=false
|
package/.env.setup
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# CodeProbe .env Setup Guide
|
|
2
|
+
|
|
3
|
+
## Current Configuration (Development)
|
|
4
|
+
|
|
5
|
+
Your `.env` file is configured with:
|
|
6
|
+
|
|
7
|
+
### ✅ All API Keys Set
|
|
8
|
+
```
|
|
9
|
+
BRIGHT_DATA_API_KEY=c9cbd1ab-937a-4ee1-b6b5-13e90f957438
|
|
10
|
+
DAYTONA_API_KEY=dtn_e4e5fd8c6c30f5b9da9453078f6b4e396202e56c0aaa1260e704e34d1380d2dc
|
|
11
|
+
NOSANA_API_KEY=nos_jNqyjmvmboO-tU5nuuLH9T7oIx6p6Xw7mKHG36yQAI4
|
|
12
|
+
KIMI_API_KEY=sk-lYLn5p8nepNgraaEC63XoOt1ZlHQGkudLJ12QwO4N6teJHVJ
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### ✅ Server Configuration
|
|
16
|
+
```
|
|
17
|
+
PORT=8080
|
|
18
|
+
NODE_ENV=development
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### ✅ Optional Fields (for later)
|
|
22
|
+
```
|
|
23
|
+
GITHUB_CLIENT_ID= # Leave empty for now
|
|
24
|
+
GITHUB_CLIENT_SECRET= # Leave empty for now
|
|
25
|
+
GITHUB_TOKEN= # Leave empty for now
|
|
26
|
+
ANTHROPIC_API_KEY= # Leave empty for now
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
### Development Mode (Local Testing)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# .env file is automatically loaded by Bun
|
|
37
|
+
# Just run the server:
|
|
38
|
+
bun src/api/server-cli.ts
|
|
39
|
+
|
|
40
|
+
# In another terminal, test the CLI:
|
|
41
|
+
SERVER_URL=http://localhost:8080 \
|
|
42
|
+
CODEPROBE_SECRET=dev-token \
|
|
43
|
+
bun src/cli-server.ts scan ./demo-vulnerable-app
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### What Happens Automatically
|
|
47
|
+
|
|
48
|
+
1. **Bun loads `.env`** automatically on startup
|
|
49
|
+
2. **All API keys** are available to the application
|
|
50
|
+
3. **Server uses** Bright Data, Daytona, Kimi, Nosana APIs
|
|
51
|
+
4. **CLI connects** to local server
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Verification
|
|
56
|
+
|
|
57
|
+
All APIs are working. You can verify with:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Start server
|
|
61
|
+
bun src/api/server-cli.ts
|
|
62
|
+
|
|
63
|
+
# In another terminal, test scan
|
|
64
|
+
curl -X POST http://localhost:8080/api/scan \
|
|
65
|
+
-H "Content-Type: application/json" \
|
|
66
|
+
-H "Authorization: Bearer dev-token" \
|
|
67
|
+
-d '{"repoPath": "./demo-vulnerable-app"}' | jq '.data.scan'
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Expected response includes:
|
|
71
|
+
- ✅ CVEs found from **Bright Data**
|
|
72
|
+
- ✅ Exploit verification from **Daytona**
|
|
73
|
+
- ✅ Patches with `patch_diff` field from **Kimi/Nosana**
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## For Production / Cloud Deployment
|
|
78
|
+
|
|
79
|
+
When deploying to Google Cloud Run:
|
|
80
|
+
|
|
81
|
+
1. **Create new `.env` for production:**
|
|
82
|
+
```bash
|
|
83
|
+
cp .env .env.production
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
2. **Update production .env:**
|
|
87
|
+
```env
|
|
88
|
+
BRIGHT_DATA_API_KEY=c9cbd1ab-937a-4ee1-b6b5-13e90f957438
|
|
89
|
+
DAYTONA_API_KEY=dtn_e4e5fd8c6c30f5b9da9453078f6b4e396202e56c0aaa1260e704e34d1380d2dc
|
|
90
|
+
NOSANA_API_KEY=nos_jNqyjmvmboO-tU5nuuLH9T7oIx6p6Xw7mKHG36yQAI4
|
|
91
|
+
KIMI_API_KEY=sk-lYLn5p8nepNgraaEC63XoOt1ZlHQGkudLJ12QwO4N6teJHVJ
|
|
92
|
+
|
|
93
|
+
PORT=8080
|
|
94
|
+
NODE_ENV=production
|
|
95
|
+
GOOGLE_CLOUD_URL=https://your-cloud-run-url.run.app
|
|
96
|
+
API_SECRET_TOKEN=random-secret-string
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
3. **Set environment variables in Cloud Run:**
|
|
100
|
+
```bash
|
|
101
|
+
gcloud run deploy codeprobe \
|
|
102
|
+
--image gcr.io/your-project/codeprobe \
|
|
103
|
+
--set-env-vars BRIGHT_DATA_API_KEY=... \
|
|
104
|
+
--set-env-vars DAYTONA_API_KEY=... \
|
|
105
|
+
--set-env-vars NOSANA_API_KEY=... \
|
|
106
|
+
--set-env-vars KIMI_API_KEY=... \
|
|
107
|
+
--set-env-vars API_SECRET_TOKEN=...
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or use `.env` directly in Dockerfile:
|
|
111
|
+
```dockerfile
|
|
112
|
+
COPY .env .env.production
|
|
113
|
+
ENV NODE_ENV=production
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Security Notes
|
|
119
|
+
|
|
120
|
+
⚠️ **NEVER commit .env to git** (already in .gitignore)
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Verify .env is ignored
|
|
124
|
+
git status
|
|
125
|
+
# .env should NOT appear in the list
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
✓ Safe practices:
|
|
129
|
+
- ✅ `.env` is in `.gitignore`
|
|
130
|
+
- ✅ Only `.env.example` is in git
|
|
131
|
+
- ✅ API keys never appear in code
|
|
132
|
+
- ✅ Use environment variables for secrets
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Testing Checklist
|
|
137
|
+
|
|
138
|
+
Use this to verify your .env setup:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 1. Server starts with .env
|
|
142
|
+
bun src/api/server-cli.ts &
|
|
143
|
+
sleep 3
|
|
144
|
+
ps aux | grep "bun src/api" # Should see process running
|
|
145
|
+
|
|
146
|
+
# 2. Health check works
|
|
147
|
+
curl http://localhost:8080/health # Should return {"status":"ok"}
|
|
148
|
+
|
|
149
|
+
# 3. Scan endpoint works
|
|
150
|
+
curl -X POST http://localhost:8080/api/scan \
|
|
151
|
+
-H "Authorization: Bearer dev-token" \
|
|
152
|
+
-H "Content-Type: application/json" \
|
|
153
|
+
-d '{"repoPath": "."}' | jq '.data.scan.cves[0]'
|
|
154
|
+
# Should see CVE with patch_diff
|
|
155
|
+
|
|
156
|
+
# 4. CLI works with server
|
|
157
|
+
SERVER_URL=http://localhost:8080 \
|
|
158
|
+
CODEPROBE_SECRET=dev-token \
|
|
159
|
+
bun src/cli-server.ts scan ./demo-vulnerable-app
|
|
160
|
+
# Should show colored report with CVEs
|
|
161
|
+
|
|
162
|
+
# 5. Interactive mode works
|
|
163
|
+
cd /tmp/test-codeprobe-fix
|
|
164
|
+
SERVER_URL=http://localhost:8080 \
|
|
165
|
+
CODEPROBE_SECRET=dev-token \
|
|
166
|
+
bun src/cli-server.ts scan . --fix
|
|
167
|
+
# Should prompt for patch approval
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Environment Variable Reference
|
|
173
|
+
|
|
174
|
+
| Variable | Required | Location | Purpose |
|
|
175
|
+
|----------|----------|----------|---------|
|
|
176
|
+
| `BRIGHT_DATA_API_KEY` | Yes | Server | CVE scraping |
|
|
177
|
+
| `DAYTONA_API_KEY` | Yes | Server | Exploit verification |
|
|
178
|
+
| `KIMI_API_KEY` | Yes | Server | Patch generation |
|
|
179
|
+
| `NOSANA_API_KEY` | Yes | Server | GPU fallback |
|
|
180
|
+
| `PORT` | No | Server | Listen port (default: 8080) |
|
|
181
|
+
| `NODE_ENV` | No | Server | development/production |
|
|
182
|
+
| `DEBUG` | No | Server | Enable debug logs |
|
|
183
|
+
| `SERVER_URL` | No | CLI | Server address |
|
|
184
|
+
| `CODEPROBE_SECRET` | No | CLI | Auth token |
|
|
185
|
+
| `GITHUB_CLIENT_ID` | No | Server | OAuth (optional) |
|
|
186
|
+
| `GITHUB_CLIENT_SECRET` | No | Server | OAuth (optional) |
|
|
187
|
+
| `GITHUB_TOKEN` | No | Server | Bot PR comments (optional) |
|
|
188
|
+
| `ANTHROPIC_API_KEY` | No | Server | Fallback LLM (optional) |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Quick Start
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# 1. Verify .env exists
|
|
196
|
+
cat .env
|
|
197
|
+
|
|
198
|
+
# 2. Start server
|
|
199
|
+
bun src/api/server-cli.ts
|
|
200
|
+
|
|
201
|
+
# 3. In new terminal, test CLI
|
|
202
|
+
export SERVER_URL=http://localhost:8080
|
|
203
|
+
export CODEPROBE_SECRET=dev-token
|
|
204
|
+
bun src/cli-server.ts scan ./demo-vulnerable-app
|
|
205
|
+
|
|
206
|
+
# 4. Try interactive fix mode
|
|
207
|
+
bun src/cli-server.ts scan ./demo-vulnerable-app --fix
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
**Status: ✅ All environment variables configured and working!**
|
|
213
|
+
|
|
214
|
+
Last verified: June 13, 2026
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
name: CodeProbe Security Scan
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
security-scan:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: write
|
|
13
|
+
issues: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
|
|
24
|
+
- name: Run CodeProbe scan
|
|
25
|
+
id: scan
|
|
26
|
+
run: |
|
|
27
|
+
set +e
|
|
28
|
+
npx --yes codeprobe scan . --json --token "${{ secrets.CODEPROBE_TOKEN }}" > codeprobe-results.json 2>&1
|
|
29
|
+
SCAN_EXIT_CODE=$?
|
|
30
|
+
set -e
|
|
31
|
+
|
|
32
|
+
# Store results for later use
|
|
33
|
+
cat codeprobe-results.json
|
|
34
|
+
echo "SCAN_EXIT_CODE=$SCAN_EXIT_CODE" >> $GITHUB_OUTPUT
|
|
35
|
+
continue-on-error: true
|
|
36
|
+
env:
|
|
37
|
+
CODEPROBE_TOKEN: ${{ secrets.CODEPROBE_TOKEN }}
|
|
38
|
+
|
|
39
|
+
- name: Parse and comment results
|
|
40
|
+
if: always() && github.event_name == 'pull_request'
|
|
41
|
+
uses: actions/github-script@v7
|
|
42
|
+
with:
|
|
43
|
+
script: |
|
|
44
|
+
const fs = require('fs');
|
|
45
|
+
|
|
46
|
+
let resultsContent = '';
|
|
47
|
+
try {
|
|
48
|
+
resultsContent = fs.readFileSync('codeprobe-results.json', 'utf8');
|
|
49
|
+
} catch (e) {
|
|
50
|
+
console.log('Could not read results file:', e.message);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let cveCount = 0;
|
|
54
|
+
let riskScore = 0;
|
|
55
|
+
let criticalCount = 0;
|
|
56
|
+
let highCount = 0;
|
|
57
|
+
let cveList = [];
|
|
58
|
+
|
|
59
|
+
if (resultsContent) {
|
|
60
|
+
try {
|
|
61
|
+
const results = JSON.parse(resultsContent);
|
|
62
|
+
|
|
63
|
+
if (results.report && results.report.scan) {
|
|
64
|
+
const scan = results.report.scan;
|
|
65
|
+
cveCount = scan.cves ? scan.cves.length : 0;
|
|
66
|
+
riskScore = scan.risk_score ? scan.risk_score : 0;
|
|
67
|
+
|
|
68
|
+
if (scan.cves && Array.isArray(scan.cves)) {
|
|
69
|
+
scan.cves.forEach(cve => {
|
|
70
|
+
if (cve.severity === 'CRITICAL') criticalCount++;
|
|
71
|
+
if (cve.severity === 'HIGH') highCount++;
|
|
72
|
+
cveList.push({
|
|
73
|
+
id: cve.id,
|
|
74
|
+
package: cve.package,
|
|
75
|
+
severity: cve.severity,
|
|
76
|
+
exploitable: cve.exploitable
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.log('Could not parse results JSON:', e.message);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const statusEmoji = cveCount === 0 ? '✅' : '⚠️';
|
|
87
|
+
const riskLevel = riskScore > 8 ? '🔴 Critical' : riskScore > 5 ? '🟠 High' : '🟢 Low';
|
|
88
|
+
|
|
89
|
+
let comment = `## ${statusEmoji} CodeProbe Security Scan Results\n\n`;
|
|
90
|
+
comment += `**Scan Summary:**\n`;
|
|
91
|
+
comment += `- CVEs Found: **${cveCount}**\n`;
|
|
92
|
+
comment += `- Risk Score: **${riskScore.toFixed(1)}/10** ${riskLevel}\n`;
|
|
93
|
+
comment += `- Critical Issues: **${criticalCount}**\n`;
|
|
94
|
+
comment += `- High Issues: **${highCount}**\n\n`;
|
|
95
|
+
|
|
96
|
+
if (cveList.length > 0) {
|
|
97
|
+
comment += `**Top Findings:**\n`;
|
|
98
|
+
cveList.slice(0, 5).forEach(cve => {
|
|
99
|
+
const icon = cve.exploitable ? '🔓' : '⚠️';
|
|
100
|
+
comment += `${icon} **${cve.id}** (${cve.severity}) - ${cve.package}\n`;
|
|
101
|
+
});
|
|
102
|
+
if (cveList.length > 5) {
|
|
103
|
+
comment += `... and ${cveList.length - 5} more\n`;
|
|
104
|
+
}
|
|
105
|
+
comment += '\n';
|
|
106
|
+
} else {
|
|
107
|
+
comment += `**Status:** No vulnerabilities detected! ✅\n\n`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
comment += `---\n`;
|
|
111
|
+
comment += `*Powered by [CodeProbe](https://github.com/NachikethReddyY/codeprobe) - Automated Vulnerability Scanner*\n`;
|
|
112
|
+
comment += `🏆 Sponsored by: Bright Data | Daytona | Nosana\n`;
|
|
113
|
+
|
|
114
|
+
github.rest.issues.createComment({
|
|
115
|
+
issue_number: context.issue.number,
|
|
116
|
+
owner: context.repo.owner,
|
|
117
|
+
repo: context.repo.repo,
|
|
118
|
+
body: comment
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
- name: Fail if critical CVEs found
|
|
122
|
+
if: always()
|
|
123
|
+
run: |
|
|
124
|
+
if [ ! -f codeprobe-results.json ]; then
|
|
125
|
+
echo "No scan results found"
|
|
126
|
+
exit 0
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
CRITICAL_COUNT=$(grep -o '"severity":"CRITICAL"' codeprobe-results.json | wc -l || echo 0)
|
|
130
|
+
|
|
131
|
+
if [ "$CRITICAL_COUNT" -gt 0 ]; then
|
|
132
|
+
echo "❌ Critical CVEs detected: $CRITICAL_COUNT"
|
|
133
|
+
exit 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
exit 0
|
|
137
|
+
continue-on-error: false
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: CodeProbe Security Scan
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
security-scan:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
security-events: write
|
|
15
|
+
checks: write
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Setup Bun
|
|
24
|
+
uses: oven-sh/setup-bun@v1
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: bun install --frozen-lockfile
|
|
28
|
+
|
|
29
|
+
- name: Run CodeProbe scan
|
|
30
|
+
run: bun run src/cli/index.ts scan . --json --sarif > codeprobe-results.sarif
|
|
31
|
+
env:
|
|
32
|
+
BRIGHT_DATA_API_KEY: ${{ secrets.BRIGHT_DATA_API_KEY }}
|
|
33
|
+
DAYTONA_API_KEY: ${{ secrets.DAYTONA_API_KEY }}
|
|
34
|
+
NOSANA_API_KEY: ${{ secrets.NOSANA_API_KEY }}
|
|
35
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
36
|
+
DEBUG: "false"
|
|
37
|
+
continue-on-error: true
|
|
38
|
+
|
|
39
|
+
- name: Upload SARIF results
|
|
40
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
41
|
+
if: always()
|
|
42
|
+
with:
|
|
43
|
+
sarif_file: codeprobe-results.sarif
|
|
44
|
+
category: CodeProbe
|
|
45
|
+
|
|
46
|
+
- name: Comment results on PR
|
|
47
|
+
if: github.event_name == 'pull_request'
|
|
48
|
+
uses: actions/github-script@v7
|
|
49
|
+
with:
|
|
50
|
+
script: |
|
|
51
|
+
const fs = require('fs');
|
|
52
|
+
const results = JSON.parse(fs.readFileSync('codeprobe-results.sarif', 'utf8'));
|
|
53
|
+
|
|
54
|
+
let comment = `## ⚡ CodeProbe Security Scan\n\n`;
|
|
55
|
+
comment += `**Status:** ✅ Complete\n`;
|
|
56
|
+
comment += `**Powered by:** Bright Data | Daytona | Nosana\n\n`;
|
|
57
|
+
|
|
58
|
+
if (results.runs && results.runs[0] && results.runs[0].results) {
|
|
59
|
+
const issues = results.runs[0].results;
|
|
60
|
+
const exploitable = issues.filter(i => i.properties?.exploitable).length;
|
|
61
|
+
const theoretical = issues.length - exploitable;
|
|
62
|
+
|
|
63
|
+
comment += `### Findings\n`;
|
|
64
|
+
comment += `- **${exploitable}** Confirmed Exploitable\n`;
|
|
65
|
+
comment += `- **${theoretical}** Theoretical Risk\n\n`;
|
|
66
|
+
|
|
67
|
+
if (issues.length > 0) {
|
|
68
|
+
comment += `### Top Issues\n`;
|
|
69
|
+
issues.slice(0, 5).forEach(issue => {
|
|
70
|
+
const level = issue.level || 'note';
|
|
71
|
+
const severity = issue.properties?.severity || 'UNKNOWN';
|
|
72
|
+
comment += `- ${issue.ruleId}: ${severity} [${level}]\n`;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
comment += `No vulnerabilities found! ✅\n`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
github.rest.issues.createComment({
|
|
80
|
+
issue_number: context.issue.number,
|
|
81
|
+
owner: context.repo.owner,
|
|
82
|
+
repo: context.repo.repo,
|
|
83
|
+
body: comment
|
|
84
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Scheduled Dependency Scan
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
# Run every hour
|
|
6
|
+
- cron: "0 * * * *"
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
scan:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout code
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Bun
|
|
19
|
+
uses: oven-sh/setup-bun@v1
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: bun install
|
|
23
|
+
|
|
24
|
+
- name: Run scraper cron
|
|
25
|
+
run: bun run src/scraper-cron.ts
|
|
26
|
+
env:
|
|
27
|
+
# Point to deployed server or skip if not available
|
|
28
|
+
CODEPROBE_SERVER_URL: ${{ secrets.CODEPROBE_SERVER_URL || 'http://localhost:3000' }}
|