Skip to main content
Security & Identity

Security & Compliance

Security architecture

Defence in depth across five concentric rings:

  1. Transport — TLS-only, HSTS preload, upgrade-insecure-requests.
  2. Browser — strict CSP (frame-ancestors 'none', connect-src scoped to *.supabase.co + self), X-Content-Type-Options: nosniff, minimal Permissions-Policy, Referrer-Policy: strict-origin-when-cross-origin.
  3. Identity — TOTP MFA mandatory (AAL2 gate on /app/*), brute-force lockout, 30-min idle sign-out, 8-hour absolute session maximum.
  4. Application — Zod input validation in server functions, server-only modules blocked from client bundles, role checks via SECURITY DEFINER function.
  5. Data — RLS on every public table, field-level encryption for sensitive payloads, append-only audit trails, service-role bypass restricted to trusted server code.

Headers are applied in:

  • public/_headers (production CDN)
  • vite.config.ts (dev server)
  • src/server.ts (SSR responses)

Encryption standards

ConcernMechanism
Data in transit (browser ↔ edge)TLS 1.3 via Cloudflare; HSTS max-age=63072000; includeSubDomains; preload.
Data in transit (edge ↔ Supabase)TLS 1.3, mutual auth via JWT.
Data at rest (Postgres)Provider-managed AES-256 encryption.
Field-level encryptionsrc/lib/security/fieldEncryption.ts for sensitive payloads at the application boundary.
SecretsLovable Cloud secret store, never committed to git, never exposed to the browser bundle.

Audit logging

All security-relevant events are recorded:

Event classTableWriter
Sign-in attempts (success + failure)public.sec_login_attemptslogin-rate-limit edge function
Role grants, revokes, attestationspublic.access_audit_logServer functions
MFA enrolmentpublic.access_audit_logServer functions
GDPR DSARspublic.gdpr_requestsServer functions

Logs are append-only from the application's perspective. Only the service role can write (and only the documented writers do).

Access controls

  • RLS enabled on every public table.
  • GRANT statements explicit in every migration that creates a public-schema table.
  • Role checks via public.has_role(uuid, app_role) (SECURITY DEFINER, fixed search_path = public).
  • Route gating: TanStack Start beforeLoad on _authenticated/ subtree.
  • Server function gating: requireSupabaseAuth middleware on every protected fn.

Data protection controls

ControlImplementation
Least-privilege role assignmentTime-bound access_grants with expires_at
Periodic access reviewaccess_reviews workflow + attestation evidence
Data subject rights (GDPR)gdpr_requests workflow + DPO assignment
Tenant isolationRLS scoping via useTenant context and tenant-keyed FKs
LLM I/O guardrailssrc/lib/security/llmGuard.ts filters input and output of AI-mediated surfaces
Resilience to upstream failuresrc/lib/resilience/circuitBreaker.ts

Regulatory mapping

DORA (Digital Operational Resilience Act)

ArticleControlWhere implemented
Art. 9 — ICT securityStrong authentication, access attempt loggingauth.tsx, login-rate-limit, sec_login_attempts
Art. 11 — Response & recoveryCircuit breakers, idle sign-outcircuitBreaker.ts, InactivityGuard
Art. 12 — Record keepingAppend-only audit trailsaccess_audit_log, audit log viewer

ISO/IEC 27001:2022 (Annex A)

ControlImplementation
A.5.15 Access controlRBAC + RLS + has_role
A.5.34 Privacy / PIIDSAR workflow
A.8.5 Secure authenticationTOTP MFA, brute-force lockout
A.8.24 CryptographyTLS, field-level encryption
A.8.28 Secure codingZod validation, server/client boundary enforcement

NIST AI RMF

FunctionImplementation
GOVERNAccess governance pages, role attestation reviews
MAP/app/ai-assessments, /app/ai-models
MEASURE/app/fairness, monitoring dashboards
MANAGE/app/ai-approvals, /app/exception-center

OWASP Top 10

RiskMitigation
A01 Broken Access ControlRLS + has_role + AAL2 route gate
A02 Cryptographic FailuresHTTPS-only via HSTS, field-level encryption
A05 Security MisconfigurationCSP, headers, frame-ancestors none
A07 Identification & Authentication FailuresMFA, rate limit, idle timeout
A09 Security LoggingAppend-only audit log + viewer

NCSC Cloud Security Principles

  • CSP 9 (Secure user management) — MFA enforcement, login attempt logging, audit access reviews.

For the full text of how each control is implemented, see SECURITY.md at the repository root.