-
Notifications
You must be signed in to change notification settings - Fork 0
feat: complete Phase 2 - API server, Dashboard, and CVE sync #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 20 commits
4b94c20
13a8c80
f549a1b
ccdb699
b0a5718
df0f513
090bd2d
a754524
9ea9fee
fe140bf
9f9ce16
7253d4d
0c20bdc
37b85bb
5acb8c7
31932d2
0b7c343
c9ecbb2
2f34dee
4fad9e9
fc003d0
1f73707
33d87a3
dd8e5e8
5ca0757
08d77ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,3 +32,4 @@ coverage | |
| .idea | ||
| *.swp | ||
| *.swo | ||
| deploy-ghcr.sh | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,75 @@ | ||||||
| # Zenvra Configuration & Hardcoded Values | ||||||
|
|
||||||
| ## Current State | ||||||
|
|
||||||
| ### β Already Configurable via Environment Variables | ||||||
|
|
||||||
| 1. **Backend API URL** β `PUBLIC_API_URL` (default: `http://localhost:8080`) | ||||||
| - Used in: `apps/web/src/lib/api.ts`, `apps/web/src/lib/stores/aiConfig.svelte.ts` | ||||||
| - Allows pointing to different API endpoints (local dev, staging, production) | ||||||
|
|
||||||
| 2. **AI Provider Configuration** β Persisted in localStorage | ||||||
| - **Provider**: anthropic, openai, google, custom (user-selected) | ||||||
| - **API Key**: User-provided via Settings UI | ||||||
| - **Model**: User-selected from available models for provider | ||||||
| - **Endpoint**: Optional, user-provided for custom providers | ||||||
| - Allows bring-your-own-key pattern β | ||||||
|
|
||||||
| 3. **Database URL** β `DATABASE_URL` in `.env` (for server) | ||||||
| - Allows local dev, Docker, or cloud databases | ||||||
|
|
||||||
| 4. **CVE Data Feeds** β `NVD_API_KEY` in `.env` | ||||||
| - Synced on server startup or manual trigger | ||||||
|
|
||||||
| ### β οΈ Hardcoded Values to Consider | ||||||
|
|
||||||
| 1. **Server Port** β `8080` (hardcoded in server) | ||||||
| - Suggestion: Make configurable via `PORT` env var | ||||||
|
|
||||||
| 2. **Web Dev Port** β `5173` (Vite default) | ||||||
| - Vite automatically uses next available port if occupied | ||||||
|
|
||||||
| 3. **Database Credentials** β `postgres:postgres@localhost:5433/zenvra` | ||||||
| - Should be parameterized in `.env` | ||||||
|
|
||||||
| 4. **Scan Engines** β Hardcoded in CLI/server (sast, sca, secrets, ai_code) | ||||||
| - Already configurable per-request via `--disable` flag and API | ||||||
|
|
||||||
| 5. **Severity Thresholds** β Default `low` in CLI | ||||||
| - Already configurable via `--severity` flag | ||||||
|
|
||||||
| ### π Recommended Next Steps | ||||||
|
|
||||||
| 1. **Server** β Add `PORT` and `HOST` env vars | ||||||
| 2. **Web** β Consider `PUBLIC_APP_NAME`, `PUBLIC_VERSION` for UI | ||||||
| 3. **Database** β Already parametrized in `.env` | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix spelling inconsistency. The word "parametrized" is inconsistent with "parameterized" used on line 27. Use consistent spelling throughout the document. π Proposed fix-3. **Database** β Already parametrized in `.env`
+3. **Database** β Already parameterized in `.env`π Committable suggestion
Suggested change
π§° Toolsπͺ LanguageTool[uncategorized] ~45-~45: Do not mix variants of the same word (βparametrizeβ and βparameterizeβ) within a single text. (EN_WORD_COHERENCY) π€ Prompt for AI Agents |
||||||
| 4. **AI Config** β Already per-user via localStorage + Settings UI | ||||||
|
|
||||||
| ## How to Use Development Environment | ||||||
|
|
||||||
| ```bash | ||||||
| # Terminal 1: Start PostgreSQL + Redis | ||||||
| docker compose up -d postgres redis | ||||||
|
|
||||||
| # Terminal 2: Start API Server | ||||||
| set -a && source .env && set +a | ||||||
| cargo run -p zenvra-server | ||||||
|
|
||||||
| # Terminal 3: Sync CVE data | ||||||
| cargo run -p zenvra-server -- sync | ||||||
|
|
||||||
| # Terminal 4: Start Web Frontend | ||||||
| cd apps/web | ||||||
| pnpm dev | ||||||
|
|
||||||
| # Open http://localhost:5174 in browser | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix port inconsistency. Line 65 references π Proposed fix-# Open http://localhost:5174 in browser
+# Open http://localhost:5173 in browserπ Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||
| ``` | ||||||
|
|
||||||
| ## API Endpoints | ||||||
|
|
||||||
| - `/health` β Health check | ||||||
| - `/api/v1/scan` β Submit code scan (returns scan ID) | ||||||
| - `/api/v1/scan/:id/events` β Stream scan results via SSE | ||||||
| - `/api/v1/history` β Get scan history | ||||||
| - `/api/v1/sync` β Trigger manual CVE sync | ||||||
| - `/api/v1/ai/models` β Fetch available AI models for provider | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential
:latesttag conflict with release.yml.Both this deploy job and the
docker-publishjob inrelease.ymlpush:latesttags to the same image names (ghcr.io/${{ github.repository }}-api:latestand-web:latest). When a release tag is pushed tomain, both workflows may run concurrently, causing race conditions on the:latesttag.Consider one of these approaches:
:mainor:edge) to distinguish CI builds from releases:latesttag push from one of the workflowsOption 1: Use distinct tag for CI builds
- name: Build and push API (latest) uses: docker/build-push-action@v5 with: context: . file: crates/server/Dockerfile push: true - tags: ghcr.io/${{ github.repository }}-api:latest + tags: ghcr.io/${{ github.repository }}-api:edge cache-from: type=gha cache-to: type=gha,mode=max - name: Build and push Web (latest) uses: docker/build-push-action@v5 with: context: ./apps/web push: true - tags: ghcr.io/${{ github.repository }}-web:latest + tags: ghcr.io/${{ github.repository }}-web:edge cache-from: type=gha cache-to: type=gha,mode=maxπ€ Prompt for AI Agents