security: pentest fixes — webhook sig, CORS, soul-health gate, asset headers #69
Reference in New Issue
Block a user
Delete Branch "fix/checkout-auth-reveal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Stripe-Signatureverification. Unauthenticated POST could forgepayment_intent.succeededevents, increment the founding counter, and trigger Supabase account provisioning for arbitrary emails./api/supabase-config: Restrict toneurontechnologies.aiandlocalhostorigins; cross-origin requests get 403./api/soul-healthinfo leak: RequireX-Internal: trueheader; returns 404 without it. Was publicly leaking soul service URL, network topology, and probe responses.X-Frame-Options,Referrer-Policy,Permissions-Policy, andCSPtostatic_asset_headers_jsonandjs_headers_json. Previously only HTML/API responses carried the full security header set.__neuron_origin__state key bug:share_card_pagewas reading the wrong state key (__neuron_origin__instead of__origin__), causing empty base URLs in share card OG meta tags.http_serve_v2/http_set_handler_v2so the El handler receives request headers as aMap(prerequisite for all header-based checks).Test plan
curl -H "Origin: https://evil.com" /api/supabase-config→ 403curl /api/soul-health(no X-Internal) → 404curl -H "X-Internal: true" /api/soul-health→ probe resultscurl -X POST /api/webhooks/stripe(no sig) → 400- Switch to http_serve_v2/http_set_handler_v2 so request headers are available to El handler code (prerequisite for all header-based security checks) - Stripe webhook (CVE-class): add HMAC-SHA256 signature verification against Stripe-Signature header using STRIPE_WEBHOOK_SECRET env var. Previously any unauthenticated POST could forge a payment_intent.succeeded event and increment the founding counter or trigger Supabase account provisioning for arbitrary emails. - CORS on /api/supabase-config: restrict to neurontechnologies.ai and localhost origins only. Cross-origin requests now get 403. - /api/soul-health: require X-Internal: true header; otherwise return 404. Endpoint was publicly accessible and leaked internal soul service URL, network topology, and raw probe responses. - Static asset / JS headers: add X-Frame-Options, Referrer-Policy, Permissions-Policy, and Content-Security-Policy to static_asset_headers_json and js_headers_json. These were only present on HTML/API responses before. - Fix state key bug: share_card_page read state_get("__neuron_origin__") but the key registered at startup is "__origin__", causing empty base URLs in share card og: meta tags.