Security breaches cost SaaS companies an average of $4.24M per incident. Here's our battle-tested security checklist from protecting 50+ production applications.
Authentication & Authorization
Must-Have Features
- ✓ Password hashing with bcrypt (minimum 12 rounds)
- ✓ Multi-factor authentication (MFA) via TOTP or SMS
- ✓ OAuth 2.0 for third-party integrations
- ✓ Role-based access control (RBAC)
- ✓ Session management with secure tokens (JWT)
- ✓ Account lockout after failed login attempts
- ✓ Password reset with time-limited tokens
Implementation Example
// Secure password hashing
const hashedPassword = await bcrypt.hash(password, 12);
// JWT with short expiration
const token = jwt.sign(
{ userId, role },
process.env.JWT_SECRET,
{ expiresIn: '15m' }
);
Data Protection
Encryption Requirements
- In Transit: TLS 1.3 minimum (no TLS 1.0/1.1)
- At Rest: AES-256 encryption for sensitive data
- Database: Encrypted backups and snapshots
- File Storage: S3 with server-side encryption
PII Handling
- Never log sensitive data (passwords, SSN, credit cards)
- Implement data masking in non-prod environments
- Use tokenization for payment information
- Automatic PII redaction in error logs
Application Security
OWASP Top 10 Protection
- 1. Injection: Parameterized queries, input validation
- 2. Broken Authentication: MFA, secure session management
- 3. XSS: Content Security Policy, output encoding
- 4. CSRF: Anti-CSRF tokens, SameSite cookies
- 5. Security Misconfiguration: Security headers, least privilege
Security Headers
// Essential security headers
Strict-Transport-Security: max-age=31536000
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src 'self'
Referrer-Policy: strict-origin-when-cross-origin
Infrastructure Security
Cloud Security
- VPC isolation for database and backend services
- Security groups with least privilege access
- Automated security patching
- DDoS protection (CloudFlare, AWS Shield)
- Web Application Firewall (WAF)
Monitoring & Logging
- Centralized logging (CloudWatch, Datadog)
- Real-time security alerts
- Failed authentication tracking
- API rate limiting and abuse detection
- Audit logs for sensitive operations
Compliance Requirements
GDPR (EU)
- Data processing agreements (DPA)
- Right to access and deletion
- Cookie consent management
- Data breach notification (72 hours)
- Privacy policy and terms of service
SOC 2 Type II
- Security policies and procedures
- Access controls and monitoring
- Incident response plan
- Vendor risk assessment
- Annual penetration testing
Incident Response
Security Incident Playbook:
- Detection: Alert triggered, severity assessment
- Containment: Isolate affected systems, block access
- Investigation: Root cause analysis, scope determination
- Remediation: Fix vulnerability, patch systems
- Recovery: Restore services, verify integrity
- Notification: Inform affected users (if required)
- Post-mortem: Document learnings, update procedures