Security model
Trust boundaries
| Layer | Role |
|---|---|
| Browser | Untrusted — anon key only |
| Angular guards | UX — redirect guests, hide billing |
| Postgres RLS | Authorization for reads |
| Edge Functions (service role) | Authorization for writes (credits, jobs, billing apply) |
Generation
generate/generate-batch: JWT + org membership + project editorgeneration-webhook: shared secret or provider signature; SSRF allow-list on output URLsgeneration-process: project editor (aligned with cancel)- Credit RPCs:
service_roleonly
Billing
- Plan changes in production:
apply_billing_subscriptionvia verified webhooks update_organization_plan: gated byprivate.platform_settings.self_serve_billing(off by default; seed enables for local mock)
Tables
generation_jobs, credit_balances, credit_transactions — SELECT for org members; no authenticated INSERT on jobs.
See Production hardening for the full backlog and P0/P1 checklist.
Last updated on