Security
BuildPad DaaS uses a defence-in-depth approach with security enforced at three layers.
Security Layers
On the Buildpad Engine backend:
| Layer | Mechanism |
|---|---|
| Tenant | Each tenant has its own PostgreSQL schema. Each session and each static token belongs to one tenant |
| API | The Engine applies roles, permissions, row filters and field lists before each request runs |
| Application | JWT validation, session revocation, multi-factor step-up, input validation, rate limits for each session |
There is no PostgreSQL row-level security to write. The table below is for the Supabase backend.
| Layer | Mechanism |
|---|---|
| Database | PostgreSQL Row-Level Security (RLS) policies |
| API | Permission rule enforcement per route |
| Application | JWT validation, session management, input validation |
Authentication Methods
On the Buildpad Engine backend, a JWT bearer token is the credential for the API. A static token is an MCP credential. A data token of an account that is not an administrator also works on the item routes. See Static Token. The Engine sets no cookie.
| Method | RLS Protection | Best For |
|---|---|---|
| Cookie/Session | ✅ Database-level | Web UI |
| JWT Bearer Token | ✅ Database-level | Secure API clients |
| Static Token | ⚠️ App-layer only | Automation, CI/CD |
Static tokens use the Supabase service role internally, which bypasses database RLS. Application-layer permissions still apply. Use JWT tokens where database-level isolation is critical.
If SUPABASE_JWT_SECRET is set, JWT bearer tokens are verified in-process instead of per-request against GoTrue (faster). Security trade-off: a session revoked via logout stays valid until the token expires — per-request user-status checks still apply, and only users with an active daas_users row use the local path. Leave it unset where immediate revocation matters.
Row-Level Security
Not used on the Buildpad Engine backend. See Security Layers.
RLS policies are applied to all core system tables. Enable RLS on your custom tables using the generic RLS helper function:
-- Enable RLS on a custom table
ALTER TABLE your_table ENABLE ROW LEVEL SECURITY;
-- Apply the generic read policy (requires auth)
CREATE POLICY "authenticated_read" ON your_table
FOR SELECT USING (auth.uid() IS NOT NULL);For the full generic RLS setup that automatically applies policies to new tables, run the corresponding migration in supabase/migrations/.
Audit Logging
Every create, update, and delete performed through the API is logged to daas_activity by the application layer (fire-and-forget, from ItemsService). Database-level audit triggers were removed — writes made directly in SQL bypass the audit log. The audit level is configurable per collection via daas_collections.accountability (all = log with full revisions, activity = log without revisions, NULL = no logging). Query the audit log via:
GET /api/revisions — paginated activity log (admin only)
GET /api/revisions/:id — single activity entryProduction Checklist
On the Buildpad Engine backend, also:
- ✅ Set
JWT_SECRETon the Engine. Without it, the Engine signs tokens with a built-in development key - ✅ Set
MFA_ENCRYPTION_KEYon the Engine if your users need a second factor - ✅ Keep the S3 bucket private, and give the Engine’s role only the actions in File Storage
- ✅ Set the Engine’s cross-origin rules to the origins that need them, including the Studio’s origin
- The Engine has built-in rate limits for each session, static token and network address (
RATE_LIMIT_RPSon the Engine)
- ✅ Set explicit allowed origins in Settings → CORS (never
*) — theCORS_ORIGINSenv var is only a fallback used before migrations run; on upgraded databases verify the stored origins list no longer contains the legacy wildcard - ✅ Use HTTPS in production (via TLS termination at load balancer or nginx)
- ✅ Set
NEXT_TELEMETRY_DISABLED=1 - ✅ Restrict the EC2 security group: only ports 80/443 public, 22 restricted
- ✅ Rotate the
SUPABASE_SERVICE_ROLE_KEYif compromised (Supabase backend only) - ✅ Use IAM roles for EC2 instead of static AWS credentials
- ⬜ Configure rate limiting (not built-in — use nginx
limit_reqor an API gateway) in front of the Studio (nginxlimit_reqor an API gateway)