codeprobe-scanner 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/.claude/settings.local.json +0 -19
- package/.dockerignore +0 -17
- package/.env.development +0 -8
- package/.env.setup +0 -214
- package/.github/workflows/codeprobe-scan.yml +0 -137
- package/.github/workflows/codeprobe.yml +0 -84
- package/.github/workflows/scan-schedule.yml +0 -28
- package/ANALYSIS_SUMMARY.md +0 -365
- package/API_INTEGRATIONS.md +0 -469
- package/BUILD_PLAYBOOK.md +0 -349
- package/CLAUDE.md +0 -106
- package/DEPLOY.md +0 -452
- package/DEPLOYMENT_STATUS.md +0 -240
- package/DEPLOY_CHECKLIST.md +0 -316
- package/Dockerfile +0 -24
- package/EXECUTION_PLAN.html +0 -1086
- package/IMPLEMENTATION_COMPLETE.md +0 -288
- package/IMPLEMENTATION_SUMMARY.md +0 -443
- package/INTERACTIVE_FIX_FLOW.md +0 -308
- package/MIGRATION_COMPLETE.md +0 -327
- package/ORCHESTRATOR_SYNTHESIS.json +0 -80
- package/PENDING_WORK.md +0 -308
- package/PREFLIGHT_PLAN.md +0 -182
- package/QUICKSTART.md +0 -305
- package/STAGE_1_SETUP_ENGINE.md +0 -245
- package/STAGE_2_ARCHITECTURE.md +0 -714
- package/STAGE_2_CLI_VERIFICATION.md +0 -269
- package/STAGE_2_COMPLETE.md +0 -332
- package/STAGE_2_IMPLEMENTATION_PLAN.md +0 -679
- package/STAGE_3_COMPLETE.md +0 -246
- package/STAGE_3_DASHBOARD_POLISH.md +0 -371
- package/STAGE_3_SETUP.md +0 -155
- package/VIDEODB_INTEGRATION.md +0 -237
- package/archived/DASHBOARD_UI_WALKTHROUGH.md +0 -392
- package/archived/FRONTEND_SETUP.md +0 -236
- package/archived/auth.ts +0 -40
- package/archived/dashboard/components/BusinessImpactCard.tsx +0 -48
- package/archived/dashboard/components/CVETable.tsx +0 -104
- package/archived/dashboard/components/ErrorBoundary.tsx +0 -48
- package/archived/dashboard/components/PatchDiffViewer.tsx +0 -43
- package/archived/dashboard/components/RiskGauge.tsx +0 -64
- package/archived/dashboard/frontend.tsx +0 -104
- package/archived/dashboard/hooks/useAuth.ts +0 -32
- package/archived/dashboard/hooks/useScan.ts +0 -65
- package/archived/dashboard/index.html +0 -15
- package/archived/dashboard/pages/LoginPage.tsx +0 -28
- package/archived/dashboard/pages/ScanDetailPage.tsx +0 -143
- package/archived/dashboard/pages/ScansListPage.tsx +0 -160
- package/bun.lock +0 -603
- package/codeprobe-prd.md +0 -674
- package/cve-cache.json +0 -25
- package/demo-vulnerable-app/.github/workflows/codeprobe.yml +0 -32
- package/demo-vulnerable-app/README.md +0 -70
- package/demo-vulnerable-app/package-lock.json +0 -27
- package/demo-vulnerable-app/package.json +0 -15
- package/demo-vulnerable-app/server.js +0 -34
- package/demo.sh +0 -45
- package/index.ts +0 -19
- package/patches.json +0 -12
- package/serve-dashboard.ts +0 -23
- package/src/cli/index.ts +0 -137
- package/src/engine/index.ts +0 -90
- package/src/test/cli.test.ts +0 -211
- package/src/test/dashboard.test.ts +0 -38
- package/src/test/demo-scan.json +0 -32
- package/src/test/engine.test.ts +0 -157
- package/tailwind.config.js +0 -11
- package/tsconfig.json +0 -30
- package/verify-dashboard.ts +0 -87
- package/verify-env.sh +0 -98
- /package/bin/{codeprobe.js → codeprobe.cjs} +0 -0
package/DEPLOY.md
DELETED
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
# CodeProbe API Deployment to Google Cloud Run
|
|
2
|
-
|
|
3
|
-
Complete step-by-step guide to deploy the CodeProbe API server to Google Cloud Run with all required environment variables.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Google Cloud account with billing enabled
|
|
8
|
-
- `gcloud` CLI installed ([install](https://cloud.google.com/sdk/docs/install))
|
|
9
|
-
- Docker installed locally (for building and testing)
|
|
10
|
-
- Bun installed locally (for testing)
|
|
11
|
-
- Google Cloud project created
|
|
12
|
-
|
|
13
|
-
## Step 1: Set Up Google Cloud Project
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Set your project ID (replace with your actual project ID)
|
|
17
|
-
export PROJECT_ID="your-project-id"
|
|
18
|
-
export REGION="us-central1" # or your preferred region
|
|
19
|
-
|
|
20
|
-
# Set the project as default
|
|
21
|
-
gcloud config set project $PROJECT_ID
|
|
22
|
-
|
|
23
|
-
# Enable required APIs
|
|
24
|
-
gcloud services enable run.googleapis.com
|
|
25
|
-
gcloud services enable containerregistry.googleapis.com
|
|
26
|
-
gcloud services enable artifactregistry.googleapis.com
|
|
27
|
-
|
|
28
|
-
# Create a service account for deployment
|
|
29
|
-
gcloud iam service-accounts create codeprobe-deployer \
|
|
30
|
-
--display-name="CodeProbe Deployer"
|
|
31
|
-
|
|
32
|
-
# Grant necessary permissions
|
|
33
|
-
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
34
|
-
--member="serviceAccount:codeprobe-deployer@$PROJECT_ID.iam.gserviceaccount.com" \
|
|
35
|
-
--role="roles/run.admin"
|
|
36
|
-
|
|
37
|
-
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
38
|
-
--member="serviceAccount:codeprobe-deployer@$PROJECT_ID.iam.gserviceaccount.com" \
|
|
39
|
-
--role="roles/storage.admin"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Step 2: Create Dockerfile
|
|
43
|
-
|
|
44
|
-
Create a `Dockerfile` in the project root:
|
|
45
|
-
|
|
46
|
-
```dockerfile
|
|
47
|
-
# Use official Bun runtime as base image
|
|
48
|
-
FROM oven/bun:latest
|
|
49
|
-
|
|
50
|
-
# Set working directory
|
|
51
|
-
WORKDIR /app
|
|
52
|
-
|
|
53
|
-
# Copy package files
|
|
54
|
-
COPY package.json bun.lock ./
|
|
55
|
-
|
|
56
|
-
# Install dependencies
|
|
57
|
-
RUN bun install --production
|
|
58
|
-
|
|
59
|
-
# Copy application code
|
|
60
|
-
COPY src ./src
|
|
61
|
-
|
|
62
|
-
# Expose port (Cloud Run requires this)
|
|
63
|
-
EXPOSE 8080
|
|
64
|
-
|
|
65
|
-
# Set production environment
|
|
66
|
-
ENV NODE_ENV=production
|
|
67
|
-
ENV PORT=8080
|
|
68
|
-
|
|
69
|
-
# Start the API server
|
|
70
|
-
CMD ["bun", "run", "src/api/server.ts"]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Step 3: Create .dockerignore
|
|
74
|
-
|
|
75
|
-
Create a `.dockerignore` file to exclude unnecessary files:
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
node_modules
|
|
79
|
-
bun_modules
|
|
80
|
-
.git
|
|
81
|
-
.github
|
|
82
|
-
.env.local
|
|
83
|
-
.env
|
|
84
|
-
dist
|
|
85
|
-
*.test.ts
|
|
86
|
-
*.test.js
|
|
87
|
-
README.md
|
|
88
|
-
DEPLOY.md
|
|
89
|
-
demo-vulnerable-app
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Step 4: Update Server for Cloud Run
|
|
93
|
-
|
|
94
|
-
The API server needs to listen on the port specified by the `PORT` environment variable (Cloud Run sets this to 8080).
|
|
95
|
-
|
|
96
|
-
Update `/src/api/server.ts` to use the PORT environment variable:
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
const PORT = parseInt(process.env.PORT || "3000", 10);
|
|
100
|
-
|
|
101
|
-
export default Bun.serve({
|
|
102
|
-
port: PORT,
|
|
103
|
-
// ... rest of the configuration
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
console.log(`🚀 API server listening on http://localhost:${PORT}`);
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Step 5: Build and Push Docker Image to Google Cloud
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Configure Docker authentication with Google Cloud
|
|
113
|
-
gcloud auth configure-docker gcr.io
|
|
114
|
-
|
|
115
|
-
# Build the Docker image (from project root)
|
|
116
|
-
docker build -t gcr.io/$PROJECT_ID/codeprobe-api:latest .
|
|
117
|
-
|
|
118
|
-
# Push to Google Container Registry
|
|
119
|
-
docker push gcr.io/$PROJECT_ID/codeprobe-api:latest
|
|
120
|
-
|
|
121
|
-
# Verify the image was pushed
|
|
122
|
-
gcloud container images list --repository=gcr.io/$PROJECT_ID
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Step 6: Gather Required Environment Variables
|
|
126
|
-
|
|
127
|
-
Before deploying, prepare these environment variables:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
# These are required - set your actual values:
|
|
131
|
-
export GOOGLE_CLOUD_URL="https://[YOUR_CLOUD_RUN_URL]" # You'll get this after deployment
|
|
132
|
-
export API_SECRET_TOKEN="your-secret-token-here"
|
|
133
|
-
export BRIGHT_DATA_API_KEY="your-bright-data-key"
|
|
134
|
-
export DAYTONA_API_KEY="your-daytona-key"
|
|
135
|
-
export NOSANA_API_KEY="your-nosana-key"
|
|
136
|
-
|
|
137
|
-
# Optional GitHub OAuth (if using dashboard)
|
|
138
|
-
export GITHUB_CLIENT_ID="your-github-client-id"
|
|
139
|
-
export GITHUB_CLIENT_SECRET="your-github-client-secret"
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Step 7: Deploy to Cloud Run
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Deploy with environment variables
|
|
146
|
-
gcloud run deploy codeprobe-api \
|
|
147
|
-
--image=gcr.io/$PROJECT_ID/codeprobe-api:latest \
|
|
148
|
-
--platform=managed \
|
|
149
|
-
--region=$REGION \
|
|
150
|
-
--allow-unauthenticated \
|
|
151
|
-
--memory=1Gi \
|
|
152
|
-
--cpu=1 \
|
|
153
|
-
--timeout=3600 \
|
|
154
|
-
--set-env-vars=NODE_ENV=production,\
|
|
155
|
-
API_SECRET_TOKEN=$API_SECRET_TOKEN,\
|
|
156
|
-
BRIGHT_DATA_API_KEY=$BRIGHT_DATA_API_KEY,\
|
|
157
|
-
DAYTONA_API_KEY=$DAYTONA_API_KEY,\
|
|
158
|
-
NOSANA_API_KEY=$NOSANA_API_KEY,\
|
|
159
|
-
GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID,\
|
|
160
|
-
GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET
|
|
161
|
-
|
|
162
|
-
# Output will show your Cloud Run URL, save it:
|
|
163
|
-
# Service URL: https://codeprobe-api-xxxxx.run.app
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Step 8: Get Your Public URL
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
# Get the deployed service URL
|
|
170
|
-
CLOUD_RUN_URL=$(gcloud run services describe codeprobe-api \
|
|
171
|
-
--platform=managed \
|
|
172
|
-
--region=$REGION \
|
|
173
|
-
--format='value(status.url)')
|
|
174
|
-
|
|
175
|
-
echo "Your API URL: $CLOUD_RUN_URL"
|
|
176
|
-
|
|
177
|
-
# Update the GOOGLE_CLOUD_URL environment variable
|
|
178
|
-
export GOOGLE_CLOUD_URL=$CLOUD_RUN_URL
|
|
179
|
-
|
|
180
|
-
# Redeploy with the correct URL
|
|
181
|
-
gcloud run deploy codeprobe-api \
|
|
182
|
-
--image=gcr.io/$PROJECT_ID/codeprobe-api:latest \
|
|
183
|
-
--platform=managed \
|
|
184
|
-
--region=$REGION \
|
|
185
|
-
--allow-unauthenticated \
|
|
186
|
-
--memory=1Gi \
|
|
187
|
-
--cpu=1 \
|
|
188
|
-
--timeout=3600 \
|
|
189
|
-
--set-env-vars=NODE_ENV=production,\
|
|
190
|
-
GOOGLE_CLOUD_URL=$CLOUD_RUN_URL,\
|
|
191
|
-
API_SECRET_TOKEN=$API_SECRET_TOKEN,\
|
|
192
|
-
BRIGHT_DATA_API_KEY=$BRIGHT_DATA_API_KEY,\
|
|
193
|
-
DAYTONA_API_KEY=$DAYTONA_API_KEY,\
|
|
194
|
-
NOSANA_API_KEY=$NOSANA_API_KEY,\
|
|
195
|
-
GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID,\
|
|
196
|
-
GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## Step 9: Test the Deployment
|
|
200
|
-
|
|
201
|
-
### 9a: Test the API Endpoint
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
# Basic health check (GET /)
|
|
205
|
-
curl -X GET https://codeprobe-api-xxxxx.run.app/
|
|
206
|
-
|
|
207
|
-
# Create a scan (POST /api/scan)
|
|
208
|
-
# Replace with your actual URL and token
|
|
209
|
-
curl -X POST https://codeprobe-api-xxxxx.run.app/api/scans \
|
|
210
|
-
-H "Content-Type: application/json" \
|
|
211
|
-
-H "Authorization: Bearer $API_SECRET_TOKEN" \
|
|
212
|
-
-d '{
|
|
213
|
-
"url": "https://github.com/example/repo",
|
|
214
|
-
"branch": "main"
|
|
215
|
-
}'
|
|
216
|
-
|
|
217
|
-
# List scans (GET /api/scans)
|
|
218
|
-
curl -X GET https://codeprobe-api-xxxxx.run.app/api/scans \
|
|
219
|
-
-H "Authorization: Bearer $API_SECRET_TOKEN"
|
|
220
|
-
|
|
221
|
-
# Get specific scan (GET /api/scans/{scanId})
|
|
222
|
-
curl -X GET https://codeprobe-api-xxxxx.run.app/api/scans/{scanId} \
|
|
223
|
-
-H "Authorization: Bearer $API_SECRET_TOKEN"
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### 9b: View Logs
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
# Stream real-time logs from Cloud Run
|
|
230
|
-
gcloud run logs read codeprobe-api \
|
|
231
|
-
--platform=managed \
|
|
232
|
-
--region=$REGION \
|
|
233
|
-
--limit=50 \
|
|
234
|
-
--follow
|
|
235
|
-
|
|
236
|
-
# View recent logs
|
|
237
|
-
gcloud run logs read codeprobe-api \
|
|
238
|
-
--platform=managed \
|
|
239
|
-
--region=$REGION \
|
|
240
|
-
--limit=100
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## Step 10: Update NPM Package Registry
|
|
244
|
-
|
|
245
|
-
Update the CLI to use your deployed server URL:
|
|
246
|
-
|
|
247
|
-
### Option A: Update package.json
|
|
248
|
-
|
|
249
|
-
```bash
|
|
250
|
-
# Edit package.json to add the server URL as a config
|
|
251
|
-
cat >> package.json <<EOF
|
|
252
|
-
,
|
|
253
|
-
"codeprobe": {
|
|
254
|
-
"apiUrl": "$GOOGLE_CLOUD_URL"
|
|
255
|
-
}
|
|
256
|
-
EOF
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Option B: Set Environment Variable in CLI
|
|
260
|
-
|
|
261
|
-
Ensure the CLI reads from the environment:
|
|
262
|
-
|
|
263
|
-
```bash
|
|
264
|
-
# Users should set this before running the CLI
|
|
265
|
-
export CODEPROBE_API_URL="$GOOGLE_CLOUD_URL"
|
|
266
|
-
|
|
267
|
-
# Or they can add it to their shell profile
|
|
268
|
-
echo 'export CODEPROBE_API_URL="'$GOOGLE_CLOUD_URL'"' >> ~/.bashrc
|
|
269
|
-
# or ~/.zshrc for zsh
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Option C: Create a .codeprobe/config file
|
|
273
|
-
|
|
274
|
-
Create a config file for the CLI:
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
mkdir -p ~/.codeprobe
|
|
278
|
-
cat > ~/.codeprobe/config.json <<EOF
|
|
279
|
-
{
|
|
280
|
-
"apiUrl": "$GOOGLE_CLOUD_URL",
|
|
281
|
-
"apiToken": "$API_SECRET_TOKEN"
|
|
282
|
-
}
|
|
283
|
-
EOF
|
|
284
|
-
|
|
285
|
-
chmod 600 ~/.codeprobe/config.json
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
## Step 11: Update DNS (Optional)
|
|
289
|
-
|
|
290
|
-
If you want a custom domain instead of the Cloud Run URL:
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
# Map custom domain
|
|
294
|
-
gcloud run domain-mappings create \
|
|
295
|
-
--service=codeprobe-api \
|
|
296
|
-
--domain=api.yourdomain.com \
|
|
297
|
-
--platform=managed \
|
|
298
|
-
--region=$REGION
|
|
299
|
-
|
|
300
|
-
# This will output DNS records to add to your DNS provider
|
|
301
|
-
# Add the provided A record to your DNS settings
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## Troubleshooting
|
|
305
|
-
|
|
306
|
-
### Container fails to start
|
|
307
|
-
|
|
308
|
-
Check logs:
|
|
309
|
-
```bash
|
|
310
|
-
gcloud run logs read codeprobe-api --limit=50
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
Common issues:
|
|
314
|
-
- **Port not set**: Ensure `PORT` environment variable is used in server.ts
|
|
315
|
-
- **Missing dependencies**: Verify `bun install --production` includes all needed packages
|
|
316
|
-
- **Permission denied**: Check that Bun has execute permissions in Dockerfile
|
|
317
|
-
|
|
318
|
-
### Environment variables not loaded
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# Verify environment variables are set
|
|
322
|
-
gcloud run services describe codeprobe-api \
|
|
323
|
-
--platform=managed \
|
|
324
|
-
--region=$REGION \
|
|
325
|
-
--format='value(spec.template.spec.containers[0].env)'
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### API returning 403/401 errors
|
|
329
|
-
|
|
330
|
-
- Verify `API_SECRET_TOKEN` is set and matches your CLI token
|
|
331
|
-
- Check that the token is being sent in the Authorization header: `Authorization: Bearer <token>`
|
|
332
|
-
|
|
333
|
-
### High latency or timeouts
|
|
334
|
-
|
|
335
|
-
Increase CPU and memory:
|
|
336
|
-
```bash
|
|
337
|
-
gcloud run deploy codeprobe-api \
|
|
338
|
-
--image=gcr.io/$PROJECT_ID/codeprobe-api:latest \
|
|
339
|
-
--platform=managed \
|
|
340
|
-
--region=$REGION \
|
|
341
|
-
--memory=2Gi \
|
|
342
|
-
--cpu=2 \
|
|
343
|
-
--timeout=3600
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## Step 12: Set Up Continuous Deployment (Optional)
|
|
347
|
-
|
|
348
|
-
Create a GitHub Actions workflow to auto-deploy on push:
|
|
349
|
-
|
|
350
|
-
Create `.github/workflows/deploy-cloud-run.yml`:
|
|
351
|
-
|
|
352
|
-
```yaml
|
|
353
|
-
name: Deploy to Cloud Run
|
|
354
|
-
|
|
355
|
-
on:
|
|
356
|
-
push:
|
|
357
|
-
branches:
|
|
358
|
-
- main
|
|
359
|
-
paths:
|
|
360
|
-
- 'src/api/**'
|
|
361
|
-
- 'package.json'
|
|
362
|
-
- 'Dockerfile'
|
|
363
|
-
|
|
364
|
-
jobs:
|
|
365
|
-
deploy:
|
|
366
|
-
runs-on: ubuntu-latest
|
|
367
|
-
|
|
368
|
-
steps:
|
|
369
|
-
- uses: actions/checkout@v3
|
|
370
|
-
|
|
371
|
-
- name: Set up Cloud SDK
|
|
372
|
-
uses: google-github-actions/setup-gcloud@v1
|
|
373
|
-
with:
|
|
374
|
-
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
|
375
|
-
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
|
376
|
-
export_default_credentials: true
|
|
377
|
-
|
|
378
|
-
- name: Configure Docker authentication
|
|
379
|
-
run: gcloud auth configure-docker gcr.io
|
|
380
|
-
|
|
381
|
-
- name: Build and push Docker image
|
|
382
|
-
run: |
|
|
383
|
-
docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/codeprobe-api:latest .
|
|
384
|
-
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/codeprobe-api:latest
|
|
385
|
-
|
|
386
|
-
- name: Deploy to Cloud Run
|
|
387
|
-
run: |
|
|
388
|
-
gcloud run deploy codeprobe-api \
|
|
389
|
-
--image=gcr.io/${{ secrets.GCP_PROJECT_ID }}/codeprobe-api:latest \
|
|
390
|
-
--platform=managed \
|
|
391
|
-
--region=us-central1 \
|
|
392
|
-
--allow-unauthenticated \
|
|
393
|
-
--memory=1Gi \
|
|
394
|
-
--cpu=1 \
|
|
395
|
-
--timeout=3600 \
|
|
396
|
-
--set-env-vars=NODE_ENV=production,\
|
|
397
|
-
API_SECRET_TOKEN=${{ secrets.API_SECRET_TOKEN }},\
|
|
398
|
-
BRIGHT_DATA_API_KEY=${{ secrets.BRIGHT_DATA_API_KEY }},\
|
|
399
|
-
DAYTONA_API_KEY=${{ secrets.DAYTONA_API_KEY }},\
|
|
400
|
-
NOSANA_API_KEY=${{ secrets.NOSANA_API_KEY }}
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
Store secrets in GitHub:
|
|
404
|
-
```bash
|
|
405
|
-
# Go to your repo Settings > Secrets and add:
|
|
406
|
-
# - GCP_PROJECT_ID
|
|
407
|
-
# - GCP_SA_KEY (service account JSON key)
|
|
408
|
-
# - API_SECRET_TOKEN
|
|
409
|
-
# - BRIGHT_DATA_API_KEY
|
|
410
|
-
# - DAYTONA_API_KEY
|
|
411
|
-
# - NOSANA_API_KEY
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
## Summary
|
|
415
|
-
|
|
416
|
-
Your CodeProbe API is now deployed and accessible at:
|
|
417
|
-
|
|
418
|
-
```
|
|
419
|
-
https://codeprobe-api-xxxxx.run.app
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
The CLI and dashboard can now communicate with your Cloud Run service using:
|
|
423
|
-
|
|
424
|
-
```bash
|
|
425
|
-
export CODEPROBE_API_URL="https://codeprobe-api-xxxxx.run.app"
|
|
426
|
-
export CODEPROBE_API_TOKEN="$API_SECRET_TOKEN"
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
## Useful Commands Reference
|
|
430
|
-
|
|
431
|
-
```bash
|
|
432
|
-
# View all Cloud Run services
|
|
433
|
-
gcloud run services list --platform=managed
|
|
434
|
-
|
|
435
|
-
# Delete the service
|
|
436
|
-
gcloud run services delete codeprobe-api --platform=managed --region=us-central1
|
|
437
|
-
|
|
438
|
-
# Update just the environment variables (without rebuilding)
|
|
439
|
-
gcloud run deploy codeprobe-api \
|
|
440
|
-
--update-env-vars KEY=VALUE \
|
|
441
|
-
--platform=managed \
|
|
442
|
-
--region=us-central1
|
|
443
|
-
|
|
444
|
-
# Monitor traffic and performance
|
|
445
|
-
gcloud run services describe codeprobe-api \
|
|
446
|
-
--platform=managed \
|
|
447
|
-
--region=us-central1 \
|
|
448
|
-
--format='value(status)'
|
|
449
|
-
|
|
450
|
-
# Get metrics
|
|
451
|
-
gcloud monitoring dashboards list
|
|
452
|
-
```
|
package/DEPLOYMENT_STATUS.md
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
# CodeProbe: Deployment Status & Next Steps
|
|
2
|
-
|
|
3
|
-
## ✅ WHAT'S READY
|
|
4
|
-
|
|
5
|
-
### Core CLI Tool
|
|
6
|
-
- ✅ `src/cli-server.ts` — Complete, production-ready
|
|
7
|
-
- ✅ `bin/install-and-run.sh` — Auto-installs Bun
|
|
8
|
-
- ✅ `package.json` — Configured for NPM publishing
|
|
9
|
-
- ✅ Daytona SDK integrated (`@daytona/sdk` installed)
|
|
10
|
-
- ✅ Real sandbox exploit execution (not simulated)
|
|
11
|
-
|
|
12
|
-
### Backend Server
|
|
13
|
-
- ✅ `src/api/server-cli.ts` — Production-ready REST API
|
|
14
|
-
- ✅ `Dockerfile` — Google Cloud Run ready
|
|
15
|
-
- ✅ Rate limiting (5 req/min per IP)
|
|
16
|
-
- ✅ Bearer token authentication
|
|
17
|
-
- ✅ Health check endpoint
|
|
18
|
-
|
|
19
|
-
### Configuration & Documentation
|
|
20
|
-
- ✅ `DEPLOY.md` — Complete step-by-step deployment guide
|
|
21
|
-
- ✅ `DEPLOY_CHECKLIST.md` — Full deployment checklist
|
|
22
|
-
- ✅ `QUICKSTART.md` — User guide
|
|
23
|
-
- ✅ `.env.example` — All environment variables documented
|
|
24
|
-
|
|
25
|
-
### API Keys & Integration
|
|
26
|
-
- ✅ Daytona API Key received: `dtn_e4e5fd8c6c30f5b9da9453078f6b4e396202e56c0aaa1260e704e34d1380d2dc`
|
|
27
|
-
- ✅ Daytona SDK integrated into sandbox.ts
|
|
28
|
-
- ✅ Real exploit execution working (with simulation fallback)
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## ⏳ WAITING FOR USER ACTION
|
|
33
|
-
|
|
34
|
-
### Phase 1: Google Cloud Setup (Your Action)
|
|
35
|
-
|
|
36
|
-
**What you need to do:**
|
|
37
|
-
|
|
38
|
-
1. **Create a Google Cloud project** (if not already done)
|
|
39
|
-
```bash
|
|
40
|
-
gcloud projects create codeprobe
|
|
41
|
-
gcloud config set project codeprobe
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
2. **Enable required APIs**
|
|
45
|
-
```bash
|
|
46
|
-
gcloud services enable run.googleapis.com
|
|
47
|
-
gcloud services enable containerregistry.googleapis.com
|
|
48
|
-
gcloud services enable artifactregistry.googleapis.com
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
3. **Get your Google Cloud Run URL**
|
|
52
|
-
- Once deployed (see Phase 2), you'll have a URL like:
|
|
53
|
-
```
|
|
54
|
-
https://codeprobe-abc123.run.app
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
4. **Generate a secret token**
|
|
58
|
-
```bash
|
|
59
|
-
# Generate a random 32-char hex string
|
|
60
|
-
openssl rand -hex 32
|
|
61
|
-
# Example output: a7f3e8d2c9b1f4e6a7d3c8f1b9e2a4d6c7f8a1b2c3d4e5f6a7b8c9d0e1f2a3
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
5. **Collect these values:**
|
|
65
|
-
```
|
|
66
|
-
GOOGLE_CLOUD_URL = https://your-cloud-run-url.run.app
|
|
67
|
-
API_SECRET_TOKEN = random-hex-string-from-step-4
|
|
68
|
-
DAYTONA_API_KEY = dtn_e4e5fd8c6c30f5b9da9453078f6b4e396202e56c0aaa1260e704e34d1380d2dc
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## 📋 DEPLOYMENT PHASES
|
|
74
|
-
|
|
75
|
-
Once you have the values above, follow these steps:
|
|
76
|
-
|
|
77
|
-
### Phase 2: Deploy Server to Google Cloud (10-15 min)
|
|
78
|
-
1. Read `DEPLOY.md` (complete guide provided)
|
|
79
|
-
2. Run the `gcloud` commands to build and deploy
|
|
80
|
-
3. Set environment variables in Cloud Run console
|
|
81
|
-
4. Test: `curl https://your-url/health`
|
|
82
|
-
|
|
83
|
-
### Phase 3: Configure CLI (2 min)
|
|
84
|
-
Set these environment variables on your machine:
|
|
85
|
-
```bash
|
|
86
|
-
export SERVER_URL="https://your-cloud-run-url.run.app"
|
|
87
|
-
export CODEPROBE_SECRET="your-api-secret-token"
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Or add to `~/.bashrc` or `~/.zshrc` for persistence.
|
|
91
|
-
|
|
92
|
-
### Phase 4: Test Locally (5 min)
|
|
93
|
-
```bash
|
|
94
|
-
# Test 1: Health check
|
|
95
|
-
curl https://your-url/health
|
|
96
|
-
|
|
97
|
-
# Test 2: Scan endpoint
|
|
98
|
-
curl -X POST https://your-url/api/scan \
|
|
99
|
-
-H "Content-Type: application/json" \
|
|
100
|
-
-H "Authorization: Bearer $CODEPROBE_SECRET" \
|
|
101
|
-
-d '{"repoPath": "."}'
|
|
102
|
-
|
|
103
|
-
# Test 3: CLI
|
|
104
|
-
bun src/cli-server.ts scan .
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Phase 5: NPM Publishing (5 min)
|
|
108
|
-
```bash
|
|
109
|
-
npm login
|
|
110
|
-
npm publish
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Phase 6: GitHub Integration (2 min per repo)
|
|
114
|
-
Add this to any repo's `.github/workflows/codeprobe.yml`:
|
|
115
|
-
```yaml
|
|
116
|
-
name: CodeProbe Security Scan
|
|
117
|
-
on: [pull_request]
|
|
118
|
-
jobs:
|
|
119
|
-
scan:
|
|
120
|
-
runs-on: ubuntu-latest
|
|
121
|
-
steps:
|
|
122
|
-
- uses: actions/checkout@v4
|
|
123
|
-
- run: npx codeprobe scan . --json --token ${{ secrets.CODEPROBE_SECRET }}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## 🔑 ENVIRONMENT VARIABLES REQUIRED
|
|
129
|
-
|
|
130
|
-
### On Your Machine (CLI)
|
|
131
|
-
```bash
|
|
132
|
-
SERVER_URL=https://your-cloud-run-url.run.app
|
|
133
|
-
CODEPROBE_SECRET=your-api-secret-token
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### On Google Cloud Run (Server)
|
|
137
|
-
```bash
|
|
138
|
-
GOOGLE_CLOUD_URL=https://your-cloud-run-url.run.app
|
|
139
|
-
API_SECRET_TOKEN=your-api-secret-token
|
|
140
|
-
DAYTONA_API_KEY=dtn_e4e5fd8c6c30f5b9da9453078f6b4e396202e56c0aaa1260e704e34d1380d2dc
|
|
141
|
-
PORT=8080
|
|
142
|
-
NODE_ENV=production
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## 🚀 QUICK COMMANDS REFERENCE
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
# Test locally (before cloud deployment)
|
|
151
|
-
bun src/api/server-cli.ts
|
|
152
|
-
|
|
153
|
-
# Run CLI against local server
|
|
154
|
-
SERVER_URL=http://localhost:8080 bun src/cli-server.ts scan .
|
|
155
|
-
|
|
156
|
-
# Run CLI against cloud server (once deployed)
|
|
157
|
-
SERVER_URL=https://your-url CODEPROBE_SECRET=xxx bun src/cli-server.ts scan .
|
|
158
|
-
|
|
159
|
-
# Run all tests
|
|
160
|
-
bun test
|
|
161
|
-
|
|
162
|
-
# Build Docker image locally
|
|
163
|
-
docker build -t codeprobe .
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## 📊 DEPLOYMENT TIMELINE
|
|
169
|
-
|
|
170
|
-
| Phase | Time | Blocker | Status |
|
|
171
|
-
|-------|------|---------|--------|
|
|
172
|
-
| 1. Google Cloud setup | 10-15 min | You | ⏳ **ACTION NEEDED** |
|
|
173
|
-
| 2. Deploy server | 10 min | Phase 1 | ⏳ Blocked |
|
|
174
|
-
| 3. Configure CLI | 2 min | Phase 2 | ⏳ Blocked |
|
|
175
|
-
| 4. Test locally | 5 min | Phase 3 | ⏳ Blocked |
|
|
176
|
-
| 5. Publish to NPM | 5 min | Phase 4 | ⏳ Blocked |
|
|
177
|
-
| 6. GitHub integration | 2 min | Phase 5 | ⏳ Blocked |
|
|
178
|
-
|
|
179
|
-
**Total time to full deployment:** ~45 minutes (once Phase 1 starts)
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## ✨ WHAT YOU'LL BE ABLE TO DO
|
|
184
|
-
|
|
185
|
-
After deployment:
|
|
186
|
-
|
|
187
|
-
### Command Line
|
|
188
|
-
```bash
|
|
189
|
-
npm install -g codeprobe
|
|
190
|
-
codeprobe scan /path/to/repo
|
|
191
|
-
codeprobe scan . --json # JSON output for piping
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### GitHub Actions
|
|
195
|
-
```
|
|
196
|
-
Push code → GitHub Actions → npx codeprobe scan → Results in PR comment
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Scheduled Scanning
|
|
200
|
-
```
|
|
201
|
-
Hourly cronjob → Detects package changes → Triggers scan → Results saved
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## 🆘 TROUBLESHOOTING
|
|
207
|
-
|
|
208
|
-
### "Connection refused"
|
|
209
|
-
- Make sure `SERVER_URL` is set correctly
|
|
210
|
-
- Make sure Google Cloud server is running
|
|
211
|
-
- Try: `curl https://your-url/health`
|
|
212
|
-
|
|
213
|
-
### "Unauthorized"
|
|
214
|
-
- Check `CODEPROBE_SECRET` matches on both CLI and server
|
|
215
|
-
- In development mode, any token works
|
|
216
|
-
|
|
217
|
-
### "Daytona failed"
|
|
218
|
-
- Falls back to local simulation automatically
|
|
219
|
-
- Check Daytona API key in environment variables
|
|
220
|
-
- Logs will show: `[Daytona] ✓ Real sandbox enabled` if working
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## 📝 SUMMARY
|
|
225
|
-
|
|
226
|
-
**You have:**
|
|
227
|
-
- ✅ Complete CLI tool
|
|
228
|
-
- ✅ Production server ready
|
|
229
|
-
- ✅ Daytona SDK integrated
|
|
230
|
-
- ✅ Docker container ready
|
|
231
|
-
- ✅ Full deployment guide
|
|
232
|
-
|
|
233
|
-
**You need to provide:**
|
|
234
|
-
- Google Cloud URL (once you deploy)
|
|
235
|
-
- Generated secret token
|
|
236
|
-
- Environment variable setup
|
|
237
|
-
|
|
238
|
-
**Time to full deployment:** ~45 minutes
|
|
239
|
-
|
|
240
|
-
Once you have the Google Cloud URL, reply here and I'll help you through the remaining deployment steps!
|