2 Commits
Author SHA1 Message Date
Georgy ButaevandClaude Opus 4.8 a52836c793 chore: remove all Vercel — everything runs on Hetzner
Production is fully self-hosted on the Hetzner box (bitbaum, behind Caddy)
with self-hosted Supabase. This scrubs the remaining Vercel footprint:

Code (src/ now has zero Vercel references):
- security page: "Hosted on Vercel" → self-hosted infrastructure
- FleetCrown URL fleetcrown.vercel.app → fleetcrown.orangecat.ch (entity
  registry + external-publish allowlist; the dead vercel.app subdomain was
  also a re-registration risk in an allowlist)
- webhook-secret error + cron/env comments point at the box, not Vercel
- corrected stale "Vercel kills the function on response" comments (false
  on a persistent server) to accurate await-before-respond reasoning

Security/config:
- supabase/config.toml: dropped dead *.vercel.app auth redirect URLs
- @vercel/mcp-adapter dependency removed (unused)

Artifacts removed:
- scripts/auth/vercel-login.js, scripts/preview-url.sh,
  scripts/dev/merge-env.js, scripts/monitoring/deployment-monitor.js,
  scripts/db/setup-env.js, mcp-servers/vercel-openapi.json, .vercel/
- setup_vercel_secrets MCP tool in mcp-servers/github-server.js
- .gitignore Vercel section; env scripts stripped of vercel-login/token

Docs + .claude rules/commands rewritten to the self-host deploy flow
(scripts/deploy-selfhost.sh / .github/workflows/cd.yml; env at
/opt/orangecat/app/.env). Historical/archive records left intact.

Verified: tsc 0 errors, SELF_HOST=1 build green, cron unit tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 08:50:43 +02:00
Georgy ButaevandClaude Opus 4.7 cc76194fd6 feat(crypto): encrypt webhook_endpoints secrets at rest (phase 1 of 2)
The PHASE-2 debt the user explicitly chose 30+ commits ago in
2755a8a5 ("plaintext for now, encrypt later"). Webhook signing secrets
are needed at fire time (the worker must sign each delivery), so they
have to live somewhere — but a DB compromise should NOT reveal them.

This commit lands the encryption infrastructure and starts dual-write.
Commit 2 of 2 will backfill secret_encrypted (no-op today: prod has
zero webhook_endpoints rows), flip getEndpointSigningContext to
decrypt, drop secret_plaintext.

Cipher (src/lib/crypto/webhookSecretCipher.ts):
  AES-256-GCM with WEBHOOK_SECRET_KEY env var (32-byte hex). Ciphertext
  layout: IV(12B) || GCM tag(16B) || ciphertext. Authenticated — a
  flipped byte anywhere in the blob throws on decrypt, so a DB
  compromise can't return a forged secret to the worker (only DoS by
  deleting rows). loadKey() validates the env var at first use and
  caches the parsed key; resetCachedKey() is test-only.

Schema (migration 20260604000003, applied to remote):
  ALTER webhook_endpoints ADD COLUMN secret_encrypted BYTEA.
  Service dual-writes; reads still come from secret_plaintext so the
  worker keeps signing deliveries unchanged.

Service (webhookEndpointsService.createWebhookEndpoint):
  Dual-writes secret_plaintext + secret_encrypted on mint. If
  encryptWebhookSecret throws (env var missing/malformed), the mint
  fails — we never store a row that phase 2 can't decrypt.

Deploy checklist: new step 9 (WEBHOOK_SECRET_KEY env var) with
generation command, verification (mint a webhook endpoint and watch
for 500), rollback warning (rotating the key requires re-encryption,
mention of incident-response posture).

Tests (16):
  loadKey: cache, missing env, empty env, non-hex, wrong length
  round-trip: exact equality, len-1, 4KB, unicode, IV-randomness,
    blob layout assertion (12+16+len(plaintext))
  tampering: flipped ciphertext / IV / tag byte, truncated blob,
    wrong key → all throw

Suite: 55 suites · 717 tests · 0 failures (+1 suite, +16 tests).
tsc + eslint clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 04:03:38 +02:00