Skip to content

Commit dbc247c

Browse files
committed
Merge branch 'master' of github.com:profullstack/threatcrush
2 parents 679bb1e + 24badba commit dbc247c

89 files changed

Lines changed: 14460 additions & 1224 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
node_modules
2+
.next
3+
.git
4+
.github
5+
.vscode
6+
*.md
7+
!README.md
8+
.DS_Store
9+
.env.local
10+
.env.*.local
11+
*.tsbuildinfo
12+
cli/dist
13+
cli/node_modules
14+
desktop/dist
15+
desktop/node_modules
16+
mobile/node_modules
17+
mobile/.expo
18+
extension/dist
19+
extension/node_modules
20+
.qwen

.github/workflows/desktop-release.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Setup Node.js
5050
uses: actions/setup-node@v4
5151
with:
52-
node-version: 24
52+
node-version: 22
5353
cache: 'pnpm'
5454

5555
- name: Install dependencies
@@ -97,14 +97,6 @@ jobs:
9797
- name: Package desktop app
9898
working-directory: desktop
9999
run: npx electron-builder --${{ matrix.platform }} --${{ matrix.arch }} --publish never
100-
env:
101-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
# macOS notarization
103-
APPLE_ID: ${{ secrets.APPLE_ID }}
104-
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
105-
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
106-
# Windows signing
107-
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
108100

109101
- name: Upload artifacts
110102
uses: actions/upload-artifact@v4

.github/workflows/mobile-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Setup Node.js
5050
uses: actions/setup-node@v4
5151
with:
52-
node-version: 24
52+
node-version: 22
5353
cache: 'pnpm'
5454

5555
- name: Install dependencies

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Node.js
2828
uses: actions/setup-node@v4
2929
with:
30-
node-version: 24
30+
node-version: 22
3131
cache: 'pnpm'
3232
registry-url: 'https://registry.npmjs.org'
3333

.github/workflows/pr-checks.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,28 @@ jobs:
2424
- name: Setup Node.js
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: 24
27+
node-version: 22
2828
cache: 'pnpm'
2929

3030
- name: Install dependencies
3131
run: pnpm install --frozen-lockfile
3232

3333
- name: Build CLI
3434
run: pnpm --filter @profullstack/threatcrush build
35+
env:
36+
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
37+
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
38+
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
3539

3640
- name: Build landing page
3741
run: pnpm --filter threatcrush build
42+
env:
43+
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
44+
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
45+
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
3846

3947
- name: Type check CLI
4048
run: pnpm --filter @profullstack/threatcrush exec tsc --noEmit
49+
env:
50+
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
51+
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}

.github/workflows/submit-packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup Node.js
3636
uses: actions/setup-node@v4
3737
with:
38-
node-version: 24
38+
node-version: 22
3939
cache: 'pnpm'
4040

4141
- name: Install dependencies
@@ -148,7 +148,7 @@ jobs:
148148
- name: Setup Node.js
149149
uses: actions/setup-node@v4
150150
with:
151-
node-version: 24
151+
node-version: 22
152152
cache: 'pnpm'
153153

154154
- name: Install dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ data/
44
.env.local
55
.env
66
supabase/supabase/.temp
7+
.qwen/

Dockerfile

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
FROM node:22-slim AS base
2-
RUN corepack enable && corepack prepare pnpm@10.26.2 --activate
1+
FROM node:22-slim
2+
3+
RUN corepack enable && corepack prepare pnpm@10.33.0 --activate
4+
5+
# Install git for postinstall hook
6+
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
37

4-
# --- deps ---
5-
FROM base AS deps
68
WORKDIR /app
9+
710
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
11+
COPY cli/package.json cli/
812
COPY desktop/package.json desktop/
913
COPY mobile/package.json mobile/
14+
COPY extension/package.json extension/
15+
1016
RUN pnpm install --frozen-lockfile
1117

12-
# --- builder ---
13-
FROM base AS builder
14-
WORKDIR /app
15-
COPY --from=deps /app/node_modules ./node_modules
1618
COPY . .
19+
1720
RUN pnpm build
1821

19-
# --- runner ---
20-
FROM node:22-slim AS runner
21-
WORKDIR /app
22+
# Next.js standalone output doesn't include static assets — copy them in
23+
RUN cp -r .next/static .next/standalone/.next/static
24+
2225
ENV NODE_ENV=production
2326
ENV HOSTNAME=0.0.0.0
24-
25-
COPY --from=builder /app/.next/standalone ./
26-
COPY --from=builder /app/.next/static ./.next/static
27-
COPY --from=builder /app/public ./public
27+
ENV PORT=3000
2828

2929
EXPOSE 3000
30-
CMD ["node", "server.js"]
30+
31+
CMD ["node", ".next/standalone/server.js"]

TODO.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# ThreatCrush TODO
2+
3+
Generated: 2026-04-11
4+
5+
---
6+
7+
## 🔴 Blockers (Must fix before production launch)
8+
9+
### 1. Phone / SMS Verification ✅ FIXED
10+
- [x] **Replaced stub phone verification**`src/app/api/auth/verify-phone/route.ts` now calls `supabase.auth.verifyOtp()` to validate the OTP against Supabase's stored code.
11+
- [x] **Created `send-phone-code` endpoint**`src/app/api/auth/send-phone-code/route.ts` triggers Supabase OTP generation, which fires the Telnyx webhook.
12+
- [x] **Updated frontend**`src/app/auth/verify/page.tsx` now has a "Send verification code" button and proper OTP input flow. Removed "Beta: Any 6-digit code" warning.
13+
- [x] **Tests updated** — Added tests for invalid OTP, wrong user OTP, and new `send-phone-code` endpoint tests.
14+
- [ ] **Runtime requirement**: `TELNYX_API_KEY` and `TELNYX_PHONE_NUMBER` env vars must be configured (Telnyx hook at `src/app/api/hooks/send-sms/route.ts` is already implemented).
15+
- [ ] **Supabase dashboard**: Set the SMS webhook URL to `https://your-domain.com/api/hooks/send-sms` in Supabase Auth settings.
16+
17+
### 2. Supabase Credentials ✅ FIXED
18+
- [x] Removed placeholder fallbacks in `src/lib/supabase.ts` — now throws at startup if env vars are not set.
19+
- [x] Added same guard to `src/app/api/auth/callback/route.ts`.
20+
- [x] Added runtime validation with clear error messages.
21+
- [x] **Linked remote project** via `supabase link --project-ref odhaoehucfyrqhanthyq`.
22+
- [x] **Synced migration history** — all 5 migrations (waitlist, referrals, modules_marketplace, users, + remote 20260406180000) are applied and matched.
23+
- [x] **Verified `user_profiles` table** exists and accessible on remote.
24+
- [x] **Verified Telnyx SMS** — API key works, `+19492847328` is active with messaging enabled.
25+
- [ ] **Supabase dashboard (manual step)**: In Supabase Dashboard → Auth → SMS → configure webhook URL to `https://threatcrush.com/api/hooks/send-sms` with secret `ad6a68662e81fba4c6beb8f7674a15cbdc28946eec8066397bcaf36599f7ceda`. Enable phone provider "Twilio Verify / custom provider" pointing to the webhook.
26+
27+
### 3. CLI Commands — All Gated
28+
All commands below currently just prompt for email and say "Coming soon — ThreatCrush is in private beta." (`cli/src/index.ts`):
29+
- [ ] `threatcrush monitor`
30+
- [ ] `threatcrush tui`
31+
- [ ] `threatcrush init`
32+
- [ ] `threatcrush scan`
33+
- [ ] `threatcrush pentest`
34+
- [ ] `threatcrush status`
35+
- [ ] `threatcrush start`
36+
- [ ] `threatcrush stop`
37+
- [ ] `threatcrush logs`
38+
- [ ] `threatcrush activate`
39+
- [ ] `threatcrush modules` (gated at line 283)
40+
- [ ] `threatcrush store` (gated at line 290)
41+
- [ ] `threatcrush store search` (gated at line 296)
42+
- [ ] `threatcrush update --modules` — says "Module updates coming soon" (line 235)
43+
44+
### 4. TUI Dashboard — Not Implemented
45+
- [ ] Create `cli/src/tui/dashboard.js` — referenced by `cli/src/commands/monitor.ts:31` but the entire `cli/src/tui/` directory does not exist.
46+
47+
### 5. Module Marketplace — Not Functional
48+
- [ ] `threatcrush modules install` — says "Module marketplace is not yet available" (`cli/src/commands/modules.ts:57-60`).
49+
- [ ] Local module install (`./path`) — says "This feature is coming soon" (`cli/src/commands/modules.ts:54`).
50+
- [ ] Build real backend for module install/purchase flows (store pages exist but are UI-only).
51+
52+
### 6. Module SDK — Not Published
53+
- [ ] Publish `@threatcrush/sdk` package. The `boilerplates/module-example/src/index.ts` defines its own `ModuleContext` and `EventPayload` interfaces instead of importing from `@threatcrush/sdk`.
54+
55+
### 7. Desktop Release Pipeline — Failing
56+
- [ ] Fix packaging configuration in GitHub Actions desktop release workflow (fails on all matrix targets: Linux, macOS, Windows).
57+
- [ ] Configure macOS signing/notarization secrets: `APPLE_CERTIFICATE`, `APPLE_CERTIFICATE_PASSWORD`, `KEYCHAIN_PASSWORD`, `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, `APPLE_TEAM_ID`.
58+
- [ ] Configure Windows signing secrets: `WINDOWS_CERTIFICATE`, `WINDOWS_CERTIFICATE_PASSWORD`.
59+
- [ ] Verify GitHub Releases are created properly on tag pushes.
60+
- [ ] Generate and attach checksums.
61+
- [ ] Decide how website download buttons should work (direct GitHub release assets vs. first-party downloads page).
62+
- [ ] Update `/docs/releases` with confirmed artifact names.
63+
- [ ] Update homepage/download section only after at least one successful release.
64+
65+
### 8. Desktop App — Placeholder IPC
66+
- [ ] `connectDaemon()` in `desktop/src/preload/index.ts` is a placeholder — always returns `Promise.resolve(false)`. No real IPC with the daemon is implemented.
67+
68+
---
69+
70+
## 🟡 Significant Gaps
71+
72+
### 9. Mobile App — Skipped for now
73+
- [ ] EAS login, Expo project setup, `EXPO_TOKEN` GitHub secret
74+
- [ ] Produce preview build in EAS
75+
- [ ] Apple App Store Connect and Google Play setup
76+
- [ ] Replace minimal sanity screen in `mobile/app/index.tsx` with real functionality
77+
- [ ] Replace hardcoded demo data in `mobile/src/stores/events.ts` with real API calls
78+
- [ ] Integrate E2E encryption (`mobile/src/lib/crypto.ts`) into real communication flow
79+
80+
### 10. Browser Extension — Demo Data Only
81+
- [ ] Replace `checkForEvents()` demo data with real API calls (`extension/src/background/index.js:58-59`).
82+
- [ ] Implement real `scanUrl()` — currently always returns `{ status: 'secure' }` (line 130).
83+
- [ ] Show scan results in popup UI instead of just logging to console (`extension/src/popup/components/QuickActions.jsx:19`).
84+
- [ ] Replace demo data in `fetchStats()` with real API calls (`extension/src/store/events.js:4`). Uncomment real `chrome.runtime.sendMessage` call (line 50).
85+
- [ ] Submit to Chrome Web Store, Firefox Add-ons, Safari (all "coming soon" per README).
86+
87+
### 11. Usage / Billing API — Demo Data Fallback
88+
- [ ] Connect real CoinPayPortal API (requires `COINPAYPORTAL_API_KEY` and `COINPAYPORTAL_BUSINESS_ID` env vars).
89+
- [ ] Implement `daily_spend` and `module_breakdown` arrays (currently returned empty even when API is connected, `src/app/api/usage/route.ts:186-187`).
90+
- [ ] Implement real top-up flow (currently shows alert: "Demo mode: Top-up simulated!" at `src/app/usage/usage-content.tsx:86`).
91+
92+
### 12. Waitlist API — Payment Methods Not Implemented
93+
- [ ] Implement crypto payments — currently says "Crypto payments coming soon" (`src/app/api/waitlist/route.ts:142`).
94+
- [ ] Implement card payments — currently says "Card payments coming soon" (`src/app/api/waitlist/route.ts:245`).
95+
- [ ] Implement payment method selection in UI (`src/components/WaitlistModal.tsx:116`).
96+
97+
### 13. Homepage — Features Marked "Coming Soon"
98+
- [ ] Implement three "Coming soon" feature sections on homepage (`src/app/page.tsx:601, 624, 650`).
99+
100+
### 14. Package Manager Submissions — Placeholder Hashes
101+
- [ ] Replace `SHA256_PLACEHOLDER` in Homebrew submission (`scripts/lib/package-managers/homebrew.ts:58-59`).
102+
- [ ] Replace `SHA256_PLACEHOLDER` in Winget submission (`scripts/lib/package-managers/winget.ts:41`).
103+
- [ ] Replace `SHA256_PLACEHOLDER` in Scoop submission (`scripts/lib/package-managers/scoop.ts:69`).
104+
105+
---
106+
107+
## 🔵 Future / Nice-to-Have
108+
109+
### 15. PRD Roadmap — Phase 1 (MVP)
110+
- [ ] CLI scaffold with `init`, `monitor`, `status` commands (exists but gated).
111+
- [ ] Core module: `log-watcher` (partially implemented in CLI monitor command).
112+
- [ ] Core module: `ssh-guard` (partially implemented in CLI monitor command).
113+
- [ ] Alert system (webhook).
114+
- [ ] systemd unit file.
115+
116+
### 16. PRD Roadmap — Phase 2 (Beta)
117+
- [ ] Core module: `network-monitor` (pcap-based).
118+
- [ ] Core module: `code-scanner` (CLI scan command exists but is gated).
119+
- [ ] Core module: `pentest-engine`.
120+
- [ ] Module store on threatcrush.com (store pages exist but are UI-only).
121+
- [ ] `threatcrush modules install/publish` commands (gated).
122+
- [ ] License activation (gated).
123+
124+
### 17. PRD Roadmap — Phase 3 (Launch)
125+
- [ ] Core module: `dns-monitor`.
126+
- [ ] Core module: `firewall-rules`.
127+
- [ ] Dashboard web UI.
128+
- [ ] Cloud sync.
129+
- [ ] Enterprise features.
130+
131+
### 18. Docker / NPM / CI Workflows
132+
- [ ] Retest Docker publish workflow (had issues with Docker Hub auth; needs retest after GHCR-only fallback fix).
133+
- [ ] Confirm `npm-publish.yml` workflow works with real secrets.
134+
- [ ] Confirm `docker-publish.yml` workflow works with real secrets.
135+
- [ ] Confirm `submit-packages.yml` workflow works with real secrets.
136+
137+
### 19. Hardware Appliance — Future Plans Only
138+
- The entire "ThreatCrush Box" hardware appliance line (Stick, Mini, Rack) is a future plan per `docs/FUTURE_PLANS.md`. Timeline starts Q3 2026 for software MVP and extends to 2028 for enterprise hardware. No action needed now.
139+
140+
---
141+
142+
## Quick Reference
143+
144+
| Category | Key Files |
145+
|---|---|
146+
| Phone verification | `src/app/api/auth/verify-phone/route.ts` |
147+
| Supabase config | `src/lib/supabase.ts` |
148+
| CLI commands | `cli/src/index.ts`, `cli/src/commands/*.ts` |
149+
| TUI dashboard | `cli/src/tui/` (missing entirely) |
150+
| Module marketplace | `cli/src/commands/modules.ts` |
151+
| Desktop app | `desktop/src/preload/index.ts`, `.github/workflows/desktop-release.yml` |
152+
| Mobile app | `mobile/app/index.tsx`, `mobile/src/stores/events.ts`, `mobile/src/lib/crypto.ts` |
153+
| Browser extension | `extension/src/background/index.js`, `extension/src/store/events.js` |
154+
| Usage/billing | `src/app/api/usage/route.ts`, `src/app/usage/usage-content.tsx` |
155+
| Waitlist/payments | `src/app/api/waitlist/route.ts`, `src/components/WaitlistModal.tsx` |
156+
| Homepage | `src/app/page.tsx` |
157+
| Package managers | `scripts/lib/package-managers/homebrew.ts`, `winget.ts`, `scoop.ts` |

0 commit comments

Comments
 (0)