Skip to main content
The default Supabase Docker configuration is not secure for production. This guide covers essential security measures you must implement before deploying.
Never deploy with default configuration! Default passwords and secrets are publicly known and will be exploited.

Pre-Deployment Checklist

1

Change All Secrets

Replace every default password and secret in .env:
2

Configure HTTPS

Never run production without TLS encryption. Use a reverse proxy with SSL certificates.
3

Enable Firewall

Restrict network access to only required ports.
4

Set Up Backups

Implement automated database backups with off-site storage.
5

Configure SMTP

Set up transactional email for password resets and notifications.

Secrets Management

Critical Secrets

These must be changed before production:
Risk: Root database accessGenerate:
Requirements:
  • Minimum 32 characters
  • Mix of letters, numbers, special characters
  • Unique per installation
  • Store in password manager
Risk: Token forgery, authentication bypassGenerate:
Requirements:
  • Minimum 32 characters (64+ recommended)
  • Keep absolutely secret
  • Never expose in client code
  • Rotating requires regenerating all JWT keys
Risk: Administrative access to StudioGenerate:
Requirements:
  • Strong password (20+ characters)
  • Enable 2FA if available
  • Rotate quarterly
Risk: Bypasses Row Level SecurityGenerate: Use JWT generator with your JWT_SECRETRequirements:
  • Only use server-side
  • Never expose in frontend code
  • Never commit to repositories
  • Rotate if compromised

Secret Rotation

Regularly rotate sensitive credentials:

Network Security

Firewall Configuration

Allow only necessary ports:
Block direct access to services:

Reverse Proxy with HTTPS

Use nginx or Caddy as a TLS termination proxy:
/etc/nginx/sites-available/supabase
Enable and restart:

SSL Certificates

Use Let’s Encrypt for free SSL certificates:

Database Security

Row Level Security (RLS)

Always enable RLS on user-facing tables:
Tables without RLS policies are accessible to anyone with the service_role key!

Postgres Security

Connection Security

postgresql.conf
pg_hba.conf

Authentication Security

Password Policies

Enforce strong passwords in GoTrue:
.env

Rate Limiting

Protect against brute force attacks:
volumes/api/kong.yml

Multi-Factor Authentication

Enable MFA for administrative accounts:
.env

OAuth Security

Secure OAuth configurations:

Storage Security

Bucket Policies

Restrict file access with policies:

File Upload Restrictions

.env

Monitoring & Auditing

Audit Logging

Track security events:

Failed Login Monitoring

Incident Response

Security Breach Procedure

1

Contain the Breach

  • Immediately rotate all secrets
  • Block compromised IP addresses
  • Revoke compromised API keys
  • Disable affected user accounts
2

Assess Impact

  • Review audit logs
  • Identify affected data
  • Check for data exfiltration
  • Document timeline
3

Remediate

  • Apply security patches
  • Fix vulnerabilities
  • Restore from clean backup if needed
  • Update security policies
4

Notify Stakeholders

  • Alert affected users
  • Report to authorities if required
  • Update security documentation

Emergency Access Revocation

Security Checklist

Before going to production:
  • All default passwords changed
  • Strong, unique secrets generated
  • HTTPS enabled with valid SSL certificate
  • Firewall configured
  • Database backups automated
  • RLS enabled on all user tables
  • SMTP configured for email
  • OAuth providers verified
  • File upload restrictions set
  • Rate limiting configured
  • Monitoring and alerts set up
  • Audit logging enabled
  • Incident response plan documented
  • Regular security updates scheduled

Next Steps

Updates

Keep your stack secure with regular updates

Backups

Implement backup and recovery

Monitoring

Set up security monitoring

Compliance

Meet regulatory requirements