Consolidate audit-fixes branch: webhooks, integrations, and deploy hardening

Batch commit of the pending working tree on security/audit-fixes-2026-07.
Major areas:
- Outbound webhooks / Zapier: schema + signed delivery with retries, public
  v1 API (REST-hook subscribe/unsubscribe), settings UI, cron drain.
- Deploy hardening: email via SMTP2GO (Resend fully removed), verified DB TLS
  (DATABASE_SSL=require + DATABASE_CA), storage fails loud in production when
  Spaces is unconfigured instead of silently using ephemeral disk.
- Integrations & features (concurrent work): accounting (QuickBooks/Xero),
  e-signature (DocuSign/Dropbox Sign), PayPal, geocoding/maps, onboarding,
  expanded legal pages.
- DB migrations 0006–0009.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Leon Serfaty
2026-07-02 13:42:34 -04:00
co-authored by Claude Opus 4.8
parent 969d5d4c8a
commit c9968531e4
282 changed files with 41530 additions and 4013 deletions
+15 -2
View File
@@ -23,6 +23,7 @@ const PROTECTED_PATHS = [
"/recommendations",
"/impact",
"/follow-ups",
"/team",
]
const AUTH_PATHS = ["/login", "/signup", "/forgot-password"]
@@ -34,13 +35,25 @@ const AUTH_PATHS = ["/login", "/signup", "/forgot-password"]
// `content-security-policy` request header and applies it to its own inline
// scripts automatically.
function buildCsp(nonce: string): string {
const isDev = process.env.NODE_ENV !== "production"
// In development, Next.js/React and Turbopack HMR require eval() for hot
// reloading and debugging features, and open a dev websocket. These are NOT
// added in production, where the nonce-based policy stays strict.
const scriptSrc = isDev
? `script-src 'self' 'nonce-${nonce}' 'unsafe-eval' https://challenges.cloudflare.com`
: `script-src 'self' 'nonce-${nonce}' https://challenges.cloudflare.com`
const connectSrc = isDev
? "connect-src 'self' ws: wss: https://api.stripe.com https://api.openai.com https://challenges.cloudflare.com"
: "connect-src 'self' https://api.stripe.com https://api.openai.com https://challenges.cloudflare.com"
return [
"default-src 'self'",
"img-src 'self' data: blob: https:",
"style-src 'self' 'unsafe-inline'",
`script-src 'self' 'nonce-${nonce}' https://challenges.cloudflare.com`,
scriptSrc,
"font-src 'self' data:",
"connect-src 'self' https://api.stripe.com https://api.openai.com https://api.resend.com https://challenges.cloudflare.com",
connectSrc,
"frame-src https://js.stripe.com https://hooks.stripe.com https://challenges.cloudflare.com",
"frame-ancestors 'none'",
"base-uri 'self'",